build: disable fuzztest when building with TSAN

fuzztest's coverage instrumentation is incompatible with Thread
Sanitizer. Add px4_setup_gtest_without_fuzztest() macro to
cmake/px4_add_gtest.cmake that fetches GTest standalone and stubs out
fuzztest cmake functions. Guard all fuzztest-specific code on
TARGET fuzztest::fuzztest so it compiles cleanly without fuzztest.
This commit is contained in:
Julian Oes
2026-02-19 05:43:44 +13:00
parent 64ddfebfc6
commit 5dbf62cd11
6 changed files with 79 additions and 35 deletions
+9 -5
View File
@@ -1,8 +1,12 @@
px4_add_git_submodule(TARGET git_fuzztest PATH "fuzztest")
message(STATUS "Adding fuzztest")
# This will also add GTest
add_subdirectory(fuzztest EXCLUDE_FROM_ALL)
if(CMAKE_BUILD_TYPE STREQUAL "ThreadSanitizer")
message(STATUS "TSAN build: skipping fuzztest, fetching GTest only")
px4_setup_gtest_without_fuzztest()
else()
px4_add_git_submodule(TARGET git_fuzztest PATH "fuzztest")
message(STATUS "Adding fuzztest")
# This will also add GTest
add_subdirectory(fuzztest EXCLUDE_FROM_ALL)
endif()
# Ensure there's no -R without any filter expression since that trips newer ctest versions
if(TESTFILTER)