[Insight-developers] ITK, ITK_USE_SYSTEM_DCMTK, and CMake
Brad King
brad.king at kitware.com
Wed Feb 20 09:51:51 EST 2013
On 02/19/2013 05:41 PM, Williams, Norman K wrote:
> 1. Enhance the DCMTK Cmake build system to generate propler
> DCMTKConfig.cmake & other files such that
> find_package(DCMTK NO_MODULE) works properly.
Great! FYI:
+export(TARGETS ${EXPORT_LIBS}
+ FILE ${PROJECT_BINARY_DIR}/DCMTKLibraryDepends.cmake)
...
+install(EXPORT DCMTKLibraryDepends DESTINATION
+ "${INSTALL_CMAKE_DIR}" COMPONENT dev)
The files these generate have much more than just library dependencies.
The <pkg>LibraryDepends naming convention came from the old
export_library_dependencies command. For the modern export features
the naming convention is "<pkg>Targets".
> 2. Get ITK to use find_package(DCMTK NO_MODULE), primarily so that all the
> libraries DCMTK depends on are linked in to programs/libraries that use
> ITK.
>
> #2 seems to not work, in odd ways: when a program (in my case DWIConvert
> in the BRAINSStandAlone project) links to ITK libraries and uses DCMTK,
> all the DCMTK libraries are added to the link command, but not ZLIB,
> though DCMTK seems to properly report the DCMTK ZLIB dependency.
I built your topic and the target export file does have settings for
IMPORTED_LINK_INTERFACE_LIBRARIES_<CONFIG>
that include the system zlib library on dcmdata. However, you need
to make sure that when the ITK targets file is loaded that it also
sees the DCMTK targets file. This is in place of the code we added
in http://itk.org/gitweb?p=ITK.git;a=commitdiff;h=e081d837#patch24
through ITKDCMTK_EXPORT_CODE_BUILD and ITKDCMTK_EXPORT_CODE_INSTALL
to provide the imported targets to consumers of ITK.
There is actually ongoing development in upstream CMake to generate
an error in this case: when an ITK library advertises dcmdata in its
link interface CMake will produce an error when an application tries
to use that ITK library but dcmdata is not available as an imported
target.
-Brad
More information about the Insight-developers
mailing list