Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,10 @@ option( ENABLE_DATE_TESTING "Enable unit tests" OFF )
option( DISABLE_STRING_VIEW "Disable string view" OFF )
option( COMPILE_WITH_C_LOCALE "define ONLY_C_LOCALE=1" OFF )
option( BUILD_TZ_LIB "build/install of TZ library" OFF )
# Only works when MANUAL_TZ_DB = ON
option( USE_CUSTOM_TZDB_INSTALL_PATH "Use a custom path for finding the tzdata folder" OFF )
# The location of the database is CUSTOM_TZDB_INSTALL_PATH/tzdata (CUSTOM_TZDB_INSTALL_PATH\tzdata on Windows)
set(CUSTOM_TZDB_INSTALL_PATH ".")

if( ENABLE_DATE_TESTING AND NOT BUILD_TZ_LIB )
message(WARNING "Testing requested, bug BUILD_TZ_LIB not ON - forcing the latter")
Expand All @@ -55,6 +59,10 @@ print_option( USE_TZ_DB_IN_DOT )
print_option( BUILD_SHARED_LIBS )
print_option( ENABLE_DATE_TESTING )
print_option( DISABLE_STRING_VIEW )
print_option( USE_CUSTOM_TZDB_INSTALL_PATH )
if(USE_CUSTOM_TZDB_INSTALL_PATH)
message("# date: CUSTOM_TZDB_INSTALL_PATH ${CUSTOM_TZDB_INSTALL_PATH}")
endif()

#[===================================================================[
date (header only) library
Expand Down Expand Up @@ -96,6 +104,9 @@ endif()
if ( DISABLE_STRING_VIEW )
target_compile_definitions( date INTERFACE HAS_STRING_VIEW=0 -DHAS_DEDUCTION_GUIDES=0 )
endif()
if ( USE_CUSTOM_TZDB_INSTALL_PATH )

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shouldn't be this in the

if( BUILD_TZ_LIB )

block?

I would put it in this line:

     if ( USE_SYSTEM_TZ_DB AND NOT WIN32 AND NOT MANUAL_TZ_DB )
         target_compile_definitions( date-tz PRIVATE PUBLIC USE_OS_TZDB=1 )
     else()
          target_compile_definitions( date-tz PUBLIC INSTALL=${USE_CUSTOM_TZDB_INSTALL_PATH} USE_OS_TZDB=0 )
     endif()

Se how I removed the other: INSTALL=. together with USE_OS_TZDB, that is IMHO an error, will not be considered

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh yeah, I should move it.

target_compile_definitions( date INTERFACE INSTALL=${CUSTOM_TZDB_INSTALL_PATH} )
endif()

#[===================================================================[
tz (compiled) library
Expand Down