Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
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
- Host: GitHub
- URL: https://github.com/andreicherniaev/cmake-presets-set-compiler-option
- Owner: AndreiCherniaev
- License: apache-2.0
- Created: 2024-06-19T13:50:55.000Z (7 months ago)
- Default Branch: main
- Last Pushed: 2024-06-19T13:51:07.000Z (7 months ago)
- Last Synced: 2024-06-20T00:15:05.668Z (7 months ago)
- Topics: bit-field, compiler, example, warning, wno-packed-bitfield-compat
- Language: CMake
- Homepage: https://stackoverflow.com/questions/41253759/ignoring-note-offset-of-packed-bit-field-without-using-wno-packed-bitfield-co
- Size: 4.88 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
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
```