Can DCMTK be built relocatable on Windows with ICU and OpenSSL?

Compilation and installation of DCMTK

Moderator: Moderator Team

Post Reply
Message
Author
jogerh
Posts: 37
Joined: Mon, 2022-02-28, 08:55

Can DCMTK be built relocatable on Windows with ICU and OpenSSL?

#1 Post by jogerh » Fri, 2022-09-02, 20:53

I am building DCMTK (static libs) with ICU and OpenSSL on Windows with Visual Studio. To reduce build times of client software on CI/CD and developer computers, I would like to create a Nuget package (archive) that is downloaded from an artifact server. This reduces build times significantly compared to building DCMTK every time.

My problem is that after building DCMTK with CMake, the generated DCMTKTargets.cmake file contains absolute paths to the ICU and OpenSSL libraries like illustrated below

Code: Select all

set_target_properties(DCMTK::ofstd PROPERTIES
  INTERFACE_INCLUDE_DIRECTORIES "${_IMPORT_PREFIX}/include"
  INTERFACE_LINK_LIBRARIES "DCMTK::config;\$<\$<NOT:\$<CONFIG:DEBUG>>:C:/dev/dcmtk-next-nuget/support_libraries/icu4c/lib/icuuc.lib>;\$<\$<CONFIG:DEBUG>:C:/dev/dcmtk-next-nuget/support_libraries/icu4c/lib/icuucd.lib>;C:/dev/dcmtk-next-nuget/support_libraries/icu4c/lib/icudt.lib;iphlpapi;ws2_32;netapi32;wsock32"
This means that the output from CMake install is not relocatable. Is this a DCMTK limitation on Windows, or are there ways to avoid absolute paths like above?

Thanks,
Jøger Hansegård

Marco Eichelberg
OFFIS DICOM Team
OFFIS DICOM Team
Posts: 1360
Joined: Tue, 2004-11-02, 17:22
Location: Oldenburg, Germany
Contact:

Re: Can DCMTK be built relocatable on Windows with ICU and OpenSSL?

#2 Post by Marco Eichelberg » Tue, 2022-09-06, 17:28

On Windows, DCMTK uses a different mechanism (defined in CMake/3rdparty.cmake) to locate the external support libraries such as OpenSSL.
This makes use of the CMake find_path() command, which apparently always returns an absolute path. It should not be overly difficult to add some code in that file that converts such paths into a relative path. Unfortunately, CMake does not seem to have this functionality built-in.

Post Reply

Who is online

Users browsing this forum: Bing [Bot] and 1 guest