From 0645cb4390ff1c542b533a56085d8df7ef4caa27 Mon Sep 17 00:00:00 2001
From: Frank Gaede <frank.gaede@desy.de>
Date: Thu, 17 Oct 2013 15:30:57 +0000
Subject: [PATCH]  - set default build type to RelWithDebInfo    (overwrite w/
 -D CMAKE_BUILD_TYPE=Debug, Release,...)

---
 CMakeLists.txt              | 5 ++++-
 cmake/DD4hepConfig.cmake.in | 5 ++++-
 2 files changed, 8 insertions(+), 2 deletions(-)

diff --git a/CMakeLists.txt b/CMakeLists.txt
index c54d5a5b1..c2b8da567 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -28,8 +28,11 @@ option(DD4HEP_USE_XERCESC "Enable 'Detector Builders' based on XercesC" OFF)
 option(DD4HEP_USE_PYROOT "Enable 'Detector Builders' based on PyROOT" OFF)  # does not work (compile error)
 option(DD4HEP_WITH_GEANT4 "Enable the simulation part based on Geant4" OFF)
 
-#option(DD4HEP_WITH_LCIO  "Build ILD examples with LCIO - builds LCIO as external project or uses pre-installed" ON)
 
+#---------------------------------------------------------------------------------------
+if(NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CONFIGURATION_TYPES)
+  set (CMAKE_BUILD_TYPE RelWithDebInfo CACHE STRING "One of: None Debug Release RelWithDebInfo MinSizeRel." FORCE)
+endif()
 
 #---DD4hep functions and macros -------------------------------------------------------
 include(DD4hep)
diff --git a/cmake/DD4hepConfig.cmake.in b/cmake/DD4hepConfig.cmake.in
index b35ee75ce..c62538dc8 100644
--- a/cmake/DD4hepConfig.cmake.in
+++ b/cmake/DD4hepConfig.cmake.in
@@ -28,7 +28,10 @@ FIND_PATH( DD4hep_INCLUDE_DIRS
 	NO_DEFAULT_PATH
 )
 
-
+# ---------- default build type  --------------------------------------------------------
+if(NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CONFIGURATION_TYPES)
+  set (CMAKE_BUILD_TYPE RelWithDebInfo CACHE STRING "One of: None Debug Release RelWithDebInfo MinSizeRel." FORCE)
+endif()
 
 # ---------- libraries --------------------------------------------------------
 # do not store find results in cache
-- 
GitLab