-
Notifications
You must be signed in to change notification settings - Fork 6.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* [argtable3] Add new port * [argtable3] Update patch * [argtable3] Update patch * [argtable3] Add vcpkg-cmake-wrapper.cmake
- Loading branch information
Showing
4 changed files
with
164 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
Source: argtable3 | ||
Version: 2019-08-21 | ||
Description: A single-file, ANSI C, command-line parsing library that parses GNU-style command-line options | ||
Homepage: www.argtable.org |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,98 @@ | ||
diff --git a/CMakeLists.txt b/CMakeLists.txt | ||
index 57bd7a1..e19e677 100644 | ||
--- a/CMakeLists.txt | ||
+++ b/CMakeLists.txt | ||
@@ -65,10 +65,6 @@ if(ARGTABLE3_ENABLE_CONAN AND EXISTS "${CMAKE_BINARY_DIR}/conanbuildinfo.cmake") | ||
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -Wl,-rpath-link,${LINK_FLAGS}") | ||
endif() | ||
|
||
-if(ARGTABLE3_ENABLE_TESTS) | ||
- enable_testing() | ||
-endif() | ||
- | ||
set(ARGTABLE3_AMALGAMATION_SRC_FILE ${PROJECT_SOURCE_DIR}/dist/argtable3.c) | ||
set(ARGTABLE3_SRC_FILES | ||
${PROJECT_SOURCE_DIR}/src/arg_cmd.c | ||
@@ -88,18 +84,11 @@ set(ARGTABLE3_SRC_FILES | ||
${PROJECT_SOURCE_DIR}/src/getopt_long.c | ||
) | ||
|
||
-# Platform specific settings for installation | ||
-if(UNIX) | ||
- include(GNUInstallDirs) | ||
- set(ARGTABLE3_INSTALL_LIBDIR ${CMAKE_INSTALL_LIBDIR}) | ||
- set(ARGTABLE3_INSTALL_INCLUDEDIR ${CMAKE_INSTALL_INCLUDEDIR}) | ||
- set(ARGTABLE3_INSTALL_CMAKEDIR ${CMAKE_INSTALL_LIBDIR}/cmake/argtable3) | ||
-elseif(WIN32) | ||
- set(ARGTABLE3_INSTALL_LIBDIR "lib") | ||
- set(ARGTABLE3_INSTALL_INCLUDEDIR "include") | ||
- set(ARGTABLE3_INSTALL_CMAKEDIR "cmake") | ||
-endif(UNIX) | ||
- | ||
add_subdirectory(src) | ||
-add_subdirectory(tests) | ||
+ | ||
+if(ARGTABLE3_ENABLE_TESTS) | ||
+ enable_testing() | ||
+ add_subdirectory(tests) | ||
+endif() | ||
+ | ||
add_subdirectory(examples) | ||
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt | ||
index 429b143..f45c071 100644 | ||
--- a/src/CMakeLists.txt | ||
+++ b/src/CMakeLists.txt | ||
@@ -28,9 +28,19 @@ | ||
# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
################################################################################ | ||
|
||
-set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -std=c89 -Wpedantic") | ||
-set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall") | ||
-set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wextra") | ||
+include(GNUInstallDirs) | ||
+ | ||
+if(UNIX) | ||
+ set(ARGTABLE3_INSTALL_CMAKEDIR ${CMAKE_INSTALL_LIBDIR}/cmake/argtable3) | ||
+elseif(WIN32) | ||
+ set(ARGTABLE3_INSTALL_CMAKEDIR "cmake") | ||
+endif(UNIX) | ||
+ | ||
+if(CMAKE_C_COMPILER_ID MATCHES "GNU|Clang") | ||
+ set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -std=c89 -Wpedantic") | ||
+ set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall") | ||
+ set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wextra") | ||
+endif() | ||
|
||
add_definitions(-D_XOPEN_SOURCE=700) | ||
|
||
@@ -46,6 +56,7 @@ if(WIN32) | ||
"${PROJECT_BINARY_DIR}/src/version.rc" | ||
) | ||
add_library(argtable3 SHARED ${ARGTABLE3_SRC_FILES} "${PROJECT_BINARY_DIR}/src/version.rc") | ||
+ target_compile_definitions(argtable3 INTERFACE argtable3_IMPORTS) | ||
else() | ||
add_library(argtable3 SHARED ${ARGTABLE3_SRC_FILES}) | ||
endif() | ||
@@ -57,8 +68,18 @@ target_include_directories(argtable3 PRIVATE ${PROJECT_SOURCE_DIR}/src) | ||
set_target_properties(argtable3 argtable3_static PROPERTIES | ||
VERSION ${PROJECT_VERSION_MAJOR}.${PROJECT_VERSION_MINOR}.${PROJECT_VERSION_PATCH} | ||
SOVERSION ${PROJECT_VERSION_MAJOR}.${PROJECT_VERSION_MINOR}) | ||
- | ||
-install(TARGETS argtable3 EXPORT ${ARGTABLE3_PACKAGE_NAME}Config DESTINATION ${ARGTABLE3_INSTALL_LIBDIR}) | ||
-install(TARGETS argtable3_static EXPORT ${ARGTABLE3_PACKAGE_NAME}Config ARCHIVE DESTINATION ${ARGTABLE3_INSTALL_LIBDIR}) | ||
-install(FILES "${PROJECT_SOURCE_DIR}/src/argtable3.h" DESTINATION ${ARGTABLE3_INSTALL_INCLUDEDIR}) | ||
+if(BUILD_SHARED_LIBS) | ||
+install(TARGETS argtable3 | ||
+ EXPORT ${ARGTABLE3_PACKAGE_NAME}Config | ||
+ ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} | ||
+ LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} | ||
+ RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} | ||
+ INCLUDES DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}) | ||
+else() | ||
+install(TARGETS argtable3_static | ||
+ EXPORT ${ARGTABLE3_PACKAGE_NAME}Config | ||
+ ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} | ||
+ INCLUDES DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}) | ||
+endif() | ||
+install(FILES "${PROJECT_SOURCE_DIR}/src/argtable3.h" DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}) | ||
install(EXPORT ${ARGTABLE3_PACKAGE_NAME}Config DESTINATION ${ARGTABLE3_INSTALL_CMAKEDIR}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
include(vcpkg_common_functions) | ||
|
||
vcpkg_from_github( | ||
OUT_SOURCE_PATH SOURCE_PATH | ||
REPO argtable/argtable3 | ||
REF bbc4ec20991e87ecf8dcf288aef777b55b78daa7 | ||
SHA512 050f54ead2d029715d8f10e63ff555027ead61fbfa18bd955e3b99e080f9178ad5c41937c5d62477885143f27bb9e7e505a7120b95bfcd899a60719584191f1c | ||
HEAD_REF master | ||
PATCHES | ||
fix-cmake.patch | ||
) | ||
|
||
vcpkg_configure_cmake( | ||
SOURCE_PATH ${SOURCE_PATH} | ||
PREFER_NINJA | ||
OPTIONS | ||
-DARGTABLE3_ENABLE_CONAN=OFF | ||
-DARGTABLE3_ENABLE_TESTS=OFF | ||
-DARGTABLE3_BUILD_STATIC_EXAMPLES=OFF | ||
) | ||
|
||
vcpkg_install_cmake() | ||
|
||
vcpkg_copy_pdbs() | ||
|
||
if(EXISTS ${CURRENT_PACKAGES_DIR}/cmake) | ||
vcpkg_fixup_cmake_targets(CONFIG_PATH cmake) | ||
elseif(EXISTS ${CURRENT_PACKAGES_DIR}/lib/cmake/${PORT}) | ||
vcpkg_fixup_cmake_targets(CONFIG_PATH lib/cmake/${PORT}) | ||
endif() | ||
|
||
file(COPY | ||
${CMAKE_CURRENT_LIST_DIR}/vcpkg-cmake-wrapper.cmake | ||
DESTINATION ${CURRENT_PACKAGES_DIR}/share/${PORT} | ||
) | ||
|
||
file(REMOVE_RECURSE | ||
${CURRENT_PACKAGES_DIR}/debug/include | ||
) | ||
|
||
if(VCPKG_LIBRARY_LINKAGE STREQUAL dynamic) | ||
vcpkg_replace_string( | ||
"${CURRENT_PACKAGES_DIR}/include/argtable3.h" | ||
"defined(argtable3_IMPORTS)" | ||
"1 // defined(argtable3_IMPORTS)" | ||
) | ||
endif() | ||
|
||
# Handle copyright | ||
configure_file(${SOURCE_PATH}/LICENSE ${CURRENT_PACKAGES_DIR}/share/${PORT}/copyright COPYONLY) | ||
|
||
# CMake integration test | ||
vcpkg_test_cmake(PACKAGE_NAME ${PORT}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
_find_package(${ARGS}) | ||
|
||
if(TARGET argtable3 AND NOT TARGET argtable3_static) | ||
add_library(argtable3_static INTERFACE IMPORTED) | ||
set_target_properties(argtable3_static PROPERTIES INTERFACE_LINK_LIBRARIES argtable3) | ||
elseif(TARGET argtable3_static AND NOT TARGET argtable3) | ||
add_library(argtable3 INTERFACE IMPORTED) | ||
set_target_properties(argtable3 PROPERTIES INTERFACE_LINK_LIBRARIES argtable3_static) | ||
endif() |