Skip to content
Snippets Groups Projects

Document how to choose compiler and set flags

Merged Vladimir Onoprienko requested to merge doc-conf-compiler into main
1 file
+ 18
0
Compare changes
  • Side-by-side
  • Inline
+ 18
0
@@ -127,3 +127,21 @@ Intel C++ Compiler should be used with `NMake Makefiles`, MinGW C++ should be us
```
cmake -B . -S ../exple-cmake-build -G"Visual Studio 17 2022"
```
### Choosing a compiler and setting compiler options
To choose a compiler use *CMAKE_CXX_COMPILER* variable when configuring cmake build. For setting options to be passed to compiler during build use *CMAKE_CXX_FLAGS* variable.
If you have *icc* on path, i.e.
```
icc --version
```
returns the version number then you can select it as a compiler for building this project with
```
cmake -B . -S ../exple-cmake-build -DCMAKE_CXX_COMPILER=icc
```
To specify compilation options, e.g. *-fno-align-loops* and *-fno-align-loops*
```
cmake -B . -S ../exple-cmake-build -DCMAKE_CXX_COMPILER=icc -DCMAKE_CXX_FLAGS="-fno-align-loops -fno-align-loops"
```
Loading