Skip to content
Snippets Groups Projects
Commit 7fc65e33 authored by Stéphane Del Pino's avatar Stéphane Del Pino
Browse files

Check for valid CMake build type

Fixes #3
parent 78e2cd1d
No related branches found
No related tags found
No related merge requests found
...@@ -46,12 +46,19 @@ MARK_AS_ADVANCED( ...@@ -46,12 +46,19 @@ MARK_AS_ADVANCED(
CMAKE_EXE_LINKER_FLAGS_COVERAGE CMAKE_EXE_LINKER_FLAGS_COVERAGE
CMAKE_SHARED_LINKER_FLAGS_COVERAGE ) CMAKE_SHARED_LINKER_FLAGS_COVERAGE )
if(CMAKE_BUILD_TYPE)
string(REGEX MATCH "(Debug|Release|RelWithDebInfo|MinSizeRel|Coverage)" VALID_BUILD_TYPE "${CMAKE_BUILD_TYPE}")
if(NOT VALID_BUILD_TYPE)
message(FATAL_ERROR "Invalid CMAKE_BUILD_TYPE: '${CMAKE_BUILD_TYPE}'")
endif()
endif()
# Default build type is RelWIthDebInfo # Default build type is RelWIthDebInfo
if(NOT CMAKE_BUILD_TYPE) if(NOT CMAKE_BUILD_TYPE)
set(CMAKE_BUILD_TYPE "RelWithDebInfo" CACHE STRING set(CMAKE_BUILD_TYPE "RelWithDebInfo" CACHE STRING
"Choose the type of build: Debug Release RelWithDebInfo MinSizeRel Coverage." "Choose the type of build: Debug Release RelWithDebInfo MinSizeRel Coverage."
FORCE) FORCE)
endif(NOT CMAKE_BUILD_TYPE) endif()
#------------------------------------------------------ #------------------------------------------------------
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment