From c352fbf5c953cec8bbc19997237c1e0773b447f4 Mon Sep 17 00:00:00 2001 From: DS Date: Fri, 3 May 2024 16:29:02 +0200 Subject: [PATCH] Warn on unknown CMAKE_BUILD_TYPE values (#14600) --- src/CMakeLists.txt | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index ff7f53cd2..bad7e2afb 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -27,10 +27,15 @@ mark_as_advanced( CMAKE_CXX_FLAGS_SEMIDEBUG CMAKE_C_FLAGS_SEMIDEBUG ) +set(SUPPORTED_BUILD_TYPES None Release Debug SemiDebug RelWithDebInfo MinSizeRel) set(CMAKE_BUILD_TYPE "${CMAKE_BUILD_TYPE}" CACHE STRING - "Choose the type of build. Options are: None Debug SemiDebug RelWithDebInfo MinSizeRel." + "Choose the type of build. Options are: ${SUPPORTED_BUILD_TYPES}." FORCE ) +if(NOT (CMAKE_BUILD_TYPE IN_LIST SUPPORTED_BUILD_TYPES)) + message(WARNING + "Unknown CMAKE_BUILD_TYPE: ${CMAKE_BUILD_TYPE}. Options are: ${SUPPORTED_BUILD_TYPES}.") +endif() # Set some random things default to not being visible in the GUI