How to change the build type to Release mode in cmake?

前端 未结 5 998
清歌不尽
清歌不尽 2020-12-04 10:42

I am trying to build a project in Release mode. By default it is built in debug mode. I am setting the variable CMAKE_BUILD_TYPE to \"Release\" in CMakeLi

5条回答
  •  半阙折子戏
    2020-12-04 11:15

    You cannot set the default build type for Visual Studio from the command line.

    CMake's Visual Studio Generators will generate the four standard profiles (Debug, RelWithDebInfo, MinSizeRel and Release) and you have to choose the one you want to build from within VS. This is because the information about the active configuration is not part of the project files generated by CMake, but part of the .suo file generated by VS.

    If you want an automated build of a particular configuration, use MSBuild instead of VS which allows you to specify a configuration on the command line.

提交回复
热议问题