Refactor CMake build scripts

1. Use FeatureSummary module to show configuration results.

2. Invert option()/find_package() relationship: instead of
calling find_package(... REQUIRED) when option is set, rely on optional
find package call and PackageName_FOUND variable.

3. Refactor handling options that result in simple preprocessor defines
(actually copy the snippet from libtorrent) so that everything is done
in a single function call.

4. Populate target properties in order to get rid of
include_directories() calls.
This commit is contained in:
Eugene Shalygin
2018-06-05 03:03:38 +02:00
committed by sledgehammer999
parent 57ec9db532
commit bb893e70c5
20 changed files with 313 additions and 353 deletions

View File

@@ -1,25 +1,13 @@
include_directories(
${CMAKE_CURRENT_BINARY_DIR}
${CMAKE_CURRENT_SOURCE_DIR}/..
${CMAKE_CURRENT_SOURCE_DIR}/../lineedit/src
)
set(QBT_SEARCHENGINE_FORMS
add_library(qbt_searchengine STATIC
pluginselectdlg.ui
pluginsourcedlg.ui
searchwidget.ui
)
set(QBT_SEARCHENGINE_HEADERS
pluginselectdlg.h
pluginsourcedlg.h
searchlistdelegate.h
searchsortmodel.h
searchtab.h
searchwidget.h
)
set(QBT_SEARCHENGINE_SOURCES
pluginselectdlg.cpp
pluginsourcedlg.cpp
searchlistdelegate.cpp
@@ -32,6 +20,9 @@ set(QBT_SEARCHENGINE_RESOURCES
# search.qrc
)
add_library(qbt_searchengine STATIC ${QBT_SEARCHENGINE_HEADERS} ${QBT_SEARCHENGINE_SOURCES} ${QBT_SEARCHENGINE_RESOURCES} ${QBT_SEARCHENGINE_FORMS})
target_link_libraries(qbt_searchengine qbt_base)
target_link_libraries(qbt_searchengine
PUBLIC
qbt_base
PRIVATE
qbt_lineedit qbt_gui_headers
)