Skip to content

Document casing for CMake build types

!5411 (merged) clarifies that build types are handled case insensitive. The wording is confusing

Note that configuration names are case-insensitive. The value of this variable will be the same as it is specified when invoking CMake. For instance, if -DCMAKE_BUILD_TYPE=ReLeAsE is specified, then the value of CMAKE_BUILD_TYPE will be ReLeAsE.

  • if the configuration is case insensitive, explaining the case preserving nature is not necessary
  • a recent discussion in 3990 showed some reader assume that CMake is self-aware of this constraint, i. e. instead of handling case sensitivity by themselfes:
string(TOUPPER "${CMAKE_BUILD_TYPE}" uppercase_CMAKE_BUILD_TYPE)
if (NOT uppercase_CMAKE_BUILD_TYPE STREQUAL "ANYCASEWILLDO")
  set(CMAKE_BUILD_TYPE anYcASEwilldo)
endif()

they falsely assume CMake to handle it

if(${CMAKE_BUILD_TYPE} STREQUAL "anYcASEwilldo")
    set(CMAKE_BUILD_TYPE anYcASEwilldo)
endif()

i assume this is due to increased context awareness of recent scripting languages.

  • clarify how build types are handled, i.e. whether Release is the same or different to release
    • projects can only be consumed via add subdirectory when build type conventions are compatible
    • the CMake project itself may use a convention already, which should indicate which option to recommend
      • otherwise, the CMake project may not need to take a position on how to handle build types

i'll start looking into this issue.

Edited by Arcturus
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information