Howto provide compiler flags in cmake #822
-
Dear All, do we have a unified way how we prescribe compiler flags in cmake? Can anybody explain how to provide compiler flags in cmake? Do we have default compiler flags for debug & release for each compiler? Cheers Aron |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 5 replies
-
Hi Aron, You can specify the following option to compile with debug options : -DCMAKE_BUILD_TYPE=Debug Let us know if you need more help, Cheers, Mickael |
Beta Was this translation helpful? Give feedback.
-
Hey all Example: file: NVToolchain.make # override DEBUG and RELEASE Fortran flags:
set(CMAKE_Fortran_FLAGS_DEBUG "-g -O0 -Mbounds -acc -Minfo=acc -DW3_GPU -ta=tesla,managed" CACHE STRING "")
set(CMAKE_Fortran_FLAGS_RELEASE "-O2 -acc -Minfo=acc -DW3_GPU -ta=tesla,managed" CACHE STRING "") Now call cmake as usual, but with the
Running I guess this is useful as you can have seperate toolchain files for different compiler/system combinations? I thought it would be worth mentioning.... |
Beta Was this translation helpful? Give feedback.
Hi Aron,
You can specify the following option to compile with debug options : -DCMAKE_BUILD_TYPE=Debug
The documentation is still not released, however I've done a tutorial about compilation witch cmake for the training course.
It is available here : https://docs.google.com/document/d/1azvnWsozWDpSo6c7gSFwZVAsqQ5wcpLndsXDXe1W4gY/edit?usp=sharing
Let us know if you need more help,
Cheers,
Mickael