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

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

    Use it as you do it but in the root cmake file add the following before the project keyword

    SET(CMAKE_CONFIGURATION_TYPES ${CMAKE_BUILD_TYPE} CACHE STRING "" FORCE)
    PROJECT(MY_PROJECT)#It's here just to show where you should add it.
    

提交回复
热议问题