[xproperty] Add new port (#6316)

This commit is contained in:
myd7349 2019-05-21 08:08:24 +08:00 committed by Victor Romero
parent 3e22027648
commit ed61238087
3 changed files with 78 additions and 0 deletions

4
ports/xproperty/CONTROL Normal file
View File

@ -0,0 +1,4 @@
Source: xproperty
Version: 0.8.1
Build-Depends: xtl
Description: Traitlets-like C++ properties and implementation of the observer pattern

View File

@ -0,0 +1,44 @@
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 5dcddc2..9d99227 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -7,7 +7,7 @@
############################################################################
cmake_minimum_required(VERSION 3.1)
-project(xproperty)
+project(xproperty CXX)
set(XPROPERTY_INCLUDE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/include)
@@ -28,7 +28,8 @@ message(STATUS "xproperty v${${PROJECT_NAME}_VERSION}")
# Dependencies
# ============
-find_package(xtl 0.5.3 REQUIRED)
+set(xtl_REQUIRED_VERSION 0.5.3)
+find_package(xtl ${xtl_REQUIRED_VERSION} REQUIRED)
message(STATUS "Found xtl: ${xtl_INCLUDE_DIRS}/xtl")
# Build
diff --git a/xpropertyConfig.cmake.in b/xpropertyConfig.cmake.in
index 192c04f..38b305a 100644
--- a/xpropertyConfig.cmake.in
+++ b/xpropertyConfig.cmake.in
@@ -15,7 +15,12 @@
@PACKAGE_INIT@
-set(PN xproperty)
-set_and_check(${PN}_INCLUDE_DIR "${PACKAGE_PREFIX_DIR}/@CMAKE_INSTALL_INCLUDEDIR@")
-set(${PN}_LIBRARY "")
-check_required_components(${PN})
+include(CMakeFindDependencyMacro)
+find_dependency(xtl @xtl_REQUIRED_VERSION@)
+
+if(NOT TARGET @PROJECT_NAME@)
+ include("${CMAKE_CURRENT_LIST_DIR}/@PROJECT_NAME@Targets.cmake")
+ get_target_property(@PROJECT_NAME@_INCLUDE_DIR @PROJECT_NAME@ INTERFACE_INCLUDE_DIRECTORIES)
+endif()
+
+set(@PROJECT_NAME@_LIBRARY "")

View File

@ -0,0 +1,30 @@
# header-only library
include(vcpkg_common_functions)
vcpkg_from_github(
OUT_SOURCE_PATH SOURCE_PATH
REPO QuantStack/xproperty
REF 0.8.1
SHA512 70fcce3a3cc84be98d844aa59c14686945907db3c8fa1c9a916f0bab811ef96512464031e53f00d29cba7db750a0032f4b59d6ca524f52bc7cfe8de5cebad5e5
HEAD_REF master
PATCHES
fix-target.patch
)
vcpkg_configure_cmake(
SOURCE_PATH ${SOURCE_PATH}
PREFER_NINJA
OPTIONS
-DBUILD_TESTS=OFF
-DDOWNLOAD_GTEST=OFF
)
vcpkg_install_cmake()
vcpkg_fixup_cmake_targets(CONFIG_PATH lib/cmake/${PORT})
file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug ${CURRENT_PACKAGES_DIR}/lib)
# Handle copyright
configure_file(${SOURCE_PATH}/LICENSE ${CURRENT_PACKAGES_DIR}/share/${PORT}/copyright COPYONLY)