Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use OpenSSL and ZLIB targets to link against #67

Open
wants to merge 5 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions CMake/3rdparty.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -79,11 +79,12 @@ if(DCMTK_USE_FIND_PACKAGE)
if(OPENSSL_VERSION_CHECK)
message(STATUS "Info: DCMTK OPENSSL support will be enabled")
set(WITH_OPENSSL 1)
include_directories(${OPENSSL_INCLUDE_DIR})
set(OPENSSL_LIBS ${OPENSSL_LIBRARIES} ${OPENSSL_EXTRA_LIBS_STATIC})
set(OPENSSL_MODULES OpenSSL::Crypto OpenSSL::SSL)
CHECK_LIBRARY_EXISTS(dl dlopen "" HAVE_LIBDL)
if(HAVE_LIBDL)
set(OPENSSL_LIBS ${OPENSSL_LIBS} dl)
set(OPENSSL_MODULES ${OPENSSL_MODULES} dl)
endif()
else()
message(STATUS "Info: DCMTK OPENSSL support will be disabled: DCMTK requires OpenSSL version 1.1.1 or newer")
Expand Down Expand Up @@ -118,8 +119,7 @@ if(DCMTK_USE_FIND_PACKAGE)
else()
message(STATUS "Info: DCMTK ZLIB support will be enabled")
set(WITH_ZLIB 1)
include_directories(${ZLIB_INCLUDE_DIRS})
set(ZLIB_LIBS ${ZLIB_LIBRARIES})
set(ZLIB_MODULES ZLIB::ZLIB)
endif()
endif()

Expand Down
13 changes: 13 additions & 0 deletions CMake/DCMTKConfig.cmake.in
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,19 @@ SET_AND_CHECK(DCMTK_TARGETS "@PACKAGE_DCMTK_CMKDIR_CONFIG@/DCMTKTargets.cmake")
# Compatibility: This variable is deprecated
set(DCMTK_INCLUDE_DIR ${DCMTK_INCLUDE_DIRS})

# Depend packages
if(DCMTK_WITH_ZLIB)
if(NOT ZLIB_FOUND)
find_dependency(ZLIB)
endif()
endif()

if(DCMTK_WITH_OPENSSL)
if(NOT OPENSSL_FOUND)
find_dependency(OpenSSL)
endif()
endif()

if(NOT DCMTK_TARGETS_IMPORTED)
set(DCMTK_TARGETS_IMPORTED 1)
include(${DCMTK_TARGETS})
Expand Down
2 changes: 1 addition & 1 deletion dcmdata/libdcxml/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,5 @@ DCMTK_ADD_LIBRARY(dcmxml
xml2dcm.cc
)

DCMTK_TARGET_LINK_MODULES(dcmxml dcmdata ofstd oflog)
DCMTK_TARGET_LINK_MODULES(dcmxml dcmdata ofstd oflog ${ZLIB_MODULES})
DCMTK_TARGET_LINK_LIBRARIES(dcmxml ${ZLIB_LIBS} ${LIBXML_LIBS})
2 changes: 1 addition & 1 deletion dcmdata/libsrc/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ DCMTK_ADD_LIBRARY(dcmdata
vrscanl.c
)

DCMTK_TARGET_LINK_MODULES(dcmdata ofstd oflog)
DCMTK_TARGET_LINK_MODULES(dcmdata ofstd oflog ${ZLIB_MODULES})
DCMTK_TARGET_LINK_LIBRARIES(dcmdata ${ZLIB_LIBS})

# Various dictionary-related commands
Expand Down
7 changes: 6 additions & 1 deletion dcmsign/libsrc/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,12 @@ DCMTK_ADD_LIBRARY(dcmdsig
)

DCMTK_TARGET_LINK_MODULES(dcmdsig ofstd dcmdata)
DCMTK_TARGET_LINK_LIBRARIES(dcmdsig ${OPENSSL_LIBS})

if(OPENSSL_MODULES)
DCMTK_TARGET_LINK_MODULES(dcmdsig ${OPENSSL_MODULES})
else()
DCMTK_TARGET_LINK_LIBRARIES(dcmdsig ${OPENSSL_LIBS})
endif()

if (TARGET dcmdsig)
set_property(TARGET dcmdsig PROPERTY OUTPUT_NAME "dcmdsig${DCMTK_TLS_LIBRARY_POSTFIX}")
Expand Down
6 changes: 5 additions & 1 deletion dcmtls/libsrc/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,11 @@ DCMTK_ADD_LIBRARY(dcmtls
)

DCMTK_TARGET_LINK_MODULES(dcmtls ofstd dcmdata dcmnet)
DCMTK_TARGET_LINK_LIBRARIES(dcmtls ${OPENSSL_LIBS})
if(OPENSSL_MODULES)
DCMTK_TARGET_LINK_MODULES(dcmtls ${OPENSSL_MODULES})
else()
DCMTK_TARGET_LINK_LIBRARIES(dcmtls ${OPENSSL_LIBS})
endif()

if (TARGET dcmtls)
set_property(TARGET dcmtls PROPERTY OUTPUT_NAME "dcmtls${DCMTK_TLS_LIBRARY_POSTFIX}")
Expand Down