From: Mathias Preiner Date: Wed, 12 Sep 2018 20:58:41 +0000 (-0700) Subject: cmake: Simplify build type configuration. X-Git-Tag: cvc5-1.0.0~4556 X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=aa86e978469e75691bd8f83e4a9fedd07aec283c;p=cvc5.git cmake: Simplify build type configuration. --- 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