I'm trying to add Howard Hinnant's date library as a subdirectory of my build. Here's the simple setup:
$ git clone https://github.com/HowardHinnant/date.git
$ cat CMakeLists.txt
cmake_minimum_required(VERSION 3.18)
project(date_test)
set(BUILD_TZ_LIB ON)
set(USE_SYSTEM_TZ_DB ON)
set(ENABLE_DATE_TESTING OFF)
add_subdirectory(date)
Not much going on here. When I try to configure this build as-is, using cmake 3.18.3, I get a bunch of output like:
CMake Warning (dev) at date/CMakeLists.txt:30 (option):
Policy CMP0077 is not set: option() honors normal variables. Run "cmake
--help-policy CMP0077" for policy details. Use the cmake_policy command to
set the policy and suppress this warning.
For compatibility with older versions of CMake, option is clearing the
normal variable 'USE_SYSTEM_TZ_DB'.
This warning is for project developers. Use -Wno-dev to suppress it.
CMake Warning (dev) at date/CMakeLists.txt:34 (option):
Policy CMP0077 is not set: option() honors normal variables. Run "cmake
--help-policy CMP0077" for policy details. Use the cmake_policy command to
set the policy and suppress this warning.
For compatibility with older versions of CMake, option is clearing the
normal variable 'ENABLE_DATE_TESTING'.
This warning is for project developers. Use -Wno-dev to suppress it.
CMake Warning (dev) at date/CMakeLists.txt:37 (option):
Policy CMP0077 is not set: option() honors normal variables. Run "cmake
--help-policy CMP0077" for policy details. Use the cmake_policy command to
set the policy and suppress this warning.
For compatibility with older versions of CMake, option is clearing the
normal variable 'BUILD_TZ_LIB'.
This warning is for project developers. Use -Wno-dev to suppress it.
# date: USE_SYSTEM_TZ_DB OFF
# date: MANUAL_TZ_DB OFF
# date: USE_TZ_DB_IN_DOT OFF
# date: BUILD_SHARED_LIBS OFF
# date: ENABLE_DATE_TESTING OFF
# date: DISABLE_STRING_VIEW OFF
Notably, my variables got ignored (USE_SYSTEM_TZ_DB is OFF when I want it to be ON).
If I do what the error says, and add cmake_policy(SET CMP0077 NEW), then... I get the exact same thing. Same warning messages about the policy. Same ignoring of the variables I have set.
Is there a way to set these variables and have them propagate into the date build, or do I have to declare these as CACHE INTERNAL variables?