mirror of
https://github.com/microsoft/vcpkg.git
synced 2026-01-18 01:11:23 +01:00
[getopt-win32] update to 2.42.0 (#48281)
Co-authored-by: PaperChalice <liujunchang97@outlook.com>
This commit is contained in:
@@ -1,29 +0,0 @@
|
||||
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
|
||||
)
|
||||
@@ -1,34 +1,35 @@
|
||||
set(VCPKG_POLICY_ALLOW_RESTRICTED_HEADERS "enabled")
|
||||
|
||||
vcpkg_from_github(
|
||||
OUT_SOURCE_PATH SOURCE_PATH
|
||||
REPO xiaozhuai/getopt-win32
|
||||
REF b69a586f0b1aa37b77c3cf0a9dedba1900007678
|
||||
SHA512 6e52b6f198073e85b3a29a2fe21435c591fce02c68cb8cf9b546791dd1197e9b91dd9104af449071b4a1d1485817a483f1989a2e585c2d0470cfd079290fe155
|
||||
HEAD_REF master
|
||||
REPO ludvikjerabek/getopt-win
|
||||
REF v${VERSION}
|
||||
SHA512 9ca4e7ed7a1fe7bad9d9ef91b5e65c18a716f4c999818e3dd4f644fc861e1ae12e64255c27f12c0df3b1e44757d3d36c068682dd86d184c6f957b2cabda7bbf3
|
||||
HEAD_REF getopt_glibc_2.42_port
|
||||
PATCHES
|
||||
static-output-name.diff
|
||||
)
|
||||
|
||||
file(COPY "${CMAKE_CURRENT_LIST_DIR}/CMakeLists.txt" DESTINATION "${SOURCE_PATH}")
|
||||
string(COMPARE EQUAL "${VCPKG_LIBRARY_LINKAGE}" "static" BUILD_STATIC_LIBS)
|
||||
|
||||
vcpkg_cmake_configure(SOURCE_PATH "${SOURCE_PATH}")
|
||||
vcpkg_cmake_configure(
|
||||
SOURCE_PATH "${SOURCE_PATH}"
|
||||
OPTIONS
|
||||
-DBUILD_STATIC_LIBS=${BUILD_STATIC_LIBS}
|
||||
-DBUILD_TESTING=OFF
|
||||
)
|
||||
vcpkg_cmake_install()
|
||||
vcpkg_fixup_pkgconfig()
|
||||
|
||||
file(COPY "${SOURCE_PATH}/getopt.h" DESTINATION "${CURRENT_PACKAGES_DIR}/include")
|
||||
vcpkg_cmake_config_fixup(CONFIG_PATH "lib/cmake/getopt")
|
||||
|
||||
if (VCPKG_LIBRARY_LINKAGE STREQUAL "static")
|
||||
vcpkg_replace_string(
|
||||
"${CURRENT_PACKAGES_DIR}/include/getopt.h"
|
||||
"defined(STATIC_GETOPT)"
|
||||
"1"
|
||||
)
|
||||
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")
|
||||
file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/debug/include")
|
||||
|
||||
# Legacy polyfill
|
||||
file(INSTALL "${CMAKE_CURRENT_LIST_DIR}/unofficial-getopt-win32-config.cmake" DESTINATION "${CURRENT_PACKAGES_DIR}/share/unofficial-getopt-win32")
|
||||
|
||||
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")
|
||||
vcpkg_install_copyright(FILE_LIST "${SOURCE_PATH}/LICENSE")
|
||||
|
||||
13
ports/getopt-win32/static-output-name.diff
Normal file
13
ports/getopt-win32/static-output-name.diff
Normal file
@@ -0,0 +1,13 @@
|
||||
diff --git a/CMakeLists.txt b/CMakeLists.txt
|
||||
index 1267606..1e4946f 100644
|
||||
--- a/CMakeLists.txt
|
||||
+++ b/CMakeLists.txt
|
||||
@@ -51,7 +51,7 @@ if(BUILD_STATIC_LIBS)
|
||||
$<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}>
|
||||
)
|
||||
set_target_properties(getopt_static PROPERTIES
|
||||
- OUTPUT_NAME getopt_static
|
||||
+ OUTPUT_NAME getopt
|
||||
PUBLIC_HEADER ${GETOPT_HDR}
|
||||
VERSION ${PROJECT_VERSION}
|
||||
)
|
||||
12
ports/getopt-win32/unofficial-getopt-win32-config.cmake
Normal file
12
ports/getopt-win32/unofficial-getopt-win32-config.cmake
Normal file
@@ -0,0 +1,12 @@
|
||||
file(READ "${CMAKE_CURRENT_LIST_DIR}/../getopt-win32/usage" usage)
|
||||
message(WARNING "find_package(unofficial-getopt-win32) is deprecated.\n${usage}")
|
||||
|
||||
include(CMakeFindDependencyMacro)
|
||||
find_dependency(getopt CONFIG)
|
||||
if(NOT TARGET unofficial::getopt-win32::getopt)
|
||||
if(TARGET getopt::getopt_static)
|
||||
add_library(unofficial::getopt-win32::getopt ALIAS getopt::getopt_static)
|
||||
else()
|
||||
add_library(unofficial::getopt-win32::getopt ALIAS getopt::getopt_shared)
|
||||
endif()
|
||||
endif()
|
||||
@@ -1,4 +1,4 @@
|
||||
getopt-win32 provides CMake targets:
|
||||
|
||||
find_package(unofficial-getopt-win32 REQUIRED)
|
||||
target_link_libraries(main PRIVATE unofficial::getopt-win32::getopt)
|
||||
find_package(getopt CONFIG REQUIRED)
|
||||
target_link_libraries(main PRIVATE $<IF:$<TARGET_EXISTS:getopt::getopt_shared>,getopt::getopt_shared,getopt::getopt_static>)
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
{
|
||||
"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/",
|
||||
"version": "2.42.0",
|
||||
"description": "Full getopt port for unicode and multibyte windows applications",
|
||||
"homepage": "https://github.com/ludvikjerabek/getopt-win/",
|
||||
"license": "LGPL-3.0-only",
|
||||
"supports": "windows & !mingw",
|
||||
"dependencies": [
|
||||
|
||||
@@ -3273,7 +3273,7 @@
|
||||
"port-version": 3
|
||||
},
|
||||
"getopt-win32": {
|
||||
"baseline": "1.1.0.20220925",
|
||||
"baseline": "2.42.0",
|
||||
"port-version": 0
|
||||
},
|
||||
"gettext": {
|
||||
|
||||
@@ -1,5 +1,10 @@
|
||||
{
|
||||
"versions": [
|
||||
{
|
||||
"git-tree": "c96f116944f60f80c7288bbeefb7521be56c39a1",
|
||||
"version": "2.42.0",
|
||||
"port-version": 0
|
||||
},
|
||||
{
|
||||
"git-tree": "d735f424134507a2d87a4ab6d5a8d768ca555dbc",
|
||||
"version": "1.1.0.20220925",
|
||||
|
||||
Reference in New Issue
Block a user