From fca69e308d25759a144b933ab231229fa48967e8 Mon Sep 17 00:00:00 2001 From: Vasyl Gello Date: Sun, 29 Sep 2024 23:56:04 +0300 Subject: [PATCH] Ensure Android private functions dont show up ... for external consumers like tests Signed-off-by: Vasyl Gello --- CMakeLists.txt | 1 + include/date/tz.h | 12 ++++++++---- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index be0acc0..9b4bb20 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -112,6 +112,7 @@ endif() #]===================================================================] if( BUILD_TZ_LIB ) add_library( date-tz ) + target_compile_definitions( date-tz PRIVATE BUILD_TZ_LIB=1 ) target_sources( date-tz PUBLIC $$/date/tz.h diff --git a/include/date/tz.h b/include/date/tz.h index e2def47..f056849 100644 --- a/include/date/tz.h +++ b/include/date/tz.h @@ -139,10 +139,12 @@ namespace date enum class choose {earliest, latest}; -#if defined(ANDROID) || defined(__ANDROID__) +#if defined(BUILD_TZ_LIB) +# if defined(ANDROID) || defined(__ANDROID__) struct tzdb; static std::unique_ptr init_tzdb(); -#endif // defined(ANDROID) || defined(__ANDROID__) +# endif // defined(ANDROID) || defined(__ANDROID__) +#endif // defined(BUILD_TZ_LIB) namespace detail { @@ -827,9 +829,11 @@ public: #if !USE_OS_TZDB DATE_API void add(const std::string& s); #else -#if defined(ANDROID) || defined(__ANDROID__) +# if defined(BUILD_TZ_LIB) +# if defined(ANDROID) || defined(__ANDROID__) friend std::unique_ptr init_tzdb(); -#endif // defined(ANDROID) || defined(__ANDROID__) +# endif // defined(ANDROID) || defined(__ANDROID__) +# endif // defined(BUILD_TZ_LIB) #endif // !USE_OS_TZDB private: