[date] Fix installation (#32772)

* [date] Fix installation

* update version database
This commit is contained in:
Weihang Ding 2023-07-27 02:06:59 +08:00 committed by GitHub
parent e65af7bb5c
commit c26975658a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
7 changed files with 77 additions and 41 deletions

View File

@ -1,32 +0,0 @@
diff --git a/CMakeLists.txt b/CMakeLists.txt
index ad74900..42d55af 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -73,7 +73,7 @@ target_sources( date INTERFACE
$<BUILD_INTERFACE:${CMAKE_CURRENT_LIST_DIR}/include/date/iso_week.h>
$<BUILD_INTERFACE:${CMAKE_CURRENT_LIST_DIR}/include/date/julian.h>
)
-if (CMAKE_VERSION VERSION_GREATER_EQUAL 3.15)
+if (0)
# public headers will get installed:
set_target_properties( date PROPERTIES PUBLIC_HEADER include/date/date.h )
endif ()
@@ -144,7 +144,6 @@ if( BUILD_TZ_LIB )
endif( )
set_target_properties( date-tz PROPERTIES
POSITION_INDEPENDENT_CODE ON
- PUBLIC_HEADER "${TZ_HEADERS}"
VERSION "${PROJECT_VERSION}"
SOVERSION "${ABI_VERSION}" )
if( NOT MSVC )
@@ -169,8 +169,8 @@ write_basic_package_version_file( "${version_config}"
COMPATIBILITY SameMajorVersion )
install( TARGETS date
- EXPORT dateConfig
- PUBLIC_HEADER DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/date )
+ EXPORT dateConfig )
+install( FILES include/date/date.h ${TZ_HEADERS} DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/date )
export( TARGETS date NAMESPACE date:: FILE dateTargets.cmake )
if (CMAKE_VERSION VERSION_LESS 3.15)
install(

View File

@ -0,0 +1,63 @@
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 012512a..2cbcc21 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -73,10 +73,6 @@ target_sources( date INTERFACE
$<BUILD_INTERFACE:${CMAKE_CURRENT_LIST_DIR}/include/date/iso_week.h>
$<BUILD_INTERFACE:${CMAKE_CURRENT_LIST_DIR}/include/date/julian.h>
)
-if (CMAKE_VERSION VERSION_GREATER_EQUAL 3.15)
- # public headers will get installed:
- set_target_properties( date PROPERTIES PUBLIC_HEADER include/date/date.h )
-endif ()
# These used to be set with generator expressions,
#
@@ -144,7 +140,6 @@ if( BUILD_TZ_LIB )
endif( )
set_target_properties( date-tz PROPERTIES
POSITION_INDEPENDENT_CODE ON
- PUBLIC_HEADER "${TZ_HEADERS}"
VERSION "${PROJECT_VERSION}"
SOVERSION "${ABI_VERSION}" )
if( NOT MSVC )
@@ -169,30 +164,26 @@ write_basic_package_version_file( "${version_config}"
COMPATIBILITY SameMajorVersion )
install( TARGETS date
- EXPORT dateConfig
- PUBLIC_HEADER DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/date )
+ EXPORT dateConfig )
export( TARGETS date NAMESPACE date:: FILE dateTargets.cmake )
-if (CMAKE_VERSION VERSION_LESS 3.15)
- install(
- FILES include/date/date.h
- DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/date )
-endif ()
+install(
+ DIRECTORY "${CMAKE_SOURCE_DIR}/include/date"
+ DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}"
+ PATTERN "chrono_io.h" EXCLUDE
+)
if( BUILD_TZ_LIB )
install( TARGETS date-tz
EXPORT dateConfig
- PUBLIC_HEADER DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/date
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} ) # This is for Windows
export( TARGETS date-tz NAMESPACE date:: APPEND FILE dateTargets.cmake )
endif( )
-if( WIN32 AND NOT CYGWIN)
- set( CONFIG_LOC CMake )
-else( )
- set( CONFIG_LOC "${CMAKE_INSTALL_LIBDIR}/cmake/date" )
-endif( )
+
+set( CONFIG_LOC "${CMAKE_INSTALL_LIBDIR}/cmake/date" )
+
install( EXPORT dateConfig
FILE dateTargets.cmake
NAMESPACE date::

View File

@ -13,7 +13,7 @@ vcpkg_from_github(
HEAD_REF master
PATCHES
0001-fix-uwp.patch
0002-fix-cmake-3.14.patch
0002-fix-cmake-install.patch
fix-uninitialized-values.patch #Update the new version please remove this patch
)
@ -30,15 +30,11 @@ vcpkg_cmake_configure(
)
vcpkg_cmake_install()
if(VCPKG_TARGET_IS_WINDOWS)
vcpkg_cmake_config_fixup(CONFIG_PATH CMake)
else()
vcpkg_cmake_config_fixup(CONFIG_PATH lib/cmake/date)
endif()
vcpkg_cmake_config_fixup(CONFIG_PATH lib/cmake/date)
vcpkg_copy_pdbs()
file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/debug/include")
vcpkg_install_copyright(FILE_LIST "${SOURCE_PATH}/LICENSE.txt")
file(INSTALL "${CMAKE_CURRENT_LIST_DIR}/usage" DESTINATION "${CURRENT_PACKAGES_DIR}/share/${PORT}")

4
ports/date/usage Normal file
View File

@ -0,0 +1,4 @@
date provides CMake targets:
find_package(date CONFIG REQUIRED)
target_link_libraries(main PRIVATE date::date date::date-tz)

View File

@ -1,7 +1,7 @@
{
"name": "date",
"version": "3.0.1",
"port-version": 3,
"port-version": 4,
"description": "A date and time library based on the C++17 <chrono> header",
"homepage": "https://github.com/HowardHinnant/date",
"license": "MIT",

View File

@ -2034,7 +2034,7 @@
},
"date": {
"baseline": "3.0.1",
"port-version": 3
"port-version": 4
},
"dav1d": {
"baseline": "1.2.1",

View File

@ -1,5 +1,10 @@
{
"versions": [
{
"git-tree": "4f6b5d17f3cf8ffb0330963bf0b6d8efa9175e13",
"version": "3.0.1",
"port-version": 4
},
{
"git-tree": "b3ca1bdc08676cd1bb802421bd94a18872305737",
"version": "3.0.1",