summaryrefslogtreecommitdiff
path: root/Userland
diff options
context:
space:
mode:
authorAndrew Kaster <akaster@serenityos.org>2022-10-16 23:49:52 -0600
committerLinus Groh <mail@linusgroh.de>2022-10-17 15:55:55 +0200
commitb8e51425e9fa1f49ce35c7545df2d94af9cf2ced (patch)
treefcad2f949507ac9fbc27d4986453b73bfe837299 /Userland
parent8160b5322863732a401655f49ba8d9d894cb5f38 (diff)
downloadserenity-b8e51425e9fa1f49ce35c7545df2d94af9cf2ced.zip
Lagom+CMake: Propagate dependencies for generated custom targets
We have logic for serenity_generated_sources which works well for source files that are specified in GENERATED_SOURCES prior to calling serenity_lib or serenity_bin. However, code generated with invoke_generator, and the LibWeb generators do not always follow the pattern of the IDL and GML files. For the LibWeb generators, we can just add_dependencies to LibWeb at the time we declare the generate_Foo custom target. However for LibLocale, LibTimeZone, and LibUnicode, we don't have the name of the target available, so export the name in a variable to set into GENERATED_SOURCES. To make this work for Lagom, we need to make sure that lagom_lib and serenity_bin in Lagom/CMakeLists.txt call serenity_generated_sources on the target. This enables the Xcode generator on macOS hosts, at least for Lagom.
Diffstat (limited to 'Userland')
-rw-r--r--Userland/Libraries/LibLocale/CMakeLists.txt3
-rw-r--r--Userland/Libraries/LibTimeZone/CMakeLists.txt2
-rw-r--r--Userland/Libraries/LibUnicode/CMakeLists.txt1
3 files changed, 6 insertions, 0 deletions
diff --git a/Userland/Libraries/LibLocale/CMakeLists.txt b/Userland/Libraries/LibLocale/CMakeLists.txt
index bb5913a443..bbeb1e954a 100644
--- a/Userland/Libraries/LibLocale/CMakeLists.txt
+++ b/Userland/Libraries/LibLocale/CMakeLists.txt
@@ -2,13 +2,16 @@ include(${SerenityOS_SOURCE_DIR}/Meta/CMake/locale_data.cmake)
if (DEFINED LOCALE_DATA_SOURCES)
set(SOURCES ${LOCALE_DATA_SOURCES})
+ set(GENERATED_SOURCES ${CURRENT_LIB_GENERATED})
if (SERENITYOS)
serenity_lib(LibLocaleData localedata)
else()
add_library(LibLocaleData OBJECT ${SOURCES})
+ serenity_generated_sources(LibLocaleData)
endif()
target_compile_options(LibLocaleData PRIVATE -g0 -Os -Wno-parentheses-equality)
target_link_libraries(LibLocaleData LibCore LibTimeZone)
+ unset(GENERATED_SOURCES)
endif()
set(SOURCES
diff --git a/Userland/Libraries/LibTimeZone/CMakeLists.txt b/Userland/Libraries/LibTimeZone/CMakeLists.txt
index b885df29f3..c1e9f992ae 100644
--- a/Userland/Libraries/LibTimeZone/CMakeLists.txt
+++ b/Userland/Libraries/LibTimeZone/CMakeLists.txt
@@ -4,8 +4,10 @@ set(SOURCES
TimeZone.cpp
${TIME_ZONE_DATA_SOURCES}
)
+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.
diff --git a/Userland/Libraries/LibUnicode/CMakeLists.txt b/Userland/Libraries/LibUnicode/CMakeLists.txt
index 96a35f058d..a81a2eb429 100644
--- a/Userland/Libraries/LibUnicode/CMakeLists.txt
+++ b/Userland/Libraries/LibUnicode/CMakeLists.txt
@@ -7,6 +7,7 @@ set(SOURCES
Normalize.cpp
${UNICODE_DATA_SOURCES}
)
+set(GENERATED_SOURCES ${CURRENT_LIB_GENERATED})
serenity_lib(LibUnicode unicode)
target_link_libraries(LibUnicode LibCore)