summaryrefslogtreecommitdiff
path: root/CMakeLists.txt
diff options
context:
space:
mode:
authorMathias Preiner <mathias.preiner@gmail.com>2018-09-12 13:58:41 -0700
committerMathias Preiner <mathias.preiner@gmail.com>2018-09-22 16:30:59 -0700
commitaa86e978469e75691bd8f83e4a9fedd07aec283c (patch)
tree85353ed666dd360efbc89b6536db7e13e8b1157f /CMakeLists.txt
parentb6012cbc43a76d7859f65226c3b9ff65cc0f26ca (diff)
cmake: Simplify build type configuration.
Diffstat (limited to 'CMakeLists.txt')
-rw-r--r--CMakeLists.txt26
1 files changed, 13 insertions, 13 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 4120e5984..a1d137232 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -273,11 +273,14 @@ option(BUILD_BINDINGS_PYTHON "Build Python bindings")
set(OPTIMIZATION_LEVEL 3)
set(GPL_LIBS "")
-set(BUILD_TYPES Production Debug Testing Competition)
-
#-----------------------------------------------------------------------------#
# Build types
+
+# Note: Module CodeCoverage requires the name of the debug build to conform
+# to cmake standards (first letter uppercase).
+set(BUILD_TYPES Production Debug Testing Competition)
+
if(ENABLE_ASAN)
set(CMAKE_BUILD_TYPE Debug)
endif()
@@ -289,20 +292,17 @@ if(NOT CMAKE_BUILD_TYPE)
# Provide drop down menu options in cmake-gui
set_property(CACHE CMAKE_BUILD_TYPE PROPERTY STRINGS ${BUILD_TYPES})
endif()
-message(STATUS "Building ${CMAKE_BUILD_TYPE} build")
-# Note: Module CodeCoverage requires the name of the debug build to conform
-# to cmake standards (first letter uppercase).
-if(CMAKE_BUILD_TYPE STREQUAL "Debug")
- include(ConfigDebug)
-elseif(CMAKE_BUILD_TYPE STREQUAL "Production")
- include(ConfigProduction)
-elseif(CMAKE_BUILD_TYPE STREQUAL "Testing")
- include(ConfigTesting)
-elseif(CMAKE_BUILD_TYPE STREQUAL "Competition")
- include(ConfigCompetition)
+list(FIND BUILD_TYPES ${CMAKE_BUILD_TYPE} FOUND_BUILD_TYPE)
+if(${FOUND_BUILD_TYPE} EQUAL -1)
+ message(FATAL_ERROR
+ "'${CMAKE_BUILD_TYPE}' is not a valid build type. "
+ "Available builds are: ${BUILD_TYPES}")
endif()
+message(STATUS "Building ${CMAKE_BUILD_TYPE} build")
+include(Config${CMAKE_BUILD_TYPE})
+
#-----------------------------------------------------------------------------#
# Compiler flags
generated by cgit on debian on lair
contact matthew@masot.net with questions or feedback