Browse Source

Associate CTKDICOMCore with DCMTK_DEFINITIONS in build and install tree

Following commits a32f5242 and e984215, DCMTK_DEFINITIONS was associated
with the exported CTKDICOMCore target (install tree). At that time, it
was NOT required to associate  DCMTK_DEFINITIONS with CTKDICOMCore in the
build tree because FindDCMTK.cmake was calling "add_definitions(-D${DCMTK_DEFINITIONS})".

Then, as explained in commit b6b9bc220, the call to "add_definitions" has
been removed to prevent compile side effect in project building against CTK
and using the FindDCMTK.cmake provided by CTK.

This commit account for that change by explicitly associating the
DCMTK_DEFINITIONS with CTKDICOMCore target.

It also avoid redundant code used to set INTERFACE_COMPILE_DEFINITIONS by
moving the code from CTKGenerateCTKConfig to DICOM/Core/CMakeLists.txt

See #413
Jean-Christophe Fillion-Robin 11 years ago
parent
commit
00fa671a48
2 changed files with 9 additions and 12 deletions
  1. 0 12
      CMake/LastConfigureStep/CTKGenerateCTKConfig.cmake
  2. 9 0
      Libs/DICOM/Core/CMakeLists.txt

+ 0 - 12
CMake/LastConfigureStep/CTKGenerateCTKConfig.cmake

@@ -162,12 +162,6 @@ set(CTK_CONFIG_CODE "${CTK_CONFIG_CODE}# External project libraries\n")
 set(CTK_CONFIG_CODE "${CTK_CONFIG_CODE}set(CTK_EXTERNAL_LIBRARIES \"${CTK_EXTERNAL_LIBRARIES}\")\n")
 set(CTK_CONFIG_CODE "${CTK_CONFIG_CODE}# External project library directories\n")
 set(CTK_CONFIG_CODE "${CTK_CONFIG_CODE}set(CTK_EXTERNAL_LIBRARY_DIRS \"${CTK_EXTERNAL_LIBRARY_DIRS}\")\n")
-if(DEFINED DCMTK_HAVE_CONFIG_H_OPTIONAL AND NOT DCMTK_HAVE_CONFIG_H_OPTIONAL AND TARGET CTKDICOMCore)
-  set(CTK_CONFIG_CODE "${CTK_CONFIG_CODE}# Definition required to build DCMTK dependent libraries\n")
-  set(CTK_CONFIG_CODE "${CTK_CONFIG_CODE}if(\"\${CMAKE_VERSION}\" VERSION_GREATER 2.8.10)\n")
-  set(CTK_CONFIG_CODE "${CTK_CONFIG_CODE}  set_target_properties(CTKDICOMCore PROPERTIES INTERFACE_COMPILE_DEFINITIONS ${DCMTK_DEFINITIONS})\n")
-  set(CTK_CONFIG_CODE "${CTK_CONFIG_CODE}endif()\n")
-endif()
 set(CTK_CONFIG_CODE "${CTK_CONFIG_CODE}##################################################")
 
 set(ctk_config ${CTK_SUPERBUILD_BINARY_DIR}/CTKConfig.cmake)
@@ -206,12 +200,6 @@ set(CTK_CONFIG_CODE "${CTK_CONFIG_CODE}# CTK library directories that could be u
 foreach(lib ${CTK_LIBRARIES})
   set(CTK_CONFIG_CODE "${CTK_CONFIG_CODE}set(${lib}_LIBRARY_DIRS \"\")\n")
 endforeach()
-if(DEFINED DCMTK_HAVE_CONFIG_H_OPTIONAL AND NOT DCMTK_HAVE_CONFIG_H_OPTIONAL AND TARGET CTKDICOMCore)
-  set(CTK_CONFIG_CODE "${CTK_CONFIG_CODE}# Definition required to build DCMTK dependent libraries\n")
-  set(CTK_CONFIG_CODE "${CTK_CONFIG_CODE}if(\"\${CMAKE_VERSION}\" VERSION_GREATER 2.8.10)\n")
-  set(CTK_CONFIG_CODE "${CTK_CONFIG_CODE}  set_target_properties(CTKDICOMCore PROPERTIES INTERFACE_COMPILE_DEFINITIONS ${DCMTK_DEFINITIONS})\n")
-  set(CTK_CONFIG_CODE "${CTK_CONFIG_CODE}endif()\n")
-endif()
 
 set(CTK_CONFIG_CODE "${CTK_CONFIG_CODE}##################################################")
 

+ 9 - 0
Libs/DICOM/Core/CMakeLists.txt

@@ -123,6 +123,15 @@ ctkMacroBuildLib(
   LIBRARY_TYPE ${CTK_LIBRARY_MODE}
   )
 
+if(DEFINED DCMTK_HAVE_CONFIG_H_OPTIONAL AND NOT DCMTK_HAVE_CONFIG_H_OPTIONAL)
+  # Workaround Debian packaging issue - See FindDCMTK.cmake for more details
+  set_target_properties(${PROJECT_NAME} PROPERTIES COMPILE_DEFINITIONS ${DCMTK_DEFINITIONS})
+  if("${CMAKE_VERSION}" VERSION_GREATER 2.8.10)
+    set_target_properties(${PROJECT_NAME} PROPERTIES INTERFACE_COMPILE_DEFINITIONS ${DCMTK_DEFINITIONS})
+  endif()
+endif()
+
+
 if(CTK_WRAP_PYTHONQT_FULL OR CTK_WRAP_PYTHONQT_LIGHT)
   ctkMacroBuildLibWrapper(
     TARGET ${PROJECT_NAME}