From 718644349fcee16e88266e78a0263ebd5925be66 Mon Sep 17 00:00:00 2001
From: maier <maier@0785d39b-7218-0410-832d-ea1e28bc413d>
Date: Sat, 9 Mar 2013 01:22:30 +0000
Subject: [PATCH] CMake: Bugfix, bail out with a prominent error message if the
 build type for a client project is unsupported

git-svn-id: https://svn.dealii.org/trunk@28831 0785d39b-7218-0410-832d-ea1e28bc413d
---
 ..._deal_ii_initialize_cached_variables.cmake | 22 +++++++++++++++++++
 1 file changed, 22 insertions(+)

diff --git a/deal.II/cmake/macros/macro_deal_ii_initialize_cached_variables.cmake b/deal.II/cmake/macros/macro_deal_ii_initialize_cached_variables.cmake
index 8b7179637c..6aa654d35b 100644
--- a/deal.II/cmake/macros/macro_deal_ii_initialize_cached_variables.cmake
+++ b/deal.II/cmake/macros/macro_deal_ii_initialize_cached_variables.cmake
@@ -35,6 +35,9 @@ MACRO(DEAL_II_INITIALIZE_CACHED_VARIABLES)
       )
   ENDIF()
 
+  #
+  # Set build type according to available libraries
+  #
   IF(DEAL_II_BUILD_TYPE MATCHES "Debug")
     SET(CMAKE_BUILD_TYPE "Debug" CACHE STRING
       "Choose the type of build, options are: Debug, Release"
@@ -45,6 +48,25 @@ MACRO(DEAL_II_INITIALIZE_CACHED_VARIABLES)
       )
   ENDIF()
 
+  #
+  # Bail out if build type is unknown...
+  #
+  IF( NOT "${CMAKE_BUILD_TYPE}" STREQUAL "Release" AND
+      NOT "${CMAKE_BUILD_TYPE}" STREQUAL "Debug" )
+    MESSAGE(FATAL_ERROR
+      "\nCMAKE_BUILD_TYPE does neither match Release nor Debug!\n\n"
+      )
+  ENDIF()
+  #
+  # ... or unsupported
+  #
+  IF(NOT DEAL_II_BUILD_TYPE MATCHES "${CMAKE_BUILD_TYPE}")
+    MESSAGE(FATAL_ERROR "\n"
+      "CMAKE_BUILD_TYPE \"${CMAKE_BUILD_TYPE}\" unsupported by current installation!\n"
+      "deal.II was build with \"${DEAL_II_BUILD_TYPE}\" only build type.\n\n"
+      )
+  ENDIF()
+
   SET(CMAKE_CXX_COMPILER ${DEAL_II_CXX_COMPILER} CACHE STRING
     "CXX Compiler.")
 
-- 
2.39.5