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}