diff options
author | Alexandru Croitor <alexandru.croitor@qt.io> | 2019-04-18 14:04:42 +0200 |
---|---|---|
committer | Christian Tismer <tismer@stackless.com> | 2019-04-20 08:33:07 +0000 |
commit | 077006a9ea18305a183e2cf809e3b88e5f7f3619 (patch) | |
tree | e1219b0e8e9bbf189881cd4ab030438fd6e15745 /sources/shiboken2/tests | |
parent | 48625f9447caaea3fb9524169bb75dd881cdf4c9 (diff) |
Modernize and clean up some of the shiboken build system files
Use target_* commands instead of subdirectory based commands
for adding link options, compile definitions, include directories,
etc.
Remove some non-used compile definitions.
Move around some of the find_package() and option() calls.
Simplify some of the package dependent logic.
Replace the qt include and linking variables with CMake targets.
Change-Id: I815595344e63a32dce3dc78652359beede3ff593
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Christian Tismer <tismer@stackless.com>
Diffstat (limited to 'sources/shiboken2/tests')
-rw-r--r-- | sources/shiboken2/tests/CMakeLists.txt | 3 | ||||
-rw-r--r-- | sources/shiboken2/tests/dumpcodemodel/CMakeLists.txt | 5 | ||||
-rw-r--r-- | sources/shiboken2/tests/libminimal/CMakeLists.txt | 4 | ||||
-rw-r--r-- | sources/shiboken2/tests/libother/CMakeLists.txt | 8 | ||||
-rw-r--r-- | sources/shiboken2/tests/libsample/CMakeLists.txt | 4 | ||||
-rw-r--r-- | sources/shiboken2/tests/libsmart/CMakeLists.txt | 4 | ||||
-rw-r--r-- | sources/shiboken2/tests/minimalbinding/CMakeLists.txt | 11 | ||||
-rw-r--r-- | sources/shiboken2/tests/otherbinding/CMakeLists.txt | 17 | ||||
-rw-r--r-- | sources/shiboken2/tests/samplebinding/CMakeLists.txt | 11 | ||||
-rw-r--r-- | sources/shiboken2/tests/smartbinding/CMakeLists.txt | 11 |
10 files changed, 25 insertions, 53 deletions
diff --git a/sources/shiboken2/tests/CMakeLists.txt b/sources/shiboken2/tests/CMakeLists.txt index c06c56f6d..085a4344c 100644 --- a/sources/shiboken2/tests/CMakeLists.txt +++ b/sources/shiboken2/tests/CMakeLists.txt @@ -1,6 +1,3 @@ -find_package(Qt5 REQUIRED COMPONENTS Core) -include_directories(${Qt5Core_INCLUDE_DIRS}) - add_subdirectory(libminimal) if(NOT DEFINED MINIMAL_TESTS) add_subdirectory(libsample) diff --git a/sources/shiboken2/tests/dumpcodemodel/CMakeLists.txt b/sources/shiboken2/tests/dumpcodemodel/CMakeLists.txt index af18cb3c8..7c6d60fe2 100644 --- a/sources/shiboken2/tests/dumpcodemodel/CMakeLists.txt +++ b/sources/shiboken2/tests/dumpcodemodel/CMakeLists.txt @@ -1,5 +1,6 @@ add_executable(dumpcodemodel main.cpp) -include_directories(${CMAKE_CURRENT_SOURCE_DIR} ${apiextractor_SOURCE_DIR} ${Qt5Core_INCLUDE_DIRS}) +target_include_directories(dumpcodemodel + PRIVATE ${CMAKE_CURRENT_SOURCE_DIR} ${apiextractor_SOURCE_DIR}) -target_link_libraries(dumpcodemodel apiextractor ${Qt5Core_LIBRARIES}) +target_link_libraries(dumpcodemodel PUBLIC apiextractor Qt5::Core) diff --git a/sources/shiboken2/tests/libminimal/CMakeLists.txt b/sources/shiboken2/tests/libminimal/CMakeLists.txt index a25892571..f906bdb84 100644 --- a/sources/shiboken2/tests/libminimal/CMakeLists.txt +++ b/sources/shiboken2/tests/libminimal/CMakeLists.txt @@ -6,8 +6,8 @@ listuser.cpp typedef.cpp ) -include_directories(${CMAKE_CURRENT_SOURCE_DIR}) -add_definitions("-DLIBMINIMAL_BUILD") add_library(libminimal SHARED ${libminimal_SRC}) +target_include_directories(libminimal PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}) +target_compile_definitions(libminimal PRIVATE LIBMINIMAL_BUILD) set_property(TARGET libminimal PROPERTY PREFIX "") diff --git a/sources/shiboken2/tests/libother/CMakeLists.txt b/sources/shiboken2/tests/libother/CMakeLists.txt index 9b3cf5552..6aba91e13 100644 --- a/sources/shiboken2/tests/libother/CMakeLists.txt +++ b/sources/shiboken2/tests/libother/CMakeLists.txt @@ -7,12 +7,10 @@ otherobjecttype.cpp othermultiplederived.cpp ) -add_definitions("-DLIBOTHER_BUILD") add_library(libother SHARED ${libother_SRC}) +target_include_directories(libother PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}) +target_compile_definitions(libother PRIVATE LIBOTHER_BUILD) +target_link_libraries(libother PUBLIC libsample) set_property(TARGET libother PROPERTY PREFIX "") -include_directories(${CMAKE_CURRENT_SOURCE_DIR} - ${libsample_SOURCE_DIR} - ${libsample_SOURCE_DIR}/..) -target_link_libraries(libother libsample) diff --git a/sources/shiboken2/tests/libsample/CMakeLists.txt b/sources/shiboken2/tests/libsample/CMakeLists.txt index ae3d40312..170829fbc 100644 --- a/sources/shiboken2/tests/libsample/CMakeLists.txt +++ b/sources/shiboken2/tests/libsample/CMakeLists.txt @@ -51,8 +51,8 @@ expression.cpp filter.cpp ) -include_directories(${CMAKE_CURRENT_SOURCE_DIR}) -add_definitions("-DLIBSAMPLE_BUILD") add_library(libsample SHARED ${libsample_SRC}) +target_include_directories(libsample PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}) +target_compile_definitions(libsample PRIVATE LIBSAMPLE_BUILD) set_property(TARGET libsample PROPERTY PREFIX "") diff --git a/sources/shiboken2/tests/libsmart/CMakeLists.txt b/sources/shiboken2/tests/libsmart/CMakeLists.txt index 66c27cdae..152c57f25 100644 --- a/sources/shiboken2/tests/libsmart/CMakeLists.txt +++ b/sources/shiboken2/tests/libsmart/CMakeLists.txt @@ -4,8 +4,8 @@ set(libsmart_SRC smart.cpp ) -include_directories(${CMAKE_CURRENT_SOURCE_DIR}) -add_definitions("-DLIBSMART_BUILD") add_library(libsmart SHARED ${libsmart_SRC}) +target_include_directories(libsmart PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}) +target_compile_definitions(libsmart PRIVATE LIBSMART_BUILD) set_property(TARGET libsmart PROPERTY PREFIX "") diff --git a/sources/shiboken2/tests/minimalbinding/CMakeLists.txt b/sources/shiboken2/tests/minimalbinding/CMakeLists.txt index 7301e1882..ffeb086a0 100644 --- a/sources/shiboken2/tests/minimalbinding/CMakeLists.txt +++ b/sources/shiboken2/tests/minimalbinding/CMakeLists.txt @@ -24,18 +24,13 @@ WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} COMMENT "Running generator for 'minimal' test binding..." ) -include_directories(${CMAKE_CURRENT_SOURCE_DIR} - ${CMAKE_SOURCE_DIR} - ${libminimal_SOURCE_DIR} - ${libshiboken_SOURCE_DIR} - ${libshiboken_BINARY_DIR}) add_library(minimal MODULE ${minimal_SRC}) +target_include_directories(minimal PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}) +target_link_libraries(minimal PUBLIC libminimal libshiboken) set_property(TARGET minimal PROPERTY PREFIX "") set_property(TARGET minimal PROPERTY OUTPUT_NAME "minimal${PYTHON_EXTENSION_SUFFIX}") if(WIN32) set_property(TARGET minimal PROPERTY SUFFIX ".pyd") endif() -target_link_libraries(minimal - libminimal - libshiboken) + create_generator_target(minimal) diff --git a/sources/shiboken2/tests/otherbinding/CMakeLists.txt b/sources/shiboken2/tests/otherbinding/CMakeLists.txt index 44855e297..bc5c4bdad 100644 --- a/sources/shiboken2/tests/otherbinding/CMakeLists.txt +++ b/sources/shiboken2/tests/otherbinding/CMakeLists.txt @@ -26,26 +26,17 @@ WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} COMMENT "Running generator for 'other' test binding..." ) -include_directories(${CMAKE_CURRENT_SOURCE_DIR} - ${CMAKE_SOURCE_DIR} - ${libother_SOURCE_DIR} - ${libsample_SOURCE_DIR} - ${libsample_SOURCE_DIR}/.. - ${sample_BINARY_DIR} - ${sample_BINARY_DIR}/sample - ${libshiboken_SOURCE_DIR} - ${libshiboken_BINARY_DIR}) add_library(other MODULE ${other_SRC}) +target_include_directories(other PRIVATE ${CMAKE_CURRENT_SOURCE_DIR} + ${sample_BINARY_DIR}/sample) +target_link_libraries(other PUBLIC libother libsample libshiboken) set_property(TARGET other PROPERTY PREFIX "") set_property(TARGET other PROPERTY OUTPUT_NAME "other${PYTHON_EXTENSION_SUFFIX}") if(WIN32) set_property(TARGET other PROPERTY SUFFIX ".pyd") endif() -target_link_libraries(other - libother - libsample - libshiboken) + add_dependencies(other sample) create_generator_target(other) diff --git a/sources/shiboken2/tests/samplebinding/CMakeLists.txt b/sources/shiboken2/tests/samplebinding/CMakeLists.txt index 9ecbd98e6..61090d30e 100644 --- a/sources/shiboken2/tests/samplebinding/CMakeLists.txt +++ b/sources/shiboken2/tests/samplebinding/CMakeLists.txt @@ -137,19 +137,14 @@ WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} COMMENT "Running generator for 'sample' test binding..." ) -include_directories(${CMAKE_CURRENT_SOURCE_DIR} - ${CMAKE_SOURCE_DIR} - ${libsample_SOURCE_DIR} - ${libshiboken_SOURCE_DIR} - ${libshiboken_BINARY_DIR}) add_library(sample MODULE ${sample_SRC}) +target_include_directories(sample PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}) +target_link_libraries(sample PUBLIC libsample libshiboken) set_property(TARGET sample PROPERTY PREFIX "") set_property(TARGET sample PROPERTY OUTPUT_NAME "sample${PYTHON_EXTENSION_SUFFIX}") if(WIN32) set_property(TARGET sample PROPERTY SUFFIX ".pyd") endif() -target_link_libraries(sample - libsample - libshiboken) + create_generator_target(sample) diff --git a/sources/shiboken2/tests/smartbinding/CMakeLists.txt b/sources/shiboken2/tests/smartbinding/CMakeLists.txt index ed6bcef0a..88a7bc059 100644 --- a/sources/shiboken2/tests/smartbinding/CMakeLists.txt +++ b/sources/shiboken2/tests/smartbinding/CMakeLists.txt @@ -27,19 +27,14 @@ WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} COMMENT "Running generator for 'smart' test binding..." ) -include_directories(${CMAKE_CURRENT_SOURCE_DIR} - ${CMAKE_SOURCE_DIR} - ${libsmart_SOURCE_DIR} - ${libshiboken_SOURCE_DIR} - ${libshiboken_BINARY_DIR}) add_library(smart MODULE ${smart_SRC}) +target_include_directories(smart PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}) +target_link_libraries(smart PUBLIC libsmart libshiboken) set_property(TARGET smart PROPERTY PREFIX "") set_property(TARGET smart PROPERTY OUTPUT_NAME "smart${PYTHON_EXTENSION_SUFFIX}") if(WIN32) set_property(TARGET smart PROPERTY SUFFIX ".pyd") endif() -target_link_libraries(smart - libsmart - libshiboken) + create_generator_target(smart) |