You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
91 lines
3.5 KiB
91 lines
3.5 KiB
Fixes an compilation error when 'ONLY_C_LOCALE' is used to build the project.
|
|
|
|
Upstream-Bug: https://github.com/HowardHinnant/date/issues/589
|
|
|
|
--- a/CMakeLists.txt
|
|
+++ b/CMakeLists.txt
|
|
@@ -76,10 +76,25 @@ 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 ()
|
|
-target_compile_definitions( date INTERFACE
|
|
- #To workaround libstdc++ issue https://github.com/HowardHinnant/date/issues/388
|
|
- ONLY_C_LOCALE=$<IF:$<BOOL:${COMPILE_WITH_C_LOCALE}>,1,0>
|
|
- $<$<BOOL:${DISABLE_STRING_VIEW}>:HAS_STRING_VIEW=0> )
|
|
+
|
|
+# These used to be set with generator expressions,
|
|
+#
|
|
+# ONLY_C_LOCALE=$<IF:$<BOOL:${COMPILE_WITH_C_LOCALE}>,1,0>
|
|
+#
|
|
+# which expand in the output target file to, e.g.
|
|
+#
|
|
+# ONLY_C_LOCALE=$<IF:$<BOOL:FALSE>,1,0>
|
|
+#
|
|
+# This string is then (somtimes?) not correctly interpreted.
|
|
+if ( COMPILE_WITH_C_LOCALE )
|
|
+ # To workaround libstdc++ issue https://github.com/HowardHinnant/date/issues/388
|
|
+ target_compile_definitions( date INTERFACE ONLY_C_LOCALE=1 )
|
|
+else()
|
|
+ target_compile_definitions( date INTERFACE ONLY_C_LOCALE=0 )
|
|
+endif()
|
|
+if ( DISABLE_STRING_VIEW )
|
|
+ target_compile_definitions( date INTERFACE HAS_STRING_VIEW=0 )
|
|
+endif()
|
|
|
|
#[===================================================================[
|
|
tz (compiled) library
|
|
@@ -89,27 +104,40 @@ if( BUILD_TZ_LIB )
|
|
target_sources( date-tz
|
|
PUBLIC
|
|
$<BUILD_INTERFACE:${CMAKE_CURRENT_LIST_DIR}/include>$<INSTALL_INTERFACE:include>/date/tz.h
|
|
- $<$<BOOL:${IOS}>:$<BUILD_INTERFACE:${CMAKE_CURRENT_LIST_DIR}/include>$<INSTALL_INTERFACE:include>/date/ios.h>
|
|
PRIVATE
|
|
include/date/tz_private.h
|
|
- $<$<BOOL:${IOS}>:src/ios.mm>
|
|
src/tz.cpp )
|
|
+ if ( IOS )
|
|
+ target_sources( date-tz
|
|
+ PUBLIC
|
|
+ $<BUILD_INTERFACE:${CMAKE_CURRENT_LIST_DIR}/include>$<INSTALL_INTERFACE:include>/date/ios.h
|
|
+ PRIVATE
|
|
+ src/ios.mm )
|
|
+ endif()
|
|
add_library( date::tz ALIAS date-tz )
|
|
target_link_libraries( date-tz PUBLIC date )
|
|
target_include_directories( date-tz PUBLIC
|
|
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>
|
|
$<INSTALL_INTERFACE:include> )
|
|
- target_compile_definitions( date-tz
|
|
- PRIVATE
|
|
- AUTO_DOWNLOAD=$<IF:$<OR:$<BOOL:${USE_SYSTEM_TZ_DB}>,$<BOOL:${MANUAL_TZ_DB}>>,0,1>
|
|
- HAS_REMOTE_API=$<IF:$<OR:$<BOOL:${USE_SYSTEM_TZ_DB}>,$<BOOL:${MANUAL_TZ_DB}>>,0,1>
|
|
- $<$<AND:$<BOOL:${WIN32}>,$<BOOL:${BUILD_SHARED_LIBS}>>:DATE_BUILD_DLL=1>
|
|
- $<$<BOOL:${USE_TZ_DB_IN_DOT}>:INSTALL=.>
|
|
- PUBLIC
|
|
- USE_OS_TZDB=$<IF:$<AND:$<BOOL:${USE_SYSTEM_TZ_DB}>,$<NOT:$<BOOL:${WIN32}>>,$<NOT:$<BOOL:${MANUAL_TZ_DB}>>>,1,0>
|
|
- INTERFACE
|
|
- $<$<AND:$<BOOL:${WIN32}>,$<BOOL:${BUILD_SHARED_LIBS}>>:DATE_USE_DLL=1> )
|
|
+
|
|
+ if ( USE_SYSTEM_TZ_DB OR MANUAL_TZ_DB )
|
|
+ target_compile_definitions( date-tz PRIVATE AUTO_DOWNLOAD=0 HAS_REMOTE_API=0 )
|
|
+ else()
|
|
+ target_compile_definitions( date-tz PRIVATE AUTO_DOWNLOAD=1 HAS_REMOTE_API=1 )
|
|
+ endif()
|
|
+
|
|
+ if ( USE_SYSTEM_TZ_DB AND NOT WIN32 AND NOT MANUAL_TZ_DB )
|
|
+ target_compile_definitions( date-tz PRIVATE INSTALL=. PUBLIC USE_OS_TZDB=1 )
|
|
+ else()
|
|
+ target_compile_definitions( date-tz PUBLIC USE_OS_TZDB=0 )
|
|
+ endif()
|
|
+
|
|
+ if ( WIN32 AND BUILD_SHARED_LIBS )
|
|
+ target_compile_definitions( date-tz PUBLIC DATE_BUILD_DLL=1 )
|
|
+ endif()
|
|
+
|
|
set(TZ_HEADERS include/date/tz.h)
|
|
+
|
|
if( IOS )
|
|
list(APPEND TZ_HEADERS include/date/ios.h)
|
|
endif( )
|
|
--
|