summaryrefslogtreecommitdiff
path: root/Meta/CMake
diff options
context:
space:
mode:
authorAndrew Kaster <akaster@serenityos.org>2021-07-27 00:19:08 -0600
committerLinus Groh <mail@linusgroh.de>2021-07-29 21:46:25 +0100
commitde2bf3f333eb85ffe49afcdd0321e03c1d1f7cb6 (patch)
tree1e9c7596950f94cae5e0e48809fe3b27ded9d4ba /Meta/CMake
parentaf9be6e093c571aa9afbbfc6276572bba0aa2ff4 (diff)
downloadserenity-de2bf3f333eb85ffe49afcdd0321e03c1d1f7cb6.zip
Meta/LibTest: Build object libraries for test main files
By using the power of object libraries and $<TARGET_OBJECTS> we can make sure to only build TestMain.cpp and JavaScriptTestRunnerMain.cpp once. Previously we built these cpp files into object files once for every single test executable. This change reduces the number of total compile jobs in a Serenity target build by around 100.
Diffstat (limited to 'Meta/CMake')
-rw-r--r--Meta/CMake/utils.cmake6
1 files changed, 2 insertions, 4 deletions
diff --git a/Meta/CMake/utils.cmake b/Meta/CMake/utils.cmake
index dd4e51869b..942f327ddc 100644
--- a/Meta/CMake/utils.cmake
+++ b/Meta/CMake/utils.cmake
@@ -77,8 +77,7 @@ function(serenity_test test_src sub_dir)
cmake_parse_arguments(SERENITY_TEST "MAIN_ALREADY_DEFINED" "CUSTOM_MAIN" "LIBS" ${ARGN})
set(TEST_SOURCES ${test_src})
if ("${SERENITY_TEST_CUSTOM_MAIN}" STREQUAL "")
- set(SERENITY_TEST_CUSTOM_MAIN
- "${CMAKE_SOURCE_DIR}/Userland/Libraries/LibTest/TestMain.cpp")
+ set(SERENITY_TEST_CUSTOM_MAIN "$<TARGET_OBJECTS:LibTestMain>")
endif()
if (NOT ${SERENITY_TEST_MAIN_ALREADY_DEFINED})
list(PREPEND TEST_SOURCES "${SERENITY_TEST_CUSTOM_MAIN}")
@@ -98,8 +97,7 @@ endfunction()
function(serenity_testjs_test test_src sub_dir)
cmake_parse_arguments(SERENITY_TEST "" "CUSTOM_MAIN" "LIBS" ${ARGN})
if ("${SERENITY_TEST_CUSTOM_MAIN}" STREQUAL "")
- set(SERENITY_TEST_CUSTOM_MAIN
- "${CMAKE_SOURCE_DIR}/Userland/Libraries/LibTest/JavaScriptTestRunnerMain.cpp")
+ set(SERENITY_TEST_CUSTOM_MAIN "$<TARGET_OBJECTS:JavaScriptTestRunnerMain>")
endif()
list(APPEND SERENITY_TEST_LIBS LibJS LibCore)
serenity_test(${test_src} ${sub_dir}