diff --git a/ports/getopt-win32/CMakeLists.txt b/ports/getopt-win32/CMakeLists.txt index ffa02c808ac43f..2ebac6b971619b 100644 --- a/ports/getopt-win32/CMakeLists.txt +++ b/ports/getopt-win32/CMakeLists.txt @@ -7,5 +7,20 @@ if(BUILD_SHARED_LIBS) else() add_definitions(-DSTATIC_GETOPT) endif() + add_library(getopt getopt.c) -install(TARGETS getopt) + +install( + TARGETS getopt + EXPORT unofficial-getopt-win32 + RUNTIME DESTINATION bin + LIBRARY DESTINATION lib + ARCHIVE DESTINATION lib +) + +install( + EXPORT unofficial-getopt-win32 + NAMESPACE unofficial::getopt-win32:: + DESTINATION share/unofficial-getopt-win32 + FILE unofficial-getopt-win32-config.cmake +) diff --git a/ports/getopt-win32/portfile.cmake b/ports/getopt-win32/portfile.cmake index 6528e442d069f2..e5cddc83dbf0e3 100644 --- a/ports/getopt-win32/portfile.cmake +++ b/ports/getopt-win32/portfile.cmake @@ -1,23 +1,34 @@ -vcpkg_from_github( - OUT_SOURCE_PATH SOURCE_PATH - REPO libimobiledevice-win32/getopt - REF 0.1 - SHA512 40e2a901241a5d751cec741e5de423c8f19b105572c7cae18adb6e69be0b408efc6c9a2ecaeb62f117745eac0d093f30d6b91d88c1a27e1f7be91f0e84fdf199 - HEAD_REF master - PATCHES getopt.h.patch -) - -file(COPY "${CMAKE_CURRENT_LIST_DIR}/CMakeLists.txt" DESTINATION "${SOURCE_PATH}") - -vcpkg_cmake_configure(SOURCE_PATH "${SOURCE_PATH}") -vcpkg_cmake_install() - -file(COPY "${SOURCE_PATH}/getopt.h" DESTINATION "${CURRENT_PACKAGES_DIR}/include/") -if (VCPKG_LIBRARY_LINKAGE STREQUAL "static") - vcpkg_replace_string("${CURRENT_PACKAGES_DIR}/include/getopt.h" - " #define __GETOPT_H_" " #define __GETOPT_H_\n #define STATIC_GETOPT" - ) -endif() - -configure_file("${SOURCE_PATH}/LICENSE" "${CURRENT_PACKAGES_DIR}/share/${PORT}/copyright" COPYONLY) -set(VCPKG_POLICY_ALLOW_RESTRICTED_HEADERS enabled) +vcpkg_from_github( + OUT_SOURCE_PATH SOURCE_PATH + REPO libimobiledevice-win32/getopt + REF 0.1 + SHA512 40e2a901241a5d751cec741e5de423c8f19b105572c7cae18adb6e69be0b408efc6c9a2ecaeb62f117745eac0d093f30d6b91d88c1a27e1f7be91f0e84fdf199 + HEAD_REF master + PATCHES getopt.h.patch +) + +file(COPY "${CMAKE_CURRENT_LIST_DIR}/CMakeLists.txt" DESTINATION "${SOURCE_PATH}") + +vcpkg_cmake_configure(SOURCE_PATH "${SOURCE_PATH}") +vcpkg_cmake_install() +vcpkg_fixup_pkgconfig() + +file(COPY "${SOURCE_PATH}/getopt.h" DESTINATION "${CURRENT_PACKAGES_DIR}/include") + +if (VCPKG_LIBRARY_LINKAGE STREQUAL "static") + vcpkg_replace_string( + "${CURRENT_PACKAGES_DIR}/include/getopt.h" + " #define __GETOPT_H_" + " #define __GETOPT_H_\n #define STATIC_GETOPT" + ) +endif() + +vcpkg_cmake_config_fixup( + CONFIG_PATH "share/unofficial-getopt-win32" + PACKAGE_NAME "unofficial-getopt-win32" +) + +file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/debug/share") +file(INSTALL "${CMAKE_CURRENT_LIST_DIR}/usage" DESTINATION "${CURRENT_PACKAGES_DIR}/share/${PORT}") +configure_file("${SOURCE_PATH}/LICENSE" "${CURRENT_PACKAGES_DIR}/share/${PORT}/copyright" COPYONLY) +set(VCPKG_POLICY_ALLOW_RESTRICTED_HEADERS "enabled") diff --git a/ports/getopt-win32/usage b/ports/getopt-win32/usage new file mode 100644 index 00000000000000..42843a09cf5352 --- /dev/null +++ b/ports/getopt-win32/usage @@ -0,0 +1,4 @@ +getopt-win32 provides CMake targets: + + find_package(unofficial-getopt-win32 REQUIRED) + target_link_libraries(main PRIVATE unofficial::getopt-win32::getopt) diff --git a/ports/getopt-win32/vcpkg.json b/ports/getopt-win32/vcpkg.json index 81213e0d4c2942..e0969e2f00847f 100644 --- a/ports/getopt-win32/vcpkg.json +++ b/ports/getopt-win32/vcpkg.json @@ -1,7 +1,7 @@ { "name": "getopt-win32", "version": "0.1", - "port-version": 4, + "port-version": 5, "description": "An implementation of getopt.", "homepage": "https://github.com/libimobiledevice-win32/getopt", "license": "LGPL-3.0-only", @@ -10,6 +10,10 @@ { "name": "vcpkg-cmake", "host": true + }, + { + "name": "vcpkg-cmake-config", + "host": true } ] } diff --git a/versions/baseline.json b/versions/baseline.json index f897d152b457a7..e37f34a4b6dc5d 100644 --- a/versions/baseline.json +++ b/versions/baseline.json @@ -2594,7 +2594,7 @@ }, "getopt-win32": { "baseline": "0.1", - "port-version": 4 + "port-version": 5 }, "gettext": { "baseline": "0.21", diff --git a/versions/g-/getopt-win32.json b/versions/g-/getopt-win32.json index 1b8ce8edcd7a85..5e41ec778ec481 100644 --- a/versions/g-/getopt-win32.json +++ b/versions/g-/getopt-win32.json @@ -1,5 +1,10 @@ { "versions": [ + { + "git-tree": "e20f1829d379f402502feedd978738b06b3f17ad", + "version": "0.1", + "port-version": 5 + }, { "git-tree": "a655b35c38424570406603859dcfbb70d25bc0b9", "version": "0.1",