From ff972d181f0f9e7bfa327c71450d55f951de27c1 Mon Sep 17 00:00:00 2001 From: Andreas Sturmlechner Date: Sun, 3 Jan 2021 15:05:59 +0100 Subject: [PATCH] Put Qt5Test dependency behind -DQuotient_INSTALL_TESTS Signed-off-by: Andreas Sturmlechner --- CMakeLists.txt | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 2ee1cb4..2a0908d 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -58,7 +58,7 @@ else() endforeach () endif() -find_package(Qt5 5.9 REQUIRED Network Gui Multimedia Test) +find_package(Qt5 5.9 REQUIRED Network Gui Multimedia) get_filename_component(Qt5_Prefix "${Qt5_DIR}/../../../.." ABSOLUTE) if (${PROJECT_NAME}_ENABLE_E2EE) @@ -280,9 +280,12 @@ if (${PROJECT_NAME}_ENABLE_E2EE) endif() target_link_libraries(${PROJECT_NAME} Qt5::Core Qt5::Network Qt5::Gui Qt5::Multimedia) -set(TEST_BINARY quotest) -add_executable(${TEST_BINARY} ${tests_SRCS}) -target_link_libraries(${TEST_BINARY} Qt5::Core Qt5::Test ${PROJECT_NAME}) +if(${PROJECT_NAME}_INSTALL_TESTS) + find_package(Qt5Test) + set(TEST_BINARY quotest) + add_executable(${TEST_BINARY} ${tests_SRCS}) + target_link_libraries(${TEST_BINARY} Qt5::Core Qt5::Test ${PROJECT_NAME}) +endif() configure_file(${PROJECT_NAME}.pc.in ${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}.pc @ONLY NEWLINE_STYLE UNIX) -- 2.30.0