From 20c983a6bae5888ad0d50f4c3414114e379ae491 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dennis=20B=C3=B6rm?= Date: Mon, 4 Nov 2019 14:48:14 +0100 Subject: [PATCH 1/8] create iso_week header only library in cmake-file --- CMakeLists.txt | 22 ++++++++++++++++++++++ include/date/iso_week.h | 2 +- 2 files changed, 23 insertions(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 885e4245..91f46c73 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -78,6 +78,24 @@ target_compile_definitions( date INTERFACE ONLY_C_LOCALE=$,1,0> $<$:HAS_STRING_VIEW=0> ) +#[===================================================================[ + iso_week (header only) library +#]===================================================================] +add_library( iso_week INTERFACE ) +add_library( date::iso_week ALIAS iso_week ) +target_include_directories( iso_week INTERFACE + $ + $ ) +target_sources( iso_week INTERFACE + $$/date/iso_week.h + ) +# public headers will get installed: +set_target_properties( iso_week PROPERTIES PUBLIC_HEADER include/date/iso_week.h ) +target_compile_definitions( iso_week INTERFACE + #To workaround libstdc++ issue https://github.com/HowardHinnant/date/issues/388 + ONLY_C_LOCALE=$,1,0> + $<$:HAS_STRING_VIEW=0> ) + #[===================================================================[ tz (compiled) library #]===================================================================] @@ -140,6 +158,10 @@ install( TARGETS date PUBLIC_HEADER DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/date ) export( TARGETS date NAMESPACE date:: FILE dateConfig.cmake ) +install( TARGETS iso_week + EXPORT isoWeekConfig + PUBLIC_HEADER DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/date ) +export( TARGETS iso_week NAMESPACE date:: FILE isoWeekConfig.cmake ) if( BUILD_TZ_LIB ) install( TARGETS tz EXPORT dateConfig diff --git a/include/date/iso_week.h b/include/date/iso_week.h index 4a0a4a9b..73c98b2e 100644 --- a/include/date/iso_week.h +++ b/include/date/iso_week.h @@ -422,7 +422,7 @@ inline unsigned char weekday::to_iso_encoding(unsigned char z) NOEXCEPT { - return z != 0 ? z : (unsigned char)7; + return z != 0 ? z : static_cast(7); } CONSTCD11 From 3ac1564bc4cc595c2124e1656f2e3161dd6efe3e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dennis=20B=C3=B6rm?= Date: Fri, 8 Nov 2019 13:16:49 +0100 Subject: [PATCH 2/8] add cmake config file --- CMakeLists.txt | 21 ++++++++++++++------- cmake/dateConfig.cmake.in | 7 +++++++ 2 files changed, 21 insertions(+), 7 deletions(-) create mode 100644 cmake/dateConfig.cmake.in diff --git a/CMakeLists.txt b/CMakeLists.txt index 91f46c73..eab2ebe9 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -154,22 +154,23 @@ write_basic_package_version_file( "${version_config}" COMPATIBILITY SameMajorVersion ) install( TARGETS date - EXPORT dateConfig + EXPORT dateTargets PUBLIC_HEADER DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/date ) -export( TARGETS date NAMESPACE date:: FILE dateConfig.cmake ) +export( TARGETS date NAMESPACE date:: FILE dateTargets.cmake ) install( TARGETS iso_week - EXPORT isoWeekConfig + EXPORT dateTargets PUBLIC_HEADER DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/date ) -export( TARGETS iso_week NAMESPACE date:: FILE isoWeekConfig.cmake ) +export( TARGETS iso_week NAMESPACE date:: APPEND FILE dateTargets.cmake ) + if( BUILD_TZ_LIB ) install( TARGETS tz - EXPORT dateConfig + EXPORT dateTargets 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 tz NAMESPACE date:: APPEND FILE dateConfig.cmake ) + export( TARGETS tz NAMESPACE date:: APPEND FILE dateTargets.cmake ) endif( ) if( WIN32 AND NOT CYGWIN) @@ -177,10 +178,16 @@ if( WIN32 AND NOT CYGWIN) else( ) set( CONFIG_LOC "${CMAKE_INSTALL_LIBDIR}/cmake/date" ) endif( ) -install( EXPORT dateConfig +install( EXPORT dateTargets NAMESPACE date:: DESTINATION ${CONFIG_LOC} ) +configure_file(cmake/dateConfig.cmake.in dateConfig.cmake @ONLY) +install(FILES "${CMAKE_CURRENT_BINARY_DIR}/dateConfig.cmake" + "${CMAKE_CURRENT_BINARY_DIR}/dateConfigVersion.cmake" + DESTINATION ${CONFIG_LOC} + ) + #[===================================================================[ testing #]===================================================================] diff --git a/cmake/dateConfig.cmake.in b/cmake/dateConfig.cmake.in new file mode 100644 index 00000000..4236cfcc --- /dev/null +++ b/cmake/dateConfig.cmake.in @@ -0,0 +1,7 @@ +include(CMakeFindDependencyMacro) + +set(USE_SYSTEM_TZ_DB @USE_SYSTEM_TZ_DB@) +set(BUILD_TZ_LIB @BUILD_TZ_LIB@) + +include("${CMAKE_CURRENT_LIST_DIR}/dateTargets.cmake") + From f7b589055b3ebdb70f6a309e0b71b96a7d688c8f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dennis=20B=C3=B6rm?= Date: Fri, 8 Nov 2019 13:22:54 +0100 Subject: [PATCH 3/8] enable Threads::Threads for msvc --- CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index eab2ebe9..d3d36868 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -133,7 +133,7 @@ if( BUILD_TZ_LIB ) PUBLIC_HEADER "${TZ_HEADERS}" VERSION "${PROJECT_VERSION}" SOVERSION "${PROJECT_VERSION}" ) - if( NOT MSVC ) + if( MSVC ) find_package( Threads ) target_link_libraries( tz PUBLIC Threads::Threads ) endif( ) From eb465ca71631285dc0f95e5dd86c32d486fee612 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dennis=20B=C3=B6rm?= Date: Thu, 12 Mar 2020 10:23:57 +0100 Subject: [PATCH 4/8] find dependency --- cmake/dateConfig.cmake.in | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/cmake/dateConfig.cmake.in b/cmake/dateConfig.cmake.in index 4236cfcc..a8641671 100644 --- a/cmake/dateConfig.cmake.in +++ b/cmake/dateConfig.cmake.in @@ -3,5 +3,13 @@ include(CMakeFindDependencyMacro) set(USE_SYSTEM_TZ_DB @USE_SYSTEM_TZ_DB@) set(BUILD_TZ_LIB @BUILD_TZ_LIB@) +if( MSVC ) + find_dependency( Threads REQUIRED ) +endif( ) + +if( NOT USE_SYSTEM_TZ_DB ) + find_dependency( CURL REQUIRED ) +endif( ) + include("${CMAKE_CURRENT_LIST_DIR}/dateTargets.cmake") From 2d2e28a0f6749f71fa4733c99c4ab4e059bab41d Mon Sep 17 00:00:00 2001 From: Dennis Boerm Date: Tue, 24 Mar 2020 17:06:30 +0100 Subject: [PATCH 5/8] win32: fix convertion --- include/date/iso_week.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/date/iso_week.h b/include/date/iso_week.h index 73c98b2e..8b2d8618 100644 --- a/include/date/iso_week.h +++ b/include/date/iso_week.h @@ -451,7 +451,7 @@ weekday::weekday(unsigned wd) NOEXCEPT CONSTCD11 inline weekday::weekday(date::weekday wd) NOEXCEPT - : wd_(wd.iso_encoding()) + : wd_(static_cast(wd.iso_encoding())) {} CONSTCD11 From 5766df861f885ff1d1b014cd8f868e5c62ec1779 Mon Sep 17 00:00:00 2001 From: Dennis Boerm Date: Thu, 26 Mar 2020 13:53:30 +0100 Subject: [PATCH 6/8] TZ: for windows debug suffix --- CMakeLists.txt | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/CMakeLists.txt b/CMakeLists.txt index d3d36868..2195303e 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -100,6 +100,7 @@ target_compile_definitions( iso_week INTERFACE tz (compiled) library #]===================================================================] if( BUILD_TZ_LIB ) + SET(TZ_DEBUG_POSTFIX d CACHE STRING "Debug library postfix.") add_library( tz ) target_sources( tz PUBLIC @@ -109,6 +110,13 @@ if( BUILD_TZ_LIB ) include/date/tz_private.h $<$:src/ios.mm> src/tz.cpp ) + set_target_properties(tz PROPERTIES DEBUG_POSTFIX "${TZ_DEBUG_POSTFIX}") + + set(TZ_LIB_NAME tz) + if (CMAKE_BUILD_TYPE STREQUAL "Debug") + set(TZ_LIB_NAME ${TZ_LIB_NAME}${TZ_DEBUG_POSTFIX}) + endif() + add_library( date::tz ALIAS tz ) target_link_libraries( tz PUBLIC date ) target_include_directories( tz PUBLIC From a3e00c0e5f706b46d172835806c6efd83982abd7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dennis=20B=C3=B6rm?= Date: Fri, 29 May 2020 19:01:22 +0200 Subject: [PATCH 7/8] thread dependency --- cmake/dateConfig.cmake.in | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/cmake/dateConfig.cmake.in b/cmake/dateConfig.cmake.in index a8641671..46643580 100644 --- a/cmake/dateConfig.cmake.in +++ b/cmake/dateConfig.cmake.in @@ -3,9 +3,7 @@ include(CMakeFindDependencyMacro) set(USE_SYSTEM_TZ_DB @USE_SYSTEM_TZ_DB@) set(BUILD_TZ_LIB @BUILD_TZ_LIB@) -if( MSVC ) - find_dependency( Threads REQUIRED ) -endif( ) +find_dependency( Threads REQUIRED ) if( NOT USE_SYSTEM_TZ_DB ) find_dependency( CURL REQUIRED ) From 5a45eec0c7a4f913b5621975b257ffef084c42f2 Mon Sep 17 00:00:00 2001 From: Dennis Boerm Date: Sun, 22 Nov 2020 04:11:11 +0100 Subject: [PATCH 8/8] update from upstream, add extra target for extra headerfiles --- CMakeLists.txt | 38 +++++++++++++++++++++++++------------- 1 file changed, 25 insertions(+), 13 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index f9f7ea81..31af15c7 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -67,15 +67,20 @@ target_include_directories( date INTERFACE # adding header sources just helps IDEs target_sources( date INTERFACE $$/date/date.h - # the rest of these are not currently part of the public interface of the library: - $ - $ - $ - $ ) + +add_library(extra INTERFACE) +add_library(date::extra ALIAS extra) +target_sources(extra INTERFACE + $$/date/solar_hijri.h + $$/date/islamic.h + $$/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 ) + set_target_properties( date PROPERTIES PUBLIC_HEADER include/date/date.h) + set_target_properties( extra PROPERTIES PUBLIC_HEADER "include/date/islamic.h;include/date/solar_hijri.h;include/date/julian.h") endif () # These used to be set with generator expressions, @@ -166,10 +171,10 @@ if( BUILD_TZ_LIB ) PUBLIC_HEADER "${TZ_HEADERS}" VERSION "${PROJECT_VERSION}" SOVERSION "${ABI_VERSION}" ) - if( NOT MSVC ) - find_package( Threads ) - target_link_libraries( date-tz PUBLIC Threads::Threads ) - endif( ) + + find_package( Threads ) + target_link_libraries( date-tz PUBLIC Threads::Threads ) + if( NOT USE_SYSTEM_TZ_DB AND NOT MANUAL_TZ_DB ) find_package( CURL REQUIRED ) target_include_directories( date-tz SYSTEM PRIVATE ${CURL_INCLUDE_DIRS} ) @@ -192,6 +197,11 @@ install( TARGETS date PUBLIC_HEADER DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/date ) export( TARGETS date NAMESPACE date:: FILE dateTargets.cmake ) +install( TARGETS extra + EXPORT dateTargets + PUBLIC_HEADER DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/date) +export(TARGETS extra NAMESPACE date:: APPEND FILE dateTargets.cmake) + install( TARGETS iso_week EXPORT dateTargets PUBLIC_HEADER DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/date ) @@ -202,6 +212,11 @@ if (CMAKE_VERSION VERSION_LESS 3.15) install( FILES include/date/date.h DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/date ) + + install( + FILES include/date/islamic.h include/date/solar_hijri.h include/date/julian.h + DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/date ) + endif () if( BUILD_TZ_LIB ) @@ -225,9 +240,6 @@ install( EXPORT dateTargets FILE dateTargets.cmake NAMESPACE date:: DESTINATION ${CONFIG_LOC} ) -install ( - FILES cmake/dateConfig.cmake "${version_config}" - DESTINATION ${CONFIG_LOC}) configure_file(cmake/dateConfig.cmake.in dateConfig.cmake @ONLY) install(FILES "${CMAKE_CURRENT_BINARY_DIR}/dateConfig.cmake"