From 8356677868ffcefe8e0b4cdbe5ac3af05c61e16f Mon Sep 17 00:00:00 2001 From: Andrew Kaster Date: Sat, 10 Dec 2022 02:59:37 -0700 Subject: [PATCH] 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 :^). --- Meta/CMake/utils.cmake | 3 +++ 1 file changed, 3 insertions(+) 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()