diff --git a/CMake/mitkFunctionAddCustomModuleTest.cmake b/CMake/mitkFunctionAddCustomModuleTest.cmake index 1d7bd363cf..f104665d91 100644 --- a/CMake/mitkFunctionAddCustomModuleTest.cmake +++ b/CMake/mitkFunctionAddCustomModuleTest.cmake @@ -1,12 +1,16 @@ #! #! \brief Add a custom test for MITK module #! #! \param test_name Unique identifier for the test #! \param test_function Name of the test function (the one with the argc,argv signature) #! #! Additional parameters will be passed as command line parameters to the test. #! function(mitkAddCustomModuleTest test_name test_function) - add_test(${test_name} ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/${TESTDRIVER} ${test_function} ${ARGN}) - set_property(TEST ${test_name} PROPERTY LABELS ${MODULE_SUBPROJECTS} MITK) + + if (BUILD_TESTING AND ${MODULE_NAME}_IS_ENABLED OR MODULE_NAME STREQUAL "Mitk") + add_test(${test_name} ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/${TESTDRIVER} ${test_function} ${ARGN}) + set_property(TEST ${test_name} PROPERTY LABELS ${MODULE_SUBPROJECTS} MITK) + endif() + endfunction() diff --git a/Modules/IpPicSupport/Testing/CMakeLists.txt b/Modules/IpPicSupport/Testing/CMakeLists.txt index a5d9823916..46d2f08276 100644 --- a/Modules/IpPicSupport/Testing/CMakeLists.txt +++ b/Modules/IpPicSupport/Testing/CMakeLists.txt @@ -1,7 +1,5 @@ MITK_CREATE_MODULE_TESTS(LABELS MITK-Modules) mitkAddCustomModuleTest(mitkPicFileReaderTest_emptyFile mitkPicFileReaderTest ${CMAKE_CURRENT_SOURCE_DIR}/Data/emptyFile.pic) mitkAddCustomModuleTest(mitkPicFileReaderTest_emptyGzipFile mitkPicFileReaderTest ${CMAKE_CURRENT_SOURCE_DIR}/Data/emptyFile.pic.gz) -add_test(mitkPicFileReaderTest_emptyGzipFile ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/${TESTDRIVER} mitkPicFileReaderTest ${CMAKE_CURRENT_SOURCE_DIR}/Data/emptyFile.pic.gz) -set_property(TEST mitkPicFileReaderTest_emptyGzipFile PROPERTY LABELS MITK-Modules)