Skip to content

Set CMAKE_BUILD_TYPE as enumeration for cmake-gui

ClamAV:CMakeLists.txt for cmake-gui sets the possible values of CMAKE_BUILD_TYPE as enumeration at https://github.com/Cisco-Talos/clamav/blob/main/CMakeLists.txt#L115. Then it is possible in ccmake to toggle the values with enter, which is faster than typing them.

Is there any reason, why the build system of cmake itself (that is, when configuring cmake’s build with cmake-gui) does not do the same?

# Set build type to RelWithDebInfo if not specified.
# This must be done before pulling in the Rust module
# or else the default build will be Debug for Rust stuffs.
if(NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CONFIGURATION_TYPES)
    set(CMAKE_BUILD_TYPE RelWithDebInfo CACHE STRING "Choose the build type" FORCE)

    # Include "None" as option to disable any additional (optimization) flags,
    # relying on just CMAKE_C_FLAGS and CMAKE_CXX_FLAGS (which are empty by
    # default). These strings are presented in cmake-gui.
    set_property(CACHE CMAKE_BUILD_TYPE PROPERTY STRINGS
        "None" "Debug" "Release" "MinSizeRel" "RelWithDebInfo")
endif()
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information