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
+ # Reset build type if 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"
+ IF("${DEAL_II_BUILD_TYPE}" STREQUAL "DebugRelease")
+ SET(_new_build_type "Debug")
+ ELSE()
+ SET(_new_build_type "${DEAL_II_BUILD_TYPE}")
+ ENDIF()
+
+ MESSAGE(
+"###
+#
+# WARNING:
+#
+# CMAKE_BUILD_TYPE \"${CMAKE_BUILD_TYPE}\" unsupported by current installation!
+# deal.II was built with CMAKE_BUILD_TYPE \"${DEAL_II_BUILD_TYPE}\".
+#
+# CMAKE_BUILD_TYPE is forced to \"${_new_build_type}\".
+#
+###"
+ )
+ SET(CMAKE_BUILD_TYPE "${_new_build_type}" CACHE STRING
+ "Choose the type of build, options are: Debug, Release"
+ FORCE
)
ENDIF()
+
SET(CMAKE_CXX_COMPILER ${DEAL_II_CXX_COMPILER} CACHE STRING
"CXX Compiler.")
ENDIF()
# Define custom targets to easily switch the build type:
- IF(${DEAL_II_BUILD_TYPE} MATCHES "Debug")
- ADD_CUSTOM_TARGET(debug
- COMMAND ${CMAKE_COMMAND} -DCMAKE_BUILD_TYPE=Debug ${CMAKE_SOURCE_DIR}
- COMMENT "Switch CMAKE_BUILD_TYPE to Debug"
- )
- SET(_switch_targets
- "# $ make debug - to switch the build type to \"Debug\"\n"
- )
- ENDIF()
- IF(${DEAL_II_BUILD_TYPE} MATCHES "Release")
- ADD_CUSTOM_TARGET(release
- COMMAND ${CMAKE_COMMAND} -DCMAKE_BUILD_TYPE=Release ${CMAKE_SOURCE_DIR}
- COMMENT "Switch CMAKE_BUILD_TYPE to Release"
- )
+ ADD_CUSTOM_TARGET(debug
+ COMMAND ${CMAKE_COMMAND} -DCMAKE_BUILD_TYPE=Debug ${CMAKE_SOURCE_DIR}
+ COMMENT "Switch CMAKE_BUILD_TYPE to Debug"
+ )
+
+ ADD_CUSTOM_TARGET(release
+ COMMAND ${CMAKE_COMMAND} -DCMAKE_BUILD_TYPE=Release ${CMAKE_SOURCE_DIR}
+ COMMENT "Switch CMAKE_BUILD_TYPE to Release"
+ )
+
+ # Only mention release and debug targets if its actuallay possible to
+ # switch between them:
+ IF(${DEAL_II_BUILD_TYPE} MATCHES "DebugRelease")
SET(_switch_targets
- "${_switch_targets}# $ make release - to switch the build type to \"Release\"\n"
+"# $ make debug - to switch the build type to \"Debug\"
+# $ make release - to switch the build type to \"Release\"\n"
)
ENDIF()