I try to build DCMTK-3.6.7 tag on https://github.com/DCMTK/dcmtk.git with openssl and icu support, with cmake cmake version 3.20.21032501-MSVC_2 for Visual Studio 2019.
-- Info: STL tuple support enabled
-- Info: STL system_error support enabled
CMake Error at dcmtk/dcmtls/libsrc/CMakeLists.txt:13 (set_property):
set_property could not find TARGET dcmtls. Perhaps it has not yet been
created.
CMake Error at dcmtk/dcmnet/libsrc/CMakeLists.txt:49 (set_property):
set_property could not find TARGET dcmnet. Perhaps it has not yet been
created.
-- Looking for CMake command CONFIGURE_PACKAGE_CONFIG_FILE
-- Looking for CMake command CONFIGURE_PACKAGE_CONFIG_FILE - found
a1615b246fe5837c82221052312b3eb17fb30f22 is the first bad commit
commit a1615b246fe5837c82221052312b3eb17fb30f22
Author: Jan Schlamelcher <dicom@offis.de>
Date: Thu Mar 25 17:52:23 2021 +0100
Introduced CMake variable DCMTK_TLS_LIBRARY_POSTFIX.
Introduced a new advanced CMake cache variable DCMTK_TLS_LIBRARY_POSTFIX that
allows adding a custom postfix to all file names of all libraries that change
their ABI when linking against OpenSSL.
Please note that this suffix is not enabled by default and must be set to an
appropriate string in addition to enabling DCMTK_WITH_OPENSSL if you plan to
mix TLS enabled with non TLS enabled DCMTK builds.
This closes DCMTK issue #879.
cmake_minimum_required(VERSION 3.8)
Project(dcmtk)
# Configure locations and naming of generated files
set(CMAKE_INSTALL_PREFIX "install" CACHE STRING "" FORCE)
set(CMAKE_INSTALL_BINDIR "bin" CACHE STRING "" FORCE)
set(CMAKE_DEBUG_POSTFIX "d" CACHE STRING "" FORCE)
# Build only debug and release
set(CMAKE_CONFIGURATION_TYPES "Release;Debug" CACHE STRING "" FORCE)
# Enable multi-core builds
add_compile_options(/MP)
# Enable debug symbols output
add_compile_options(/Zi)
# Enable PDB also in release
set(CMAKE_SHARED_LINKER_FLAGS_RELEASE "${CMAKE_SHARED_LINKER_FLAGS_RELEASE} /DEBUG")
set(CMAKE_EXE_LINKER_FLAGS_RELEASE "${CMAKE_EXE_LINKER_FLAGS_RELEASE} /DEBUG")
# Remove unreferenced functions & data (https://docs.microsoft.com/en-us/cpp/build/reference/opt-optimizations)
set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} /OPT:REF /INCREMENTAL:no")
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} /OPT:REF /INCREMENTAL:no")
# Workaround for compiling with openssl
add_definitions(-DHAVE_SSL_CTX_GET0_PARAM)
set(DCMTK_MODULES ofstd oflog dcmdata dcmimgle dcmjpeg dcmjpls dcmimage dcmtls dcmnet dcmsr dcmiod CACHE STRING "List of modules that should be built." FORCE)
set(ICU_ROOT "${CMAKE_SOURCE_DIR}/support_libraries/icu4c")
set(OPENSSL_USE_STATIC_LIBS TRUE)
set(OPENSSL_MSVC_STATIC_RT TRUE)
set(OPENSSL_ROOT_DIR "${CMAKE_SOURCE_DIR}/support_libraries/openssl")
set(WITH_OPENSSLINC "${CMAKE_SOURCE_DIR}/support_libraries/openssl")
option(BUILD_APPS "Build command line applications and test programs." OFF)
option(BUILD_SHARED_LIBS "Build with shared libraries." ON)
option(BUILD_SINGLE_SHARED_LIBRARY "Build a single DCMTK library." ON)
option(DCMTK_WITH_TIFF "Configure DCMTK with support for TIFF." OFF)
option(DCMTK_WITH_PNG "Configure DCMTK with support for PNG." OFF)
option(DCMTK_WITH_XML "Configure DCMTK with support for XML." OFF)
option(DCMTK_WITH_ZLIB "Configure DCMTK with support for ZLIB." OFF)
option(DCMTK_WITH_OPENSSL "Configure DCMTK with support for OPENSSL." ON)
option(DCMTK_WITH_SNDFILE "Configure DCMTK with support for SNDFILE." OFF)
option(DCMTK_WITH_ICONV "Configure DCMTK with support for ICONV." OFF)
option(DCMTK_WITH_ICU "Configure DCMTK with support for ICU." ON)
option(DCMTK_WITH_OPENJPEG "Configure DCMTK with support for OPENJPEG." OFF)
option(DCMTK_ENABLE_PRIVATE_TAGS "Configure DCMTK with support for DICOM private tags coming with DCMTK." OFF)
option(DCMTK_WITH_THREADS "Configure DCMTK with support for multi-threading." ON)
option(DCMTK_WITH_DOXYGEN "Build API documentation with DOXYGEN." OFF)
option(DCMTK_GENERATE_DOXYGEN_TAGFILE "Generate a tag file with DOXYGEN." OFF)
option(DCMTK_WIDE_CHAR_FILE_IO_FUNCTIONS "Build with wide char file I/O functions." ON)
option(DCMTK_WIDE_CHAR_MAIN_FUNCTION "Build command line tools with wide char main function." ON)
option(DCMTK_ENABLE_STL "Enable use of native STL classes and algorithms instead of DCMTK's own implementations." ON)
add_subdirectory(dcmtk-next)
we've checked with the team and we have this combination (compiler, OS and OpenSSL enabled) in our nightly builds and they compile and run fine. Did you start from a clean build tree?
Unfortunately, the alarm may not have been as false as I thought. Investigating further, it looks like BUILD_SINGLE_SHARED_LIBRARY is broken. I might be wrong again, but running the following command with a clean build tree and 'dcmtk' folder set to DCMTK-3.6.7 fails on my computer:
CMake Error at dcmtls/libsrc/CMakeLists.txt:13 (set_property):
set_property could not find TARGET dcmtls. Perhaps it has not yet been
created.
CMake Error at dcmnet/libsrc/CMakeLists.txt:49 (set_property):
set_property could not find TARGET dcmnet. Perhaps it has not yet been
created.
CMake Error at dcmsign/libsrc/CMakeLists.txt:26 (set_property):
set_property could not find TARGET dcmdsig. Perhaps it has not yet been
created.
CMake Error at dcmpstat/libsrc/CMakeLists.txt:51 (set_property):
set_property could not find TARGET dcmpstat. Perhaps it has not yet been
created.
I have today committed a fix for the BUILD_SINGLE_SHARED_LIBRARY build. If that successfully passes our nightly build, it should be visible on the public git server in a few days.
In the interim time, here's the patch: