Skip to content

Commit

Permalink
Changing the build type check to be case-insensitive (AcademySoftware…
Browse files Browse the repository at this point in the history
…Foundation#1765)

Signed-off-by: Cédrik Fuoco <[email protected]>
Co-authored-by: Doug Walker <[email protected]>
Signed-off-by: Cédrik Fuoco <[email protected]>
  • Loading branch information
cedrik-fuoco-adsk and doug-walker committed Mar 24, 2023
1 parent caa2fce commit 39345e1
Showing 1 changed file with 16 additions and 1 deletion.
17 changes: 16 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -94,11 +94,26 @@ set_property(CACHE CMAKE_BUILD_TYPE PROPERTY STRINGS "Debug" "Release" "MinSizeR

# Is that a valid build type?

if(NOT "${CMAKE_BUILD_TYPE}" IN_LIST CMAKE_CONFIGURATION_TYPES)
set(_build_type_valid_ false)
foreach (_build_type_ ${CMAKE_CONFIGURATION_TYPES})
string(TOLOWER ${_build_type_} _lowercase_build_type_)
string(TOLOWER ${CMAKE_BUILD_TYPE} _lowercase_cmake_build_type_)

if (_lowercase_cmake_build_type_ STREQUAL _lowercase_build_type_)
# Build type is supported.
set(_build_type_valid_ true)
break()
endif()
endforeach()
unset(_lowercase_build_type_)
unset(_lowercase_cmake_build_type_)

if (NOT _build_type_valid_)
string(REPLACE ";" ", " _CMAKE_CONFIGURATION_TYPES_STR "${CMAKE_CONFIGURATION_TYPES}")
message(FATAL_ERROR
"CMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE} is unsupported. Supported values are: ${_CMAKE_CONFIGURATION_TYPES_STR}.")
endif()
unset(_build_type_valid_)

# Is that in debug mode?

Expand Down

0 comments on commit 39345e1

Please sign in to comment.