mirror of
https://github.com/microsoft/vcpkg.git
synced 2024-11-30 19:29:01 +08:00
0c990cbfe0
* [argtable3] Add new port * [argtable3] Update patch * [argtable3] Update patch * [argtable3] Add vcpkg-cmake-wrapper.cmake
99 lines
3.7 KiB
Diff
99 lines
3.7 KiB
Diff
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})
|