That’s because no build type has been specified to CMake. The build type is a feature most IDE have, it allows you to compile your program in “debug” mode, for easily single-stepping through it with a debugger, or in “release” mode, with speed optimization enabled.
To fix this you simply need to specify a build type in the CMakeLists.txt file, in this way:
if( NOT CMAKE_BUILD_TYPE )
set( CMAKE_BUILD_TYPE Debug CACHE STRING
"Choose the type of build, options are: None Debug Release RelWithDebInfo
MinSizeRel."
FORCE )
endif()
when cmake is run without specifying the build type using -D CMAKE_BUILD_TYPE, it is the Debug mode that is selected as the default.
本文详细解释了在CMake环境中遇到未指定构建类型时的常见问题,并提供了解决方法,帮助开发者在不同的开发阶段选择合适的构建模式,如用于调试的Debug模式和用于发布产品的Release模式。
980

被折叠的 条评论
为什么被折叠?



