CMake: Force-link clang_rt.profile.a to LibC when building with coverage

This used to be in place until 671712cae6.

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 :^).
This commit is contained in:
Andrew Kaster 2022-12-10 02:59:37 -07:00 committed by Linus Groh
parent bee31d2f90
commit 8356677868

View file

@ -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()