diff options
Diffstat (limited to 'vcpkg/ports/getopt-win32')
| -rw-r--r-- | vcpkg/ports/getopt-win32/CMakeLists.txt | 29 | ||||
| -rw-r--r-- | vcpkg/ports/getopt-win32/portfile.cmake | 34 | ||||
| -rw-r--r-- | vcpkg/ports/getopt-win32/usage | 4 | ||||
| -rw-r--r-- | vcpkg/ports/getopt-win32/vcpkg.json | 18 |
4 files changed, 85 insertions, 0 deletions
diff --git a/vcpkg/ports/getopt-win32/CMakeLists.txt b/vcpkg/ports/getopt-win32/CMakeLists.txt new file mode 100644 index 0000000..5bf9b11 --- /dev/null +++ b/vcpkg/ports/getopt-win32/CMakeLists.txt @@ -0,0 +1,29 @@ +cmake_minimum_required(VERSION 3.14)
+
+project(getopt-win32 C)
+
+if(BUILD_SHARED_LIBS)
+ add_definitions(-DEXPORTS_GETOPT)
+else()
+ add_definitions(-DSTATIC_GETOPT)
+endif()
+
+add_library(getopt getopt.c)
+
+TARGET_INCLUDE_DIRECTORIES(getopt INTERFACE $<INSTALL_INTERFACE:include>)
+
+install(
+ TARGETS getopt
+ EXPORT unofficial-getopt-win32
+ RUNTIME DESTINATION bin
+ LIBRARY DESTINATION lib
+ ARCHIVE DESTINATION lib
+ INCLUDES DESTINATION include
+)
+
+install(
+ EXPORT unofficial-getopt-win32
+ NAMESPACE unofficial::getopt-win32::
+ DESTINATION share/unofficial-getopt-win32
+ FILE unofficial-getopt-win32-config.cmake
+)
diff --git a/vcpkg/ports/getopt-win32/portfile.cmake b/vcpkg/ports/getopt-win32/portfile.cmake new file mode 100644 index 0000000..5b1eb8f --- /dev/null +++ b/vcpkg/ports/getopt-win32/portfile.cmake @@ -0,0 +1,34 @@ +vcpkg_from_github( + OUT_SOURCE_PATH SOURCE_PATH + REPO xiaozhuai/getopt-win32 + REF b69a586f0b1aa37b77c3cf0a9dedba1900007678 + SHA512 6e52b6f198073e85b3a29a2fe21435c591fce02c68cb8cf9b546791dd1197e9b91dd9104af449071b4a1d1485817a483f1989a2e585c2d0470cfd079290fe155 + HEAD_REF master +) + +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" + "defined(STATIC_GETOPT)" + "1" + ) +endif() + +vcpkg_cmake_config_fixup( + CONFIG_PATH "share/unofficial-getopt-win32" + PACKAGE_NAME "unofficial-getopt-win32" +) + +file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/debug/share") + +vcpkg_install_copyright(FILE_LIST "${SOURCE_PATH}/LICENSE") +file(INSTALL "${CMAKE_CURRENT_LIST_DIR}/usage" DESTINATION "${CURRENT_PACKAGES_DIR}/share/${PORT}") +set(VCPKG_POLICY_ALLOW_RESTRICTED_HEADERS "enabled") diff --git a/vcpkg/ports/getopt-win32/usage b/vcpkg/ports/getopt-win32/usage new file mode 100644 index 0000000..42843a0 --- /dev/null +++ b/vcpkg/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/vcpkg/ports/getopt-win32/vcpkg.json b/vcpkg/ports/getopt-win32/vcpkg.json new file mode 100644 index 0000000..7429396 --- /dev/null +++ b/vcpkg/ports/getopt-win32/vcpkg.json @@ -0,0 +1,18 @@ +{ + "name": "getopt-win32", + "version": "1.1.0.20220925", + "description": "An implementation of getopt.", + "homepage": "https://www.codeproject.com/Articles/157001/Full-getopt-Port-for-Unicode-and-Multibyte-Microso/", + "license": "LGPL-3.0-only", + "supports": "windows & !mingw", + "dependencies": [ + { + "name": "vcpkg-cmake", + "host": true + }, + { + "name": "vcpkg-cmake-config", + "host": true + } + ] +} |