[Insight-developers] strange error with export list on modular ITK

Brad King brad.king at kitware.com
Mon Dec 19 09:56:19 EST 2011


On 12/19/2011 6:12 AM, Alexandre GOUAILLARD wrote:
> I m working on the latest integration of DCMTK in ITK as a module, and
> I have some unseen before error:
> CMake Error: INSTALL(EXPORT "ITKTargets" ...) includes target
> "ITKIODCMTK" which requires target "oflog" that is not in the export
> set.
>
> anybody has an idea of what i need to do to make it vanish?
> I tried itk_module_target() with no success so far.
>
> the code is here (DCMTK branch):
> https://github.com/ComplexSystemsModeling/DCMTK-ITK/tree/DCMTK

You need to tell dcmtk how to pass the "EXPORT ..." option to its
install(TARGETS) calls.  Here is the change to your ITK branch:

diff --git a/Modules/ThirdParty/DCMTK/src/CMakeLists.txt b/Modules/ThirdParty/DCMTK/src/CMakeLists.txt
index 661a673..5987236 100644
--- a/Modules/ThirdParty/DCMTK/src/CMakeLists.txt
+++ b/Modules/ThirdParty/DCMTK/src/CMakeLists.txt
@@ -1,5 +1,6 @@
  set(EXECUTABLE_OUTPUT_PATH ${CMAKE_RUNTIME_OUTPUT_DIRECTORY})
  set(LIBRARY_OUTPUT_PATH ${CMAKE_LIBRARY_OUTPUT_DIRECTORY})
+set(DCMTK_INSTALL_EXPORT_NAME ${ITKDCMTK-targets})
  set(DCMTK_BUILD_APPS OFF)
  add_subdirectory(dcmtk)
  @@ -21,5 +22,5 @@ foreach(lib
    oflog
    ofstd
    )
-  itk_module_target(${lib}) # NO_INSTALL)
+  itk_module_target(${lib} NO_INSTALL)
  endforeach()


and here is the change needed in dcmtk:


diff --git a/CMake/KitCommonBlock.cmake b/CMake/KitCommonBlock.cmake
index 72a500b..9a9d49a 100644
--- a/CMake/KitCommonBlock.cmake
+++ b/CMake/KitCommonBlock.cmake
@@ -5,6 +5,7 @@ TARGET_LINK_LIBRARIES(${KIT} ${KIT_LIBS} ${KIT_EXTRA_LIBS})
   INSTALL(TARGETS ${KIT}
    DESTINATION ${DCMTK_INSTALL_LIB_DIR} COMPONENT Development
+  EXPORT ${DCMTK_INSTALL_EXPORT_NAME}
    )
   # End of common section
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 87326d8..914352e 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -14,6 +14,10 @@ SET(DCMTK_INSTALL_INCLUDE_DIR "include")
  SET(DCMTK_INSTALL_LIB_DIR "lib")
  SET(DCMTK_INSTALL_BIN_DIR "bin")
+IF(NOT DCMTK_INSTALL_EXPORT_NAME)
+  SET(DCMTK_INSTALL_EXPORT_NAME DCMTK-Targets)
+ENDIF()
+
  #-----------------------------------------------------------------------------
  # Output directories.
  IF(NOT LIBRARY_OUTPUT_PATH)

You should probably do something similar with the DCMTK_INSTALL_*_DIR
variables.  You can see examples of it in some of the other ThirdParty
modules.

-Brad


More information about the Insight-developers mailing list