From a36099a686debec1beeec7bfd5dbe809f5878711 Mon Sep 17 00:00:00 2001 From: Mats Kindahl Date: Mon, 8 Mar 2021 15:13:19 +0100 Subject: [PATCH] Check CMake build type If an unsupported CMake build type is used, it is accepted but generate strange builds for the compiler. This commit adds a check that only one of the standard build types are used. --- CMakeLists.txt | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/CMakeLists.txt b/CMakeLists.txt index 71cefd626..3e7b10f5c 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -61,6 +61,11 @@ if (NOT CMAKE_BUILD_TYPE) set(CMAKE_BUILD_TYPE Release CACHE STRING "Choose the type of build, options are: None Debug Release RelWithDebInfo MinSizeRel" FORCE) endif () +set(SUPPORTED_BUILD_TYPES Debug Release RelWithDebugInfo MinSizeRel) +if (NOT CMAKE_BUILD_TYPE IN_LIST SUPPORTED_BUILD_TYPES) + message(FATAL_ERROR "Bad CMAKE_BUILD_TYPE. Expected one of ${SUPPORTED_BUILD_TYPES}") +endif() + message(STATUS "TimescaleDB version ${PROJECT_VERSION_MOD}. Can be updated from version ${UPDATE_FROM_VERSION}") message(STATUS "Build type is ${CMAKE_BUILD_TYPE}")