diff --git a/CMakeModules/CalamaresAddTest.cmake b/CMakeModules/CalamaresAddTest.cmake index f1f6fdf3f..36be0f03e 100644 --- a/CMakeModules/CalamaresAddTest.cmake +++ b/CMakeModules/CalamaresAddTest.cmake @@ -34,7 +34,7 @@ function( calamares_add_test ) # parse arguments (name needs to be saved before passing ARGN into the macro) set( NAME ${ARGV0} ) set( options GUI ) - set( multiValueArgs SOURCES LIBRARIES ) + set( multiValueArgs SOURCES LIBRARIES DEFINITIONS ) cmake_parse_arguments( TEST "${options}" "" "${multiValueArgs}" ${ARGN} ) set( TEST_NAME ${NAME} ) @@ -50,7 +50,7 @@ function( calamares_add_test ) Qt5::Test ) calamares_automoc( ${TEST_NAME} ) - target_compile_definitions( ${TEST_NAME} PRIVATE -DBUILD_AS_TEST ) + target_compile_definitions( ${TEST_NAME} PRIVATE -DBUILD_AS_TEST ${TEST_DEFINITIONS} ) if( TEST_GUI ) target_link_libraries( ${TEST_NAME} calamaresui Qt5::Gui ) endif() diff --git a/src/modules/fsresizer/CMakeLists.txt b/src/modules/fsresizer/CMakeLists.txt index 680f92436..1f4260518 100644 --- a/src/modules/fsresizer/CMakeLists.txt +++ b/src/modules/fsresizer/CMakeLists.txt @@ -35,10 +35,8 @@ if ( KPMcore_FOUND AND Qt5DBus_FOUND AND KF5CoreAddons_FOUND AND KF5Config_FOUND LIBRARIES calamares_job_fsresizer # From above yamlcpp + DEFINITIONS ${_partition_defs} ) - if( TARGET fsresizertest ) - target_compile_definitions( fsresizertest PRIVATE ${_partition_defs} ) - endif() else() if ( NOT KPMcore_FOUND ) calamares_skip_module( "fsresizer (missing suitable KPMcore)" ) diff --git a/src/modules/partition/tests/CMakeLists.txt b/src/modules/partition/tests/CMakeLists.txt index 7b9a2d5a6..a64d7620e 100644 --- a/src/modules/partition/tests/CMakeLists.txt +++ b/src/modules/partition/tests/CMakeLists.txt @@ -26,10 +26,8 @@ calamares_add_test( SOURCES ${partitionjobtests_SRCS} LIBRARIES kpmcore + DEFINITIONS ${_partition_defs} ) -if( TARGET partitionjobtests ) - target_compile_definitions( partitionjobtests PRIVATE ${_partition_defs} ) -endif() calamares_add_test( clearmountsjobtests @@ -38,8 +36,6 @@ calamares_add_test( ClearMountsJobTests.cpp LIBRARIES kpmcore + DEFINITIONS ${_partition_defs} ) -if( TARGET clearmountsjobtests ) - target_compile_definitions( clearmountsjobtests PRIVATE ${_partition_defs} ) -endif()