build(cmake): always mark HAS_STRING_VIEW as part…

…of the interface

If the library gets compiled with HAS_STRING_VIEW=1, consumers always
need to link to the functions using std::string_view, as they are the
only ones compiled into the shared library.

You can find a longer explanation here:
<https://github.com/HowardHinnant/date/pull/754#issuecomment-1361248007>
This commit is contained in:
Andrea Pappacoda 2022-12-21 16:44:08 +01:00 committed by Howard Hinnant
parent dc9d161607
commit cf8f25b183

View File

@ -100,6 +100,8 @@ else()
endif() endif()
if ( DISABLE_STRING_VIEW ) if ( DISABLE_STRING_VIEW )
target_compile_definitions( date INTERFACE HAS_STRING_VIEW=0 -DHAS_DEDUCTION_GUIDES=0 ) target_compile_definitions( date INTERFACE HAS_STRING_VIEW=0 -DHAS_DEDUCTION_GUIDES=0 )
else()
target_compile_definitions( date INTERFACE HAS_STRING_VIEW=1 )
endif() endif()
#[===================================================================[ #[===================================================================[