From 81f9b000054d64a9a80617caa7ace463272fa06f Mon Sep 17 00:00:00 2001 From: Jakub Jelen Date: Fri, 8 Mar 2024 10:20:38 +0100 Subject: [PATCH] cmake: Use -fprofile-update=atomic to avoid coverage files corruption from threads The gcc should be able to select this automatically based on the presence of -pthread is present on the commandline, but given that we link the tests static, we do not have this? Signed-off-by: Jakub Jelen Reviewed-by: Andreas Schneider --- cmake/Modules/CodeCoverage.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cmake/Modules/CodeCoverage.cmake b/cmake/Modules/CodeCoverage.cmake index c500cfa4..0fd70ae2 100644 --- a/cmake/Modules/CodeCoverage.cmake +++ b/cmake/Modules/CodeCoverage.cmake @@ -164,7 +164,7 @@ foreach(LANG ${LANGUAGES}) endif() endforeach() -set(COVERAGE_COMPILER_FLAGS "-g --coverage" +set(COVERAGE_COMPILER_FLAGS "-g --coverage -fprofile-update=atomic" CACHE INTERNAL "") if(CMAKE_CXX_COMPILER_ID MATCHES "(GNU|Clang)")