[nsync] Export cmake targets (#23811)

* [nsync] Export cmake targets

* version

* Forgot the patch

* version

* Also export the include path

* version
This commit is contained in:
Jack·Boos·Yu 2022-03-29 04:51:28 +08:00 committed by GitHub
parent 16659d0027
commit 2be25464ed
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 63 additions and 8 deletions

View File

@ -0,0 +1,36 @@
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 328f9b6..6a71b5b 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -41,6 +41,9 @@ function (set_cpp_target tgtname files)
"${PROJECT_SOURCE_DIR}/platform/c++11.futex"
)
endif ()
+
+ target_include_directories("${tgtname}" PUBLIC $<INSTALL_INTERFACE:include>)
+
target_compile_definitions ("${tgtname}" PRIVATE "${NSYNC_CPP_DEFINITIONS}")
@@ -399,14 +402,19 @@ endif ()
# By default, install nsync always
# set (CMAKE_SKIP_INSTALL_ALL_DEPENDENCY ON)
-install (TARGETS nsync
+install (TARGETS nsync EXPORT unofficial-nsyncConfig
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} COMPONENT RuntimeLibraries
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} COMPONENT Development)
-install (TARGETS nsync_cpp OPTIONAL
+install (TARGETS nsync_cpp OPTIONAL EXPORT unofficial-nsyncConfig
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} COMPONENT RuntimeLibraries
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} COMPONENT Development)
+install(EXPORT unofficial-nsyncConfig
+ NAMESPACE unofficial::nsync::
+ DESTINATION share/unofficial-nsync
+)
+
set (NSYNC_INCLUDES
"public/nsync.h"
"public/nsync_atomic.h"

View File

@ -10,16 +10,18 @@ vcpkg_from_github(
HEAD_REF master
PATCHES
fix-install.patch
export-targets.patch
)
vcpkg_configure_cmake(
SOURCE_PATH ${SOURCE_PATH}
PREFER_NINJA
vcpkg_cmake_configure(
SOURCE_PATH "${SOURCE_PATH}"
OPTIONS
-DNSYNC_ENABLE_TESTS=OFF
)
vcpkg_install_cmake()
vcpkg_cmake_install()
vcpkg_copy_pdbs()
file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/include)
file(INSTALL ${SOURCE_PATH}/LICENSE DESTINATION ${CURRENT_PACKAGES_DIR}/share/${PORT} RENAME copyright)
vcpkg_cmake_config_fixup(PACKAGE_NAME unofficial-nsync CONFIG_PATH share/unofficial-nsync)
file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/debug/include")
file(INSTALL "${SOURCE_PATH}/LICENSE" DESTINATION "${CURRENT_PACKAGES_DIR}/share/${PORT}" RENAME copyright)

View File

@ -1,6 +1,18 @@
{
"name": "nsync",
"version": "1.24.0",
"port-version": 1,
"description": "nsync is a C library that exports various synchronization primitives, such as mutexes",
"homepage": "https://github.com/google/nsync"
"homepage": "https://github.com/google/nsync",
"license": "Apache-2.0",
"dependencies": [
{
"name": "vcpkg-cmake",
"host": true
},
{
"name": "vcpkg-cmake-config",
"host": true
}
]
}

View File

@ -4862,7 +4862,7 @@
},
"nsync": {
"baseline": "1.24.0",
"port-version": 0
"port-version": 1
},
"nt-wrapper": {
"baseline": "2019-08-10",

View File

@ -1,5 +1,10 @@
{
"versions": [
{
"git-tree": "f2333cb932309608aa164aadaacb8d4592c71068",
"version": "1.24.0",
"port-version": 1
},
{
"git-tree": "65f07dbc95a609c95de7befffbf37da598652cee",
"version": "1.24.0",