serenity/Userland/Libraries/LibTimeZone/CMakeLists.txt
Andrew Kaster 78c2fad89c LibTimeZone: Include generated files before checked-in files
This is a rickety solution to a problem when using LibTimeZone as a
static archive, like we do for Android. When pulling symbols from an
archive into a shared library, lld will pick the weak symbols for our
timezone helpers and keep them. Even if there's a strong symbol in
another object file in the same archive, it ignores them. However,
if we make sure that the strong symbols for the generated files are
first in the list, then we avoid the problem altogether by relying
on linker specifics.
2023-09-17 19:22:29 -06:00

18 lines
715 B
CMake

include(${SerenityOS_SOURCE_DIR}/Meta/CMake/time_zone_data.cmake)
set(SOURCES
${TIME_ZONE_DATA_SOURCES}
TimeZone.cpp
)
set(GENERATED_SOURCES ${CURRENT_LIB_GENERATED})
add_library(LibTimeZone OBJECT ${SOURCES})
serenity_generated_sources(LibTimeZone)
target_compile_definitions(LibTimeZone PRIVATE ENABLE_TIME_ZONE_DATA=$<BOOL:${ENABLE_TIME_ZONE_DATABASE_DOWNLOAD}>)
# NOTE: These objects are used by the DynamicLoader, which is always built without coverage instrumentation.
# We could allow them to be instrumented for coverage if DynamicLoader built its own copy
target_link_libraries(LibTimeZone PRIVATE NoCoverage)
if (SERENITYOS)
add_dependencies(LibTimeZone install_libc_headers)
endif()