From ce2f1b845fbd94013e36377aaa7375466cf1241d Mon Sep 17 00:00:00 2001 From: Tim Schumacher Date: Fri, 21 Oct 2022 21:43:56 +0200 Subject: Everywhere: Mark dependencies of most targets as PRIVATE Otherwise, we end up propagating those dependencies into targets that link against that library, which creates unnecessary link-time dependencies. Also included are changes to readd now missing dependencies to tools that actually need them. --- Tests/Kernel/CMakeLists.txt | 4 +++- Tests/LibCore/CMakeLists.txt | 4 ++-- Tests/LibELF/CMakeLists.txt | 4 ++-- Tests/LibGL/CMakeLists.txt | 2 +- Tests/LibGfx/CMakeLists.txt | 2 +- Tests/LibJS/CMakeLists.txt | 12 ++++++------ Tests/UserspaceEmulator/CMakeLists.txt | 2 +- 7 files changed, 16 insertions(+), 14 deletions(-) (limited to 'Tests') diff --git a/Tests/Kernel/CMakeLists.txt b/Tests/Kernel/CMakeLists.txt index a91b4e0979..d411a8091c 100644 --- a/Tests/Kernel/CMakeLists.txt +++ b/Tests/Kernel/CMakeLists.txt @@ -25,11 +25,13 @@ set(TEST_SOURCES foreach(source IN LISTS TEST_SOURCES) get_filename_component(test_name "${source}" NAME_WE) add_executable("${test_name}" "${source}") - target_link_libraries("${test_name}" LibCore) + target_link_libraries("${test_name}" PRIVATE LibCore) serenity_set_implicit_links("${test_name}") install(TARGETS "${test_name}" RUNTIME DESTINATION usr/Tests/Kernel/Legacy) endforeach() +target_link_libraries(fuzz-syscalls PRIVATE LibSystem) + serenity_test("crash.cpp" Kernel MAIN_ALREADY_DEFINED) set(LIBTEST_BASED_SOURCES diff --git a/Tests/LibCore/CMakeLists.txt b/Tests/LibCore/CMakeLists.txt index e099250646..dd5aed2943 100644 --- a/Tests/LibCore/CMakeLists.txt +++ b/Tests/LibCore/CMakeLists.txt @@ -13,7 +13,7 @@ foreach(source IN LISTS TEST_SOURCES) endforeach() # NOTE: Required because of the LocalServer tests -target_link_libraries(TestLibCoreStream LibThreading) -target_link_libraries(TestLibCoreSharedSingleProducerCircularQueue LibThreading) +target_link_libraries(TestLibCoreStream PRIVATE LibThreading) +target_link_libraries(TestLibCoreSharedSingleProducerCircularQueue PRIVATE LibThreading) install(FILES long_lines.txt 10kb.txt small.txt DESTINATION usr/Tests/LibCore) diff --git a/Tests/LibELF/CMakeLists.txt b/Tests/LibELF/CMakeLists.txt index 7939865761..b417824fac 100644 --- a/Tests/LibELF/CMakeLists.txt +++ b/Tests/LibELF/CMakeLists.txt @@ -3,7 +3,7 @@ macro(add_dlopen_lib NAME FUNCTION) add_library(${NAME} SHARED Dynlib.cpp) target_compile_definitions(${NAME} PRIVATE -DFUNCTION=${FUNCTION}) # LibLine is not special, just an "external" dependency - target_link_libraries(${NAME} LibLine) + target_link_libraries(${NAME} PRIVATE LibLine) serenity_set_implicit_links(${NAME}) # Avoid execution by the test runner install(TARGETS ${NAME} @@ -16,7 +16,7 @@ add_dlopen_lib(DynlibB dynlibb_function) add_dlopen_lib(DynlibC dynlibc_function) set(CMAKE_INSTALL_RPATH $ORIGIN) add_dlopen_lib(DynlibD dynlibd_function) -target_link_libraries(DynlibD DynlibC) +target_link_libraries(DynlibD PRIVATE DynlibC) unset(CMAKE_INSTALL_RPATH) set(TEST_SOURCES diff --git a/Tests/LibGL/CMakeLists.txt b/Tests/LibGL/CMakeLists.txt index 02e5440530..7bfaca0e01 100644 --- a/Tests/LibGL/CMakeLists.txt +++ b/Tests/LibGL/CMakeLists.txt @@ -4,7 +4,7 @@ set(TEST_SOURCES ) foreach(source IN LISTS TEST_SOURCES) - serenity_test("${source}" LibGL LIBS LibCore LibGL) + serenity_test("${source}" LibGL LIBS LibCore LibGfx LibGL) endforeach() install(DIRECTORY reference-images DESTINATION usr/Tests/LibGL) diff --git a/Tests/LibGfx/CMakeLists.txt b/Tests/LibGfx/CMakeLists.txt index e60333f25f..67a4650f5c 100644 --- a/Tests/LibGfx/CMakeLists.txt +++ b/Tests/LibGfx/CMakeLists.txt @@ -5,7 +5,7 @@ set(TEST_SOURCES ) foreach(source IN LISTS TEST_SOURCES) - serenity_test("${source}" LibGfx LIBS LibGUI) + serenity_test("${source}" LibGfx LIBS LibGfx LibGUI) endforeach() install(FILES TestFont.font DESTINATION usr/Tests/LibGfx) diff --git a/Tests/LibJS/CMakeLists.txt b/Tests/LibJS/CMakeLists.txt index 0f8b6ffddb..20d42a2a1c 100644 --- a/Tests/LibJS/CMakeLists.txt +++ b/Tests/LibJS/CMakeLists.txt @@ -1,15 +1,15 @@ -serenity_testjs_test(test-js.cpp test-js) +serenity_testjs_test(test-js.cpp test-js LIBS LibLocale) install(TARGETS test-js RUNTIME DESTINATION bin OPTIONAL) link_with_locale_data(test-js) -serenity_test(test-invalid-unicode-js.cpp LibJS LIBS LibJS) +serenity_test(test-invalid-unicode-js.cpp LibJS LIBS LibJS LibLocale) link_with_locale_data(test-invalid-unicode-js) -serenity_test(test-bytecode-js.cpp LibJS LIBS LibJS) +serenity_test(test-bytecode-js.cpp LibJS LIBS LibJS LibLocale) link_with_locale_data(test-bytecode-js) -serenity_test(test-value-js.cpp LibJS LIBS LibJS) +serenity_test(test-value-js.cpp LibJS LIBS LibJS LibLocale) link_with_locale_data(test-value-js) serenity_component( @@ -17,7 +17,7 @@ serenity_component( TARGETS test262-runner ) add_executable(test262-runner test262-runner.cpp) -target_link_libraries(test262-runner LibJS LibCore) +target_link_libraries(test262-runner PRIVATE LibJS LibCore LibLocale) serenity_set_implicit_links(test262-runner) link_with_locale_data(test262-runner) install(TARGETS test262-runner RUNTIME DESTINATION bin OPTIONAL) @@ -27,6 +27,6 @@ serenity_component( TARGETS test-test262 ) add_executable(test-test262 test-test262.cpp) -target_link_libraries(test-test262 LibMain LibCore) +target_link_libraries(test-test262 PRIVATE LibMain LibCore) serenity_set_implicit_links(test-test262) install(TARGETS test-test262 RUNTIME DESTINATION bin OPTIONAL) diff --git a/Tests/UserspaceEmulator/CMakeLists.txt b/Tests/UserspaceEmulator/CMakeLists.txt index 621423ac13..7374bde38a 100644 --- a/Tests/UserspaceEmulator/CMakeLists.txt +++ b/Tests/UserspaceEmulator/CMakeLists.txt @@ -7,7 +7,7 @@ set(TEST_SOURCES foreach(source IN LISTS TEST_SOURCES) get_filename_component(test_name "${source}" NAME_WE) add_executable("${test_name}" "${source}") - target_link_libraries("${test_name}" LibCore) + target_link_libraries("${test_name}" PRIVATE LibCore) serenity_set_implicit_links("${test_name}") install(TARGETS "${test_name}" RUNTIME DESTINATION usr/Tests/UserEmulator) endforeach() -- cgit v1.2.3