Ensure Android private functions dont show up

... for external consumers like tests

Signed-off-by: Vasyl Gello <vasek.gello@gmail.com>
This commit is contained in:
Vasyl Gello 2024-09-29 23:56:04 +03:00 committed by Howard Hinnant
parent 7657ad7855
commit fca69e308d
2 changed files with 9 additions and 4 deletions

View File

@ -112,6 +112,7 @@ endif()
#]===================================================================] #]===================================================================]
if( BUILD_TZ_LIB ) if( BUILD_TZ_LIB )
add_library( date-tz ) add_library( date-tz )
target_compile_definitions( date-tz PRIVATE BUILD_TZ_LIB=1 )
target_sources( date-tz target_sources( date-tz
PUBLIC PUBLIC
$<BUILD_INTERFACE:${CMAKE_CURRENT_LIST_DIR}/include>$<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}>/date/tz.h $<BUILD_INTERFACE:${CMAKE_CURRENT_LIST_DIR}/include>$<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}>/date/tz.h

View File

@ -139,10 +139,12 @@ namespace date
enum class choose {earliest, latest}; enum class choose {earliest, latest};
#if defined(ANDROID) || defined(__ANDROID__) #if defined(BUILD_TZ_LIB)
# if defined(ANDROID) || defined(__ANDROID__)
struct tzdb; struct tzdb;
static std::unique_ptr<tzdb> init_tzdb(); static std::unique_ptr<tzdb> init_tzdb();
#endif // defined(ANDROID) || defined(__ANDROID__) # endif // defined(ANDROID) || defined(__ANDROID__)
#endif // defined(BUILD_TZ_LIB)
namespace detail namespace detail
{ {
@ -827,9 +829,11 @@ public:
#if !USE_OS_TZDB #if !USE_OS_TZDB
DATE_API void add(const std::string& s); DATE_API void add(const std::string& s);
#else #else
#if defined(ANDROID) || defined(__ANDROID__) # if defined(BUILD_TZ_LIB)
# if defined(ANDROID) || defined(__ANDROID__)
friend std::unique_ptr<tzdb> init_tzdb(); friend std::unique_ptr<tzdb> init_tzdb();
#endif // defined(ANDROID) || defined(__ANDROID__) # endif // defined(ANDROID) || defined(__ANDROID__)
# endif // defined(BUILD_TZ_LIB)
#endif // !USE_OS_TZDB #endif // !USE_OS_TZDB
private: private: