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

前端 未结 5 987
清歌不尽
清歌不尽 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:36

    To change the build type, on Windows, it must be done at build time:

    cmake --build {DIR} --config Release
    

    By default it's Debug. I'm still looking for a way of changing this default. CMAKE_BUILD_TYPE doesn't work of course, and tweaking CMAKE_CONFIGURATION_TYPES doesn't work either, obviously for the same reason, they only apply for Unix makefiles, not for Visual projects.

提交回复
热议问题