]> git.pld-linux.org Git - packages/date.git/blob - date-cmake.patch
6fe4de6db5ab20eb10a7953bf6388dd0350af2ab
[packages/date.git] / date-cmake.patch
1 From a6243ce56f6a3781fc2ef18054a718f196591aed Mon Sep 17 00:00:00 2001
2 From: Michael Ellery <mellery451@gmail.com>
3 Date: Mon, 22 Jun 2020 08:48:09 -0700
4 Subject: [PATCH] set cmake proj ver to 3.0: (#584)
5
6 FIXES: #583
7 ---
8  CMakeLists.txt | 4 ++--
9  1 file changed, 2 insertions(+), 2 deletions(-)
10
11 diff --git a/CMakeLists.txt b/CMakeLists.txt
12 index ad749004..76b074ce 100644
13 --- a/CMakeLists.txt
14 +++ b/CMakeLists.txt
15 @@ -7,7 +7,7 @@
16       include( FetchContent )
17       FetchContent_Declare( date_src
18         GIT_REPOSITORY https://github.com/HowardHinnant/date.git
19 -       GIT_TAG        2.4.2  # adjust tag/branch/commit as needed
20 +       GIT_TAG        v3.0.0  # adjust tag/branch/commit as needed
21       )
22       FetchContent_MakeAvailable(date_src)
23       ...
24 @@ -17,7 +17,7 @@
25  
26  cmake_minimum_required( VERSION 3.7 )
27  
28 -project( date VERSION 2.4.1 )
29 +project( date VERSION 3.0.0 )
30  
31  include( GNUInstallDirs )
32  
33 From 9537addfc4f4b237d50a3502e07fcc492f98d8cc Mon Sep 17 00:00:00 2001
34 From: =?UTF-8?q?Nico=20Schl=C3=B6mer?= <nico.schloemer@gmail.com>
35 Date: Thu, 23 Jul 2020 01:03:42 +0200
36 Subject: [PATCH] fix ONLY_C_LOCALE export from cmake (#590)
37
38 * fix ONLY_C_LOCALE export from cmake
39
40 * add some comments
41
42 * remove all generator expressions for target output
43
44 * cmake: fewer variables, make it easier to read
45 ---
46  CMakeLists.txt | 60 ++++++++++++++++++++++++++++++++++++--------------
47  1 file changed, 44 insertions(+), 16 deletions(-)
48
49 diff --git a/CMakeLists.txt b/CMakeLists.txt
50 index 76b074ce..ebe2bcef 100644
51 --- a/CMakeLists.txt
52 +++ b/CMakeLists.txt
53 @@ -76,10 +76,25 @@ if (CMAKE_VERSION VERSION_GREATER_EQUAL 3.15)
54      # public headers will get installed:
55      set_target_properties( date PROPERTIES PUBLIC_HEADER include/date/date.h )
56  endif ()
57 -target_compile_definitions( date INTERFACE
58 -    #To workaround libstdc++ issue https://github.com/HowardHinnant/date/issues/388
59 -    ONLY_C_LOCALE=$<IF:$<BOOL:${COMPILE_WITH_C_LOCALE}>,1,0>
60 -    $<$<BOOL:${DISABLE_STRING_VIEW}>:HAS_STRING_VIEW=0> )
61 +
62 +# These used to be set with generator expressions,
63 +#
64 +#   ONLY_C_LOCALE=$<IF:$<BOOL:${COMPILE_WITH_C_LOCALE}>,1,0>
65 +#
66 +# which expand in the output target file to, e.g.
67 +#
68 +#   ONLY_C_LOCALE=$<IF:$<BOOL:FALSE>,1,0>
69 +#
70 +# This string is then (somtimes?) not correctly interpreted.
71 +if ( COMPILE_WITH_C_LOCALE )
72 +  # To workaround libstdc++ issue https://github.com/HowardHinnant/date/issues/388
73 +  target_compile_definitions( date INTERFACE ONLY_C_LOCALE=1 )
74 +else()
75 +  target_compile_definitions( date INTERFACE ONLY_C_LOCALE=0 )
76 +endif()
77 +if ( DISABLE_STRING_VIEW )
78 +  target_compile_definitions( date INTERFACE HAS_STRING_VIEW=0 )
79 +endif()
80  
81  #[===================================================================[
82     tz (compiled) library
83 @@ -89,27 +104,40 @@ if( BUILD_TZ_LIB )
84      target_sources( date-tz
85        PUBLIC
86          $<BUILD_INTERFACE:${CMAKE_CURRENT_LIST_DIR}/include>$<INSTALL_INTERFACE:include>/date/tz.h
87 -        $<$<BOOL:${IOS}>:$<BUILD_INTERFACE:${CMAKE_CURRENT_LIST_DIR}/include>$<INSTALL_INTERFACE:include>/date/ios.h>
88        PRIVATE
89          include/date/tz_private.h
90 -        $<$<BOOL:${IOS}>:src/ios.mm>
91          src/tz.cpp )
92 +    if ( IOS )
93 +      target_sources( date-tz
94 +        PUBLIC
95 +          $<BUILD_INTERFACE:${CMAKE_CURRENT_LIST_DIR}/include>$<INSTALL_INTERFACE:include>/date/ios.h
96 +        PRIVATE
97 +          src/ios.mm )
98 +    endif()
99      add_library( date::tz ALIAS date-tz )
100      target_link_libraries( date-tz PUBLIC date )
101      target_include_directories( date-tz PUBLIC
102          $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>
103          $<INSTALL_INTERFACE:include> )
104 -    target_compile_definitions( date-tz
105 -        PRIVATE
106 -            AUTO_DOWNLOAD=$<IF:$<OR:$<BOOL:${USE_SYSTEM_TZ_DB}>,$<BOOL:${MANUAL_TZ_DB}>>,0,1>
107 -            HAS_REMOTE_API=$<IF:$<OR:$<BOOL:${USE_SYSTEM_TZ_DB}>,$<BOOL:${MANUAL_TZ_DB}>>,0,1>
108 -            $<$<AND:$<BOOL:${WIN32}>,$<BOOL:${BUILD_SHARED_LIBS}>>:DATE_BUILD_DLL=1>
109 -            $<$<BOOL:${USE_TZ_DB_IN_DOT}>:INSTALL=.>
110 -        PUBLIC
111 -            USE_OS_TZDB=$<IF:$<AND:$<BOOL:${USE_SYSTEM_TZ_DB}>,$<NOT:$<BOOL:${WIN32}>>,$<NOT:$<BOOL:${MANUAL_TZ_DB}>>>,1,0>
112 -        INTERFACE
113 -            $<$<AND:$<BOOL:${WIN32}>,$<BOOL:${BUILD_SHARED_LIBS}>>:DATE_USE_DLL=1> )
114 +
115 +    if ( USE_SYSTEM_TZ_DB OR MANUAL_TZ_DB )
116 +      target_compile_definitions( date-tz PRIVATE AUTO_DOWNLOAD=0 HAS_REMOTE_API=0 )
117 +    else()
118 +      target_compile_definitions( date-tz PRIVATE AUTO_DOWNLOAD=1 HAS_REMOTE_API=1 )
119 +    endif()
120 +
121 +    if ( USE_SYSTEM_TZ_DB AND NOT WIN32 AND NOT MANUAL_TZ_DB )
122 +      target_compile_definitions( date-tz PRIVATE INSTALL=. PUBLIC USE_OS_TZDB=1 )
123 +    else()
124 +      target_compile_definitions( date-tz PUBLIC USE_OS_TZDB=0 )
125 +    endif()
126 +
127 +    if ( WIN32 AND BUILD_SHARED_LIBS )
128 +      target_compile_definitions( date-tz PUBLIC DATE_BUILD_DLL=1 )
129 +    endif()
130 +
131      set(TZ_HEADERS include/date/tz.h)
132 +
133      if( IOS )
134          list(APPEND TZ_HEADERS include/date/ios.h)
135      endif( )
136 From 313189b0a8767f9964704cfc87fe5956e12abc24 Mon Sep 17 00:00:00 2001
137 From: Michael Ellery <mellery451@gmail.com>
138 Date: Tue, 25 Aug 2020 13:57:00 -0700
139 Subject: [PATCH] Correct lingering references to bare "tz" libname: (#600)
140
141 Fixes: #599
142 ---
143  CMakeLists.txt         | 7 ++++---
144  cmake/dateConfig.cmake | 4 ++--
145  2 files changed, 6 insertions(+), 5 deletions(-)
146
147 diff --git a/CMakeLists.txt b/CMakeLists.txt
148 index ebe2bcef..d0baf600 100644
149 --- a/CMakeLists.txt
150 +++ b/CMakeLists.txt
151 @@ -18,6 +18,7 @@
152  cmake_minimum_required( VERSION 3.7 )
153  
154  project( date VERSION 3.0.0 )
155 +set(ABI_VERSION 3) # used as SOVERSION, increment when ABI changes
156  
157  include( GNUInstallDirs )
158  
159 @@ -114,7 +115,7 @@ if( BUILD_TZ_LIB )
160          PRIVATE
161            src/ios.mm )
162      endif()
163 -    add_library( date::tz ALIAS date-tz )
164 +    add_library( date::date-tz ALIAS date-tz )
165      target_link_libraries( date-tz PUBLIC date )
166      target_include_directories( date-tz PUBLIC
167          $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>
168 @@ -145,7 +146,7 @@ if( BUILD_TZ_LIB )
169          POSITION_INDEPENDENT_CODE ON
170          PUBLIC_HEADER "${TZ_HEADERS}"
171          VERSION "${PROJECT_VERSION}"
172 -        SOVERSION "${PROJECT_VERSION}" )
173 +        SOVERSION "${ABI_VERSION}" )
174      if( NOT MSVC )
175          find_package( Threads )
176          target_link_libraries( date-tz PUBLIC Threads::Threads )
177 @@ -250,7 +251,7 @@ if( ENABLE_DATE_TESTING )
178                      ${CMAKE_CXX_COMPILER}
179                      -std=c++14
180                      -L${CMAKE_BINARY_DIR}/
181 -                    -ltz
182 +                    -ldate-tz
183                      -I${PROJECT_SOURCE_DIR}/include
184                      -I${PROJECT_SOURCE_DIR}/include/date
185                      -o ${BIN_NAME}
186 diff --git a/cmake/dateConfig.cmake b/cmake/dateConfig.cmake
187 index 20f86e8d..2198ad1a 100644
188 --- a/cmake/dateConfig.cmake
189 +++ b/cmake/dateConfig.cmake
190 @@ -1,8 +1,8 @@
191  include( CMakeFindDependencyMacro )
192  include( "${CMAKE_CURRENT_LIST_DIR}/dateTargets.cmake" )
193 -if( NOT MSVC AND TARGET date::tz )
194 +if( NOT MSVC AND TARGET date::date-tz )
195      find_dependency( Threads REQUIRED)
196 -    get_target_property( _tzill date::tz  INTERFACE_LINK_LIBRARIES )
197 +    get_target_property( _tzill date::date-tz  INTERFACE_LINK_LIBRARIES )
198      if( _tzill AND "${_tzill}" MATCHES "libcurl" )
199          find_dependency( CURL )
200      endif( )
This page took 0.042109 seconds and 2 git commands to generate.