cpp-best-practices / cpp-best-practices/cmake_template
Enable sanitizers globally
- Dominant language
- CMake
- Stars
- 1.8k
- Forks
- 204
- PR merge metrics
- No merged PRs in 30d
Description
My project adds 3rd party dependencies via `FetchContent_Declare`:
```
FetchContent_Declare(
mbedtls
GIT_REPOSITORY https://github.com/Mbed-TLS/mbedtls
GIT_TAG v3.6.5)
FetchContent_MakeAvailable(mbedtls)
add_library(exampleProj main.cpp)
target_link_libraries(exampleProj PUBLIC mbedtls)
add_library(exampleProj_sanitizers INTERFACE)
myproject_enable_sanitizers(exampleProj_sanitizers ON ON ON OFF OFF)
target_link_libraries(exampleProj PUBLIC exampleProj_sanitizers)
```
As you can see, `myproject_enable_sanitizers` only allows me to enable sanitizers for my own code, not for 3rd-party dependencies.
I don't think this is entirely correct. Sanitizers should be used for all code.
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.