From 15d1b05d0ece4aa457b7d8ab6bcbc34bbc0a37d2 Mon Sep 17 00:00:00 2001
From: Marco Clemencic <marco.clemencic@cern.ch>
Date: Tue, 3 Mar 2015 19:23:23 +0100
Subject: [PATCH] v95r2p5g4

---
 CMakeLists.txt  | 34 ++++++++++++++++++++++++++++++++++
 cmt/project.cmt |  2 +-
 toolchain.cmake | 11 +++++++++++
 3 files changed, 46 insertions(+), 1 deletion(-)
 create mode 100644 CMakeLists.txt
 create mode 100644 toolchain.cmake

diff --git a/CMakeLists.txt b/CMakeLists.txt
new file mode 100644
index 0000000..b9ec2ea
--- /dev/null
+++ b/CMakeLists.txt
@@ -0,0 +1,34 @@
+CMAKE_MINIMUM_REQUIRED(VERSION 2.8.5)
+
+set(Geant4_version 4.9.5.p02)
+
+if(DEFINED ENV{G4_NATIVE_VERSION})
+  # Override the version of Geant4 from the variable
+  set(Geant4_version $ENV{G4_NATIVE_VERSION})
+  if(NOT Geant4_version MATCHES "^4\\.")
+    # G4_NATIVE_VERSION might not contain the initial '4.' that we need
+    # see https://its.cern.ch/jira/browse/LHCBGAUSS-43
+    set(Geant4_version 4.${Geant4_version})
+  endif()
+endif()
+
+find_package(GaudiProject)
+gaudi_project(Geant4 v95r2p6)
+
+file(MAKE_DIRECTORY ${CMAKE_INSTALL_PREFIX})
+execute_process(COMMAND ${CMAKE_COMMAND} -E create_symlink ../include ${CMAKE_INSTALL_PREFIX}/include)
+
+# FIXME: hack for compatibility with CMT build
+file(WRITE ${CMAKE_BINARY_DIR}/dummy.cpp "")
+link_directories(${CMAKE_INSTALL_PREFIX}/lib)
+set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -Wl,--no-as-needed")
+
+macro(back_comp_lib name)
+  add_library(${name} SHARED ${CMAKE_BINARY_DIR}/dummy.cpp)
+  add_dependencies(${name} Geant4)
+  target_link_libraries(${name} ${ARGN})
+  install(TARGETS ${name} DESTINATION lib)
+endmacro()
+
+back_comp_lib(G4processeshad G4processes)
+back_comp_lib(G4externals G4zlib G4gl2ps)
diff --git a/cmt/project.cmt b/cmt/project.cmt
index 9c5b385..b55b890 100755
--- a/cmt/project.cmt
+++ b/cmt/project.cmt
@@ -1,6 +1,6 @@
 project GEANT4
 
-use GAUDI	GAUDI_v23r9
+use GAUDI	GAUDI_v23r10
 
 build_strategy	with_installarea
 setup_strategy	root
diff --git a/toolchain.cmake b/toolchain.cmake
new file mode 100644
index 0000000..8601ebb
--- /dev/null
+++ b/toolchain.cmake
@@ -0,0 +1,11 @@
+# Special wrapper to load the declared version of the heptools toolchain.
+set(heptools_version 65a)
+
+find_file(use_heptools_module UseHEPTools.cmake
+          HINTS ${CMAKE_CURRENT_SOURCE_DIR}/cmake)
+# this check is needed because the toolchain seem to be called a second time
+# without the proper cache
+if(use_heptools_module)
+  include(${use_heptools_module})
+  use_heptools(${heptools_version})
+endif()
-- 
GitLab