From ed6c495c93a18117b0e1023baee8bffdc0ef00d7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9drik=20Fuoco?= Date: Thu, 2 Feb 2023 15:54:22 -0500 Subject: [PATCH] Changing the build type check to be case-insensitive MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Cédrik Fuoco --- CMakeLists.txt | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 3911a154ce..5a4774d887 100755 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -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?