diff --git a/Core/Code/Testing/DCMTesting/CMakeLists.txt b/Core/Code/Testing/DCMTesting/CMakeLists.txt index 5671220e3f..2261561fa8 100644 --- a/Core/Code/Testing/DCMTesting/CMakeLists.txt +++ b/Core/Code/Testing/DCMTesting/CMakeLists.txt @@ -1,59 +1,54 @@ # # IMPORTANT NOTE: # # This module is a testing module for the DicomSeriesReader class, # which is meant to be replaced by the Module DCMReader. # To have the "old" code tested before it is removed, we still # keep this DCMTesting module. # # Note that the DCMTesting module is practically a copy of # this DCMTesting module, doing the same kind of testing, just # for the new readers instead of DicomSeriesReader. # if(BUILD_TESTING) if(GDCM_DIR) # clear variables from prior files.cmake # Else CMake would use the content of these variables and would try to create tests (which are not present in DCMTesting). set(MODULE_TESTS) set(MODULE_IMAGE_TESTS) set(MODULE_SURFACE_TESTS) set(MODULE_TESTIMAGES) set(MODULE_TESTSURFACES) set(MODULE_CUSTOM_TESTS) set(H_FILES) set(CPP_FILES) # now create a new module only for testing purposes MITK_CREATE_MODULE( mitkDCMTesting DEPENDS Mitk # Mitk.so ) -MITK_CHECK_MODULE(_RESULT mitkDCMTesting) -if(_RESULT) - message(STATUS "mitkDCMTesting application won't be built. Missing: ${_RESULT}") -else(_RESULT) +mitk_check_module_dependencies(MODULES mitkDCMTesting MISSING_DEPENDENCIES_VAR _missing_deps) -# add helpful applications -include_directories(${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_BINARY_DIR}) +if(_missing_deps) + message(STATUS "mitkDCMTesting application won't be built. Missing: ${_missing_deps}") +else(_missing_deps) -# remove with newer MITK version -MITK_USE_MODULE( mitkDCMTesting ) -include_directories(${ALL_INCLUDE_DIRECTORIES}) + # add helpful applications + include_directories(${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_BINARY_DIR}) -# dumps out image information -add_executable(DumpDCMMitkImage DumpDCMMitkImage.cpp) -#Newer code: mitk_use_modules(TARGET DumpDCMMitkImage MODULES mitkDCMTesting) -target_link_libraries(DumpDCMMitkImage ${ALL_LIBRARIES}) + # dumps out image information + add_executable(DumpDCMMitkImage DumpDCMMitkImage.cpp) + mitk_use_modules(TARGET DumpDCMMitkImage MODULES mitkDCMTesting) -# compares dumped out image information against reference dump -add_executable(VerifyDCMMitkImageDump VerifyDCMMitkImageDump.cpp) -#Newer code: mitk_use_modules(TARGET VerifyDCMMitkImageDump MODULES mitkDCMTesting) -target_link_libraries(VerifyDCMMitkImageDump ${ALL_LIBRARIES}) + # compares dumped out image information against reference dump + add_executable(VerifyDCMMitkImageDump VerifyDCMMitkImageDump.cpp) + mitk_use_modules(TARGET VerifyDCMMitkImageDump MODULES mitkDCMTesting) -add_subdirectory(Testing) + add_subdirectory(Testing) endif() endif() endif() diff --git a/Examples/Plugins/org.mitk.example.gui.opencv/CMakeLists.txt b/Examples/Plugins/org.mitk.example.gui.opencv/CMakeLists.txt index 70f0111369..f1837dc581 100644 --- a/Examples/Plugins/org.mitk.example.gui.opencv/CMakeLists.txt +++ b/Examples/Plugins/org.mitk.example.gui.opencv/CMakeLists.txt @@ -1,9 +1,15 @@ # The project name must correspond to the directory name of your plug-in # and must not contain periods. project(org_mitk_example_gui_opencv) -MACRO_CREATE_MITK_CTK_PLUGIN( - EXPORT_DIRECTIVE EXAMPLESOPENCV_EXPORTS - EXPORTED_INCLUDE_SUFFIXES src - MODULE_DEPENDS mitkOpenCVVideoSupportUI -) +mitk_check_module_dependencies(MODULES mitkOpenCVVideoSupportUI MISSING_DEPENDENCIES_VAR _missing_deps) + +if (_missing_deps) + message(STATUS "org.mitk.example.gui.opencv plugin won't be built. Missing: ${_missing_deps}") +else(_missing_deps) + MACRO_CREATE_MITK_CTK_PLUGIN( + EXPORT_DIRECTIVE EXAMPLESOPENCV_EXPORTS + EXPORTED_INCLUDE_SUFFIXES src + MODULE_DEPENDS mitkOpenCVVideoSupportUI + ) +endif(_missing_deps) diff --git a/Examples/mitkdump/CMakeLists.txt b/Examples/mitkdump/CMakeLists.txt index d19d6d14fa..3fb634d68a 100644 --- a/Examples/mitkdump/CMakeLists.txt +++ b/Examples/mitkdump/CMakeLists.txt @@ -1,29 +1,29 @@ project(mitkdump) find_package(MITK) -# Check prerequisites for this application. -# We need the Mitk module. -MITK_CHECK_MODULE(result Qmitk) -if(result) - message(SEND_ERROR "MITK module(s) \"${result}\" not available from the MITK build at ${MITK_DIR}") -endif() +mitk_check_module_dependencies(MODULES Qmitk DICOMReader MISSING_DEPENDENCIES_VAR _missing_deps) +if(_missing_deps) + message(STATUS "mitkdump application won't be built. Missing: ${_missing_deps}") +else(_missing_deps) -# Set-up the build system to use the Mitk module -MITK_USE_MODULE(Qmitk DICOMReader) -include_directories(${ALL_INCLUDE_DIRECTORIES}) -link_directories(${ALL_LIBRARY_DIRS}) + # couldn't find a differnt solution + # adding "PACKAGES GDCM" to mitk_use_modules will not fix the problem + # ld seems not to get GDCM_LIBRARY_DIRS into its search path + # a (too?) simple addition to mitkFunctionUseModules does also not work + find_package(GDCM PATHS ${GDCM_DIR} REQUIRED) + link_directories(${GDCM_LIBRARY_DIRS}) -add_executable(mitkdump mitkdump.cpp) -target_link_libraries(mitkdump ${ALL_LIBRARIES} ) + add_executable(mitkdump mitkdump.cpp) + mitk_use_modules(TARGET mitkdump MODULES DICOMReader Qmitk) + set_property(TARGET mitkdump PROPERTY LABELS ${MITK_DEFAULT_SUBPROJECTS}) -add_executable(mitkdumpdir mitkdumpdir.cpp) -target_link_libraries(mitkdumpdir ${ALL_LIBRARIES} ) + add_executable(mitkdumpdir mitkdumpdir.cpp) + mitk_use_modules(TARGET mitkdumpdir MODULES DICOMReader Qmitk) + set_property(TARGET mitkdumpdir PROPERTY LABELS ${MITK_DEFAULT_SUBPROJECTS}) -# subproject support -set_property(TARGET mitkdump PROPERTY LABELS ${MITK_DEFAULT_SUBPROJECTS}) -set_property(TARGET mitkdumpdir PROPERTY LABELS ${MITK_DEFAULT_SUBPROJECTS}) -foreach(subproject ${MITK_DEFAULT_SUBPROJECTS}) - add_dependencies(${subproject} mitkdump) - add_dependencies(${subproject} mitkdumpdir) -endforeach() + foreach(subproject ${MITK_DEFAULT_SUBPROJECTS}) + add_dependencies(${subproject} mitkdump) + add_dependencies(${subproject} mitkdumpdir) + endforeach() +endif() diff --git a/Modules/DICOMTesting/CMakeLists.txt b/Modules/DICOMTesting/CMakeLists.txt index 0aa3f58988..7d41aa6462 100644 --- a/Modules/DICOMTesting/CMakeLists.txt +++ b/Modules/DICOMTesting/CMakeLists.txt @@ -1,41 +1,38 @@ if(BUILD_TESTING) if(GDCM_DIR) # clear variables from prior files.cmake # Else CMake would use the content of these variables and would try to create tests (which are not present in DICOMTesting). set(MODULE_TESTS) set(MODULE_IMAGE_TESTS) set(MODULE_SURFACE_TESTS) set(MODULE_TESTIMAGES) set(MODULE_TESTSURFACES) set(MODULE_CUSTOM_TESTS) set(H_FILES) set(CPP_FILES) # now create a new module only for testing purposes MITK_CREATE_MODULE( DICOMTesting DEPENDS DICOMReader ) -MITK_CHECK_MODULE(_RESULT DICOMTesting) -if(_RESULT) - message(STATUS "DICOMTesting application won't be built. Missing: ${_RESULT}") -else(_RESULT) +mitk_check_module_dependencies(MODULES DICOMTesting MISSING_DEPENDENCIES_VAR _missing_deps) -# add helpful applications -MITK_USE_MODULE( DICOMTesting ) -include_directories(${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_BINARY_DIR} ${ALL_INCLUDE_DIRECTORIES}) +if(_missing_deps) + message(STATUS "mitkDICOMTesting module helper applications won't be built. Missing: ${_missing_deps}") +else(_missing_deps) -# dumps out image information -add_executable(DumpDICOMMitkImage DumpDICOMMitkImage.cpp) -mitk_use_modules(TARGET DumpDICOMMitkImage MODULES mitkDICOMTesting) + # dumps out image information + add_executable(DumpDICOMMitkImage DumpDICOMMitkImage.cpp) + mitk_use_modules(TARGET DumpDICOMMitkImage MODULES DICOMTesting) -# compares dumped out image information against reference dump -add_executable(VerifyDICOMMitkImageDump VerifyDICOMMitkImageDump.cpp) -mitk_use_modules(TARGET VerifyDICOMMitkImageDump MODULES mitkDICOMTesting) + # compares dumped out image information against reference dump + add_executable(VerifyDICOMMitkImageDump VerifyDICOMMitkImageDump.cpp) + mitk_use_modules(TARGET VerifyDICOMMitkImageDump MODULES DICOMTesting) -add_subdirectory(Testing) + add_subdirectory(Testing) endif() endif() endif()