CMake: clean up test setup

- Remove redundant searches for ECM and Qt::Test, move
   them to top-level.
main
Adriaan de Groot 6 years ago
parent a33b0c4f24
commit 7515386cf8

@ -237,6 +237,11 @@ set_package_properties(
find_package(ECM ${ECM_VERSION} NO_MODULE) find_package(ECM ${ECM_VERSION} NO_MODULE)
if( ECM_FOUND ) if( ECM_FOUND )
set(CMAKE_MODULE_PATH ${ECM_MODULE_PATH} ${CMAKE_MODULE_PATH}) set(CMAKE_MODULE_PATH ${ECM_MODULE_PATH} ${CMAKE_MODULE_PATH})
if ( BUILD_TESTING )
# ECM implies that we can build the tests, too
find_package( Qt5 COMPONENTS Test REQUIRED )
include( ECMAddTests )
endif()
endif() endif()
find_package( KF5 COMPONENTS CoreAddons Crash ) find_package( KF5 COMPONENTS CoreAddons Crash )

@ -8,10 +8,7 @@ calamares_add_plugin( contextualprocess
SHARED_LIB SHARED_LIB
) )
if( ECM_FOUND ) if( ECM_FOUND AND BUILD_TESTING )
find_package( Qt5 COMPONENTS Test REQUIRED )
include( ECMAddTests )
ecm_add_test( ecm_add_test(
Tests.cpp Tests.cpp
ContextualProcessJob.cpp # Builds it a second time ContextualProcessJob.cpp # Builds it a second time

@ -20,10 +20,7 @@ if ( KPMcore_FOUND )
SHARED_LIB SHARED_LIB
) )
if( ECM_FOUND ) if( ECM_FOUND AND BUILD_TESTING )
find_package( Qt5 COMPONENTS Test REQUIRED )
include( ECMAddTests )
ecm_add_test( ecm_add_test(
Tests.cpp Tests.cpp
TEST_NAME TEST_NAME

@ -1,9 +1,3 @@
find_package(ECM ${ECM_VERSION} NO_MODULE)
if( ECM_FOUND AND BUILD_TESTING )
include( ECMAddTests )
find_package( Qt5 COMPONENTS Core Test REQUIRED )
endif()
# When debugging the timezone widget, add this debugging definition # When debugging the timezone widget, add this debugging definition
# to have a debugging-friendly timezone widget, debug logging, # to have a debugging-friendly timezone widget, debug logging,
# and no intrusive timezone-setting while clicking around. # and no intrusive timezone-setting while clicking around.

@ -1,6 +1,4 @@
find_package( Qt5 COMPONENTS Gui Test REQUIRED ) find_package( Qt5 COMPONENTS Gui REQUIRED )
include( ECMAddTests )
set( PartitionModule_SOURCE_DIR .. ) set( PartitionModule_SOURCE_DIR .. )
@ -23,13 +21,15 @@ include_directories(
${CMAKE_CURRENT_BINARY_DIR} ${CMAKE_CURRENT_BINARY_DIR}
) )
ecm_add_test( ${partitionjobtests_SRCS} if( ECM_FOUND AND BUILD_TESTING )
TEST_NAME partitionjobtests ecm_add_test( ${partitionjobtests_SRCS}
LINK_LIBRARIES TEST_NAME partitionjobtests
${CALAMARES_LIBRARIES} LINK_LIBRARIES
kpmcore ${CALAMARES_LIBRARIES}
Qt5::Core kpmcore
Qt5::Test Qt5::Core
) Qt5::Test
)
set_target_properties( partitionjobtests PROPERTIES AUTOMOC TRUE ) set_target_properties( partitionjobtests PROPERTIES AUTOMOC TRUE )
endif()

@ -8,10 +8,7 @@ calamares_add_plugin( shellprocess
SHARED_LIB SHARED_LIB
) )
if( ECM_FOUND ) if( ECM_FOUND AND BUILD_TESTING )
find_package( Qt5 COMPONENTS Test REQUIRED )
include( ECMAddTests )
ecm_add_test( ecm_add_test(
Tests.cpp Tests.cpp
TEST_NAME TEST_NAME

@ -1,9 +1,4 @@
find_package(ECM ${ECM_VERSION} NO_MODULE) find_package( Qt5 COMPONENTS Core REQUIRED )
if( ECM_FOUND )
include( ECMAddTests )
endif()
find_package( Qt5 COMPONENTS Core Test REQUIRED )
find_package( Crypt REQUIRED ) find_package( Crypt REQUIRED )
# Add optional libraries here # Add optional libraries here
@ -44,7 +39,7 @@ calamares_add_plugin( users
SHARED_LIB SHARED_LIB
) )
if( ECM_FOUND ) if( ECM_FOUND AND BUILD_TESTING )
ecm_add_test( ecm_add_test(
PasswordTests.cpp PasswordTests.cpp
SetPasswordJob.cpp SetPasswordJob.cpp

Loading…
Cancel
Save