Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/andreicherniaev/cmake-presets-set-compiler-option


https://github.com/andreicherniaev/cmake-presets-set-compiler-option

bit-field compiler example warning wno-packed-bitfield-compat

Last synced: about 1 month ago
JSON representation

Awesome Lists containing this project

README

        

You can set compiler option or disable compiler warning using two ways.
## CMakeLists.txt way
Add string like this. Note that you should add it after add_executable().
```
target_compile_options(${PROJECT_NAME} PRIVATE -Wno-packed-bitfield-compat)
```

## CMakePresets.json way
Make CMakePresets.json and add
```
"cacheVariables": {
"CMAKE_CXX_FLAGS": "-Wno-packed-bitfield-compat"
}
```
And build your project
```
cmake -S src/ -DCMAKE_BUILD_TYPE=Release --preset "HabrPresetName"
cmake --build build/ --parallel
```