diff options
author | Justin Bogner <mail@justinbogner.com> | 2015-08-08 21:04:45 +0000 |
---|---|---|
committer | Justin Bogner <mail@justinbogner.com> | 2015-08-08 21:04:45 +0000 |
commit | 91d509f4fc0997a792fd0ab2ad869d9cbfbc082e (patch) | |
tree | ef240bfe4e5cda412ab2071d7e0614f09e6bf48e /CMakeLists.txt | |
parent | c19de56ad9108a6c967eb7fd07237a3aae207fc5 (diff) |
cmake: Error on invalid CMAKE_BUILD_TYPE
Apparently if you make a typo in the argument to CMAKE_BUILD_TYPE,
cmake silently accepts this but doesn't apply any particular build
type to your build. This means you get a build that doesn't really
make any sense - it's sort of a debug build with asserts disabled.
Error out instead.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@244406 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'CMakeLists.txt')
-rw-r--r-- | CMakeLists.txt | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt index 92beb6c27e8..adf852e2a44 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -7,6 +7,11 @@ if (NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CONFIGURATION_TYPES) set(CMAKE_BUILD_TYPE "Debug") endif() +if (CMAKE_BUILD_TYPE AND + NOT CMAKE_BUILD_TYPE MATCHES "^(Debug|Release|RelWithDebInfo|MinSizeRel)$") + message(FATAL_ERROR "Invalid value for CMAKE_BUILD_TYPE: ${CMAKE_BUILD_TYPE}") +endif() + if(POLICY CMP0022) cmake_policy(SET CMP0022 NEW) # automatic when 2.8.12 is required endif() |