summaryrefslogtreecommitdiff
path: root/Meta/CMake/utils.cmake
diff options
context:
space:
mode:
authorAndrew Kaster <akaster@serenityos.org>2022-12-10 02:59:37 -0700
committerLinus Groh <mail@linusgroh.de>2022-12-10 11:51:16 +0000
commit8356677868ffcefe8e0b4cdbe5ac3af05c61e16f (patch)
treea658f782e348452909619c3f4c8e262de76a7730 /Meta/CMake/utils.cmake
parentbee31d2f909aba2d95ec0fc01c20f9b845608c95 (diff)
downloadserenity-8356677868ffcefe8e0b4cdbe5ac3af05c61e16f.zip
CMake: Force-link clang_rt.profile.a to LibC when building with coverage
This used to be in place until 671712cae67d7b8782afa94c09e980a77450efd6. I had commented on that PR that "yeah should be good to remove". Turns out that's not the case. A future patch to the clang driver might make this obsolete :^).
Diffstat (limited to 'Meta/CMake/utils.cmake')
-rw-r--r--Meta/CMake/utils.cmake3
1 files changed, 3 insertions, 0 deletions
diff --git a/Meta/CMake/utils.cmake b/Meta/CMake/utils.cmake
index e7bc340580..290f74fc9c 100644
--- a/Meta/CMake/utils.cmake
+++ b/Meta/CMake/utils.cmake
@@ -89,6 +89,9 @@ function(serenity_libc target_name fs_name)
# Avoid creating a dependency cycle between system libraries and the C++ standard library. This is necessary
# to ensure that initialization functions will be called in the right order (libc++ must come after LibPthread).
target_link_options(${target_name} PRIVATE -static-libstdc++)
+ if (CMAKE_CXX_COMPILER_ID MATCHES "Clang$" AND ENABLE_USERSPACE_COVERAGE_COLLECTION)
+ target_link_libraries(${target_name} PRIVATE clang_rt.profile)
+ endif()
target_link_directories(LibC PUBLIC ${CMAKE_CURRENT_BINARY_DIR})
serenity_generated_sources(${target_name})
endfunction()