简体   繁体   中英

How to see which gcc options are use by CMake?

有没有人如何查看默认情况下CMake在调试和发布配置中将gake使用哪些构建标志?

  1. There is cmake-gui , which will print you all variables which are used in your current project.

  2. If you are in the process of building, you can execute make VERBOSE=1 to see the actual commands (including the flags of course)

Turning my comments into an answer

The defaults for GNU are defined in Modules/Compiler/GNU.cmake :

 # Initial configuration flags. string(APPEND CMAKE_${lang}_FLAGS_INIT " ") string(APPEND CMAKE_${lang}_FLAGS_DEBUG_INIT " -g") string(APPEND CMAKE_${lang}_FLAGS_MINSIZEREL_INIT " -Os -DNDEBUG") string(APPEND CMAKE_${lang}_FLAGS_RELEASE_INIT " -O3 -DNDEBUG") string(APPEND CMAKE_${lang}_FLAGS_RELWITHDEBINFO_INIT " -O2 -g -DNDEBUG") 

But the rest really depends on the platform/compiler you are using. So you have to run a CMake "hello world" project to see what is used (see @hellow's answer).

Referencess

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM