vcpkg/ports/gdcm/fix-dependence-getopt.patch
Cheney Wang 25663f218c
[vcpkg baseline][ideviceinstaller] Fixing error LNK2005 when argtable2 installed before ideviceinstaller (#28459)
* [ideviceinstaller] Add support !static

* Modify port-version

* x-add-version

* Add getopt as a dependence of argtable2

* Use version

* x-add-version

* Remove space

* Add license

* Fix format error

* x-add-version

* update version

* fix argtable3

* x-add-version

* fix argtable3

* version

* fix gdcm

* format portfile.cmake

* update version

* format vcpkg.json

* x-add-version

* format portfile.cmake

* x-add-version

* Update license

* x-add-version

* Again

* Mistake

Co-authored-by: Lily Wang <494550702@qq.com>
Co-authored-by: Lily Wang <94091114+LilyWangLL@users.noreply.github.com>
2022-12-28 13:07:26 -08:00

40 lines
1.4 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 c7f1ad9..20883a2 100644
--- a/Utilities/VTK/Applications/CMakeLists.txt
+++ b/Utilities/VTK/Applications/CMakeLists.txt
@@ -45,7 +45,13 @@ foreach(app ${GDCM_VTK_APPS})
target_link_libraries(${app} ${VTK_LIBRARIES} vtkIOXML)
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()
+else()
endif()
if(NOT GDCM_INSTALL_NO_RUNTIME)
install(TARGETS ${app}