diff options
author | Heiko Becker <heirecka@exherbo.org> | 2017-05-13 00:11:45 +0200 |
---|---|---|
committer | Heiko Becker <heirecka@exherbo.org> | 2017-07-29 11:00:15 +0200 |
commit | 9e6952baf64b51fa7ddb6ac91d4ce79ebfd2b2df (patch) | |
tree | 3a38a173968d2902cbc2459a17126ccb4e4c8cfb /tests | |
parent | 5275b0f173579162176e2340cbb9eaedafe8334a (diff) | |
download | sink-9e6952baf64b51fa7ddb6ac91d4ce79ebfd2b2df.tar.gz sink-9e6952baf64b51fa7ddb6ac91d4ce79ebfd2b2df.zip |
Use imported targets instead of qt5_use_modules
From Qt's documentation: "This macro is obsolete. Use
target_link_libraries with IMPORTED targets instead." It's only
recommended with cmake >=2.8.9 & < 2.8.12. Sink already requires
cmake 3.0. One advantage of using the imported targets is, that
cmake complains if a target isn't found before it's used, like
Qt5Concurrent missing from the find_package_call here.
Reviewers: #sink, cmollekopf
Reviewed By: #sink, cmollekopf
Subscribers: #sink
Tags: #sink
Differential Revision: https://phabricator.kde.org/D6361
Diffstat (limited to 'tests')
-rw-r--r-- | tests/CMakeLists.txt | 10 | ||||
-rw-r--r-- | tests/SinkTest.cmake | 19 | ||||
-rw-r--r-- | tests/hawd/CMakeLists.txt | 6 |
3 files changed, 25 insertions, 10 deletions
diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt index 2b3e7b1..b0333a4 100644 --- a/tests/CMakeLists.txt +++ b/tests/CMakeLists.txt | |||
@@ -13,8 +13,14 @@ add_definitions(-DTESTDATAPATH="${CMAKE_CURRENT_SOURCE_DIR}/data") | |||
13 | find_package(KF5 COMPONENTS REQUIRED Mime) | 13 | find_package(KF5 COMPONENTS REQUIRED Mime) |
14 | 14 | ||
15 | add_library(sink_test SHARED testimplementations.cpp getrssusage.cpp mailtest.cpp mailsynctest.cpp mailthreadtest.cpp) | 15 | add_library(sink_test SHARED testimplementations.cpp getrssusage.cpp mailtest.cpp mailsynctest.cpp mailthreadtest.cpp) |
16 | qt5_use_modules(sink_test Core Test Concurrent) | 16 | target_link_libraries(sink_test |
17 | target_link_libraries(sink_test sink libhawd KF5::Mime) | 17 | sink |
18 | libhawd | ||
19 | Qt5::Core | ||
20 | Qt5::Concurrent | ||
21 | Qt5::Test | ||
22 | KF5::Mime | ||
23 | ) | ||
18 | 24 | ||
19 | add_executable(dbwriter dbwriter.cpp) | 25 | add_executable(dbwriter dbwriter.cpp) |
20 | target_link_libraries(dbwriter sink) | 26 | target_link_libraries(dbwriter sink) |
diff --git a/tests/SinkTest.cmake b/tests/SinkTest.cmake index 03076e7..4eb8f43 100644 --- a/tests/SinkTest.cmake +++ b/tests/SinkTest.cmake | |||
@@ -17,8 +17,13 @@ macro(auto_tests) | |||
17 | add_executable(${_testname} ${_testname}.cpp) | 17 | add_executable(${_testname} ${_testname}.cpp) |
18 | add_test(${_testname} ${_testname}) | 18 | add_test(${_testname} ${_testname}) |
19 | add_memcheck_test(${_testname} ${_testname}) | 19 | add_memcheck_test(${_testname} ${_testname}) |
20 | qt5_use_modules(${_testname} Core Test Concurrent) | 20 | target_link_libraries(${_testname} |
21 | target_link_libraries(${_testname} sink libhawd sink_test) | 21 | sink libhawd |
22 | sink_test | ||
23 | Qt5::Core | ||
24 | Qt5::Concurrent | ||
25 | Qt5::Test | ||
26 | ) | ||
22 | endforeach(_testname) | 27 | endforeach(_testname) |
23 | endmacro(auto_tests) | 28 | endmacro(auto_tests) |
24 | 29 | ||
@@ -26,7 +31,13 @@ macro(manual_tests) | |||
26 | foreach(_testname ${ARGN}) | 31 | foreach(_testname ${ARGN}) |
27 | add_executable(${_testname} ${_testname}.cpp) | 32 | add_executable(${_testname} ${_testname}.cpp) |
28 | add_memcheck_test(${_testname} ${_testname}) | 33 | add_memcheck_test(${_testname} ${_testname}) |
29 | qt5_use_modules(${_testname} Core Test Concurrent) | 34 | target_link_libraries(${_testname} |
30 | target_link_libraries(${_testname} sink libhawd sink_test) | 35 | sink |
36 | libhawd | ||
37 | sink_test | ||
38 | Qt5::Core | ||
39 | Qt5::Concurrent | ||
40 | Qt5::Test | ||
41 | ) | ||
31 | endforeach(_testname) | 42 | endforeach(_testname) |
32 | endmacro(manual_tests) | 43 | endmacro(manual_tests) |
diff --git a/tests/hawd/CMakeLists.txt b/tests/hawd/CMakeLists.txt index 6ae5f13..7546920 100644 --- a/tests/hawd/CMakeLists.txt +++ b/tests/hawd/CMakeLists.txt | |||
@@ -27,8 +27,7 @@ set(SRCS | |||
27 | 27 | ||
28 | add_library(lib${PROJECT_NAME} SHARED ${lib_SRCS}) | 28 | add_library(lib${PROJECT_NAME} SHARED ${lib_SRCS}) |
29 | generate_export_header(lib${PROJECT_NAME} BASE_NAME HAWD EXPORT_FILE_NAME hawd_export.h) | 29 | generate_export_header(lib${PROJECT_NAME} BASE_NAME HAWD EXPORT_FILE_NAME hawd_export.h) |
30 | qt5_use_modules(lib${PROJECT_NAME} Core) | 30 | target_link_libraries(lib${PROJECT_NAME} sink Qt5::Core) |
31 | target_link_libraries(lib${PROJECT_NAME} sink) | ||
32 | if (LIBGIT2_FOUND) | 31 | if (LIBGIT2_FOUND) |
33 | target_link_libraries(lib${PROJECT_NAME} ${LIBGIT2_LIBRARIES}) | 32 | target_link_libraries(lib${PROJECT_NAME} ${LIBGIT2_LIBRARIES}) |
34 | endif(LIBGIT2_FOUND) | 33 | endif(LIBGIT2_FOUND) |
@@ -36,8 +35,7 @@ endif(LIBGIT2_FOUND) | |||
36 | install(TARGETS lib${PROJECT_NAME} ${KDE_INSTALL_TARGETS_DEFAULT_ARGS}) | 35 | install(TARGETS lib${PROJECT_NAME} ${KDE_INSTALL_TARGETS_DEFAULT_ARGS}) |
37 | 36 | ||
38 | add_executable(${PROJECT_NAME} ${SRCS}) | 37 | add_executable(${PROJECT_NAME} ${SRCS}) |
39 | qt5_use_modules(${PROJECT_NAME} Core) | 38 | target_link_libraries(${PROJECT_NAME} lib${PROJECT_NAME} Qt5::Core) |
40 | target_link_libraries(${PROJECT_NAME} lib${PROJECT_NAME}) | ||
41 | if (LIBGIT2_FOUND) | 39 | if (LIBGIT2_FOUND) |
42 | target_link_libraries(${PROJECT_NAME} ${LIBGIT2_LIBRARIES}) | 40 | target_link_libraries(${PROJECT_NAME} ${LIBGIT2_LIBRARIES}) |
43 | endif(LIBGIT2_FOUND) | 41 | endif(LIBGIT2_FOUND) |