vcpkg/ports/gdcm/fix-dependence-getopt.patch
MonicaLiu a9da2edbae
[gdcm] Update to 3.0.22 (#31499)
* update gdcm

* update version

---------

Co-authored-by: Monica <v-liumonica@microsoft.com>
2023-05-18 11:18:03 -07:00

39 lines
1.3 KiB
Diff

diff --git a/Utilities/CMakeLists.txt b/Utilities/CMakeLists.txt
index 4cdc999..c6ede41 100644
--- a/Utilities/CMakeLists.txt
+++ b/Utilities/CMakeLists.txt
@@ -69,6 +69,7 @@ if(NOT GDCM_USE_SYSTEM_ZLIB)
endif()
# Do getopt
+if(NOT USE_VCPKG_GETOPT)
if(EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/getopt)
APPEND_COPYRIGHT(${CMAKE_CURRENT_SOURCE_DIR}/getopt/COPYING)
if(WIN32 AND NOT CYGWIN AND NOT MINGW)
@@ -79,6 +80,7 @@ if(EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/getopt)
add_subdirectory(getopt)
endif()
endif()
+endif()
# you could be running mingw32 on linux in which case you do NOT want the gdcmuuid lib
APPEND_COPYRIGHT(${CMAKE_CURRENT_SOURCE_DIR}/gdcmuuid/COPYING)
diff --git a/Utilities/VTK/Applications/CMakeLists.txt b/Utilities/VTK/Applications/CMakeLists.txt
index a7f7e7e..ab89a73 100644
--- a/Utilities/VTK/Applications/CMakeLists.txt
+++ b/Utilities/VTK/Applications/CMakeLists.txt
@@ -60,7 +60,12 @@ foreach(app ${GDCM_VTK_APPS})
endif()
endif()
if(WIN32 AND NOT CYGWIN)
- target_link_libraries(${app} gdcmgetopt)
+ if(USE_VCPKG_GETOPT)
+ find_package(unofficial-getopt-win32 REQUIRED)
+ target_link_libraries(${app} PRIVATE unofficial::getopt-win32::getopt)
+ else()
+ target_link_libraries(${app} gdcmgetopt)
+ endif()
endif()
if(NOT GDCM_INSTALL_NO_RUNTIME)
install(TARGETS ${app}