Navigation Menu

Skip to content

Commit

Permalink
Add CMakePresets.json including configuration for sanitizers
Browse files Browse the repository at this point in the history
Only works with modern CMake versions that support the cmake
presets version 3 or higher, i.e. CMake 3.21 or newer.
  • Loading branch information
milianw committed Jun 26, 2022
1 parent ad08de7 commit b448f5b
Show file tree
Hide file tree
Showing 2 changed files with 74 additions and 1 deletion.
4 changes: 3 additions & 1 deletion .clang-format
Expand Up @@ -47,4 +47,6 @@ BinPackParameters: true
#MacroBlockBegin: BEGINTESTFUNCIMPL
#MacroBlockEnd: ENDTESTFUNCIMPL
...

---
Language: Json
DisableFormat: true
71 changes: 71 additions & 0 deletions CMakePresets.json
@@ -0,0 +1,71 @@
{
"version": 3,
"configurePresets": [
{
"name": "dev",
"displayName": "dev",
"description": "Preset for developers",
"generator": "Ninja",
"binaryDir": "${sourceDir}/build-${presetName}",
"cacheVariables": {
"CMAKE_BUILD_TYPE": "Debug",
"CMAKE_EXPORT_COMPILE_COMMANDS": "ON"
}
},
{
"name": "asan",
"cacheVariables": {
"CMAKE_CXX_FLAGS_DEBUG": "-g -fsanitize=address,undefined",
"CMAKE_C_FLAGS_DEBUG": "-g -fsanitize=address,undefined"
}
},
{
"name": "dev-asan",
"displayName": "dev with sanitizers",
"description": "Preset for developers with asan and ubsan enabled",
"inherits": [
"dev",
"asan"
]
},
{
"name": "dev-opt",
"displayName": "dev with optimizations",
"description": "Preset for developers with compiler optimizations enabled",
"cacheVariables": {
"CMAKE_BUILD_TYPE": "RelWithDebInfo",
"CMAKE_CXX_FLAGS" : "-DQT_FORCE_ASSERTS -DQT_MESSAGELOGCONTEXT"
},
"inherits": [
"dev"
]
},
{
"name": "dev-opt-asan",
"displayName": "dev with optimizations and sanitizers",
"description": "Preset for developers with compiler optimizations and sanitizers enabled",
"inherits": [
"dev-opt",
"asan"
]
}
],
"buildPresets": [
{
"name": "dev",
"configurePreset": "dev"
},
{
"name": "dev-asan",
"configurePreset": "dev-asan"
},
{
"name": "dev-opt",
"configurePreset": "dev-opt"
},
{
"name": "dev-opt-asan",
"configurePreset": "dev-opt-asan"
}
]
}

0 comments on commit b448f5b

Please sign in to comment.