diff --git a/CMake/ExportConfiguration/GDCMConfig.cmake.in b/CMake/ExportConfiguration/GDCMConfig.cmake.in index 169cb82..c77cf1f 100644 --- a/CMake/ExportConfiguration/GDCMConfig.cmake.in +++ b/CMake/ExportConfiguration/GDCMConfig.cmake.in @@ -1,3 +1,7 @@ +include(CMakeFindDependencyMacro) +find_dependency(expat CONFIG) +find_dependency(OpenJPEG CONFIG) +find_dependency(ZLIB) #----------------------------------------------------------------------------- # # GDCMConfig.cmake - CMake configuration file for external projects. diff --git a/CMakeLists.txt b/CMakeLists.txt index e0064ea..51c47e2 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -413,8 +413,8 @@ option(GDCM_USE_SYSTEM_OPENJPEG "Use system openjpeg" OFF) option(GDCM_USE_SYSTEM_CHARLS "Use system charls" OFF) if(GDCM_USE_SYSTEM_OPENJPEG) - find_package(OpenJPEG 2.0.0 REQUIRED) - set(GDCM_OPENJPEG_LIBRARIES ${OPENJPEG_LIBRARIES}) + find_package(OpenJPEG CONFIG REQUIRED) + set(GDCM_OPENJPEG_LIBRARIES $) else() set(GDCM_OPENJPEG_LIBRARIES gdcmopenjp2) endif() @@ -454,7 +454,7 @@ if(GDCM_USE_SYSTEM_ZLIB) # If user say so, then this is a requirement ! find_package(ZLIB REQUIRED) include_directories(${ZLIB_INCLUDE_DIR}) - set(GDCM_ZLIB_LIBRARIES ${ZLIB_LIBRARIES}) + set(GDCM_ZLIB_LIBRARIES ZLIB::ZLIB) else() set(GDCM_ZLIB_LIBRARIES "gdcmzlib") endif() @@ -473,8 +473,8 @@ endif() if(GDCM_USE_SYSTEM_EXPAT) # If user say so, then this is a requirement ! - find_package(EXPAT REQUIRED) - set(GDCM_EXPAT_LIBRARIES ${EXPAT_LIBRARIES}) + find_package(expat CONFIG REQUIRED) + set(GDCM_EXPAT_LIBRARIES expat::expat) else() set(GDCM_EXPAT_LIBRARIES "gdcmexpat") endif()