有没有人如何查看默认情况下CMake在调试和发布配置中将gake使用哪些构建标志?
There is cmake-gui , which will print you all variables which are used in your current project.
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.