Anonymous

Difference between revisions of "CMake"

From dankwiki
2 bytes removed ,  05:00, 6 May 2020
jfc
(jfc)
Line 11: Line 11:
If <tt>CMAKE_BUILD_TYPE</tt> is not provided, none of these is used -- no debugging flags are set, and no optimization flags are set, in a somewhat stunning bit of unexpected behavior. The following snippet will ensure a default of RelWithDebInfo, and allow the value to be selected from a set in the gui:
If <tt>CMAKE_BUILD_TYPE</tt> is not provided, none of these is used -- no debugging flags are set, and no optimization flags are set, in a somewhat stunning bit of unexpected behavior. The following snippet will ensure a default of RelWithDebInfo, and allow the value to be selected from a set in the gui:
<pre>
<pre>
set_property(CACHE CMAKE_BUILD_TYPE PROPERTY STRINGS
set_property(CACHE CMAKE_BUILD_TYPE PROPERTY STRINGS "Debug" "Release" "MinSizeRel" "RelWithDebInfo")
  "Debug" "Release" "MinSizeRel" "RelWithDebInfo")
if(NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CONFIGURATION_TYPES)
if(NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CONFIGURATION_TYPES)
   set(CMAKE_BUILD_TYPE "RelWithDebInfo" CACHE STRING "Choose build mode." FORCE)
   set(CMAKE_BUILD_TYPE "RelWithDebInfo" CACHE STRING "Choose build mode." FORCE)