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=$,1,0> - $<$:HAS_STRING_VIEW=0> ) + +# These used to be set with generator expressions, +# +# ONLY_C_LOCALE=$,1,0> +# +# which expand in the output target file to, e.g. +# +# ONLY_C_LOCALE=$,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 $$/date/tz.h - $<$:$$/date/ios.h> PRIVATE include/date/tz_private.h - $<$:src/ios.mm> src/tz.cpp ) + if ( IOS ) + target_sources( date-tz + PUBLIC + $$/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 $ $ ) - target_compile_definitions( date-tz - PRIVATE - AUTO_DOWNLOAD=$,$>,0,1> - HAS_REMOTE_API=$,$>,0,1> - $<$,$>:DATE_BUILD_DLL=1> - $<$:INSTALL=.> - PUBLIC - USE_OS_TZDB=$,$>,$>>,1,0> - INTERFACE - $<$,$>: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( ) --