CMakeLists.txt 2.14 KB
Newer Older
1 2
#-----------------------------------------------------------------------
# - Top Level CMakeLists.txt for Geant4 Build
3 4 5
#
# 21st September 2010 Ben Morgan
#
6
# $Id: CMakeLists.txt 110849 2018-06-20 06:36:08Z gcosmo $
7 8
#

9
#-----------------------------------------------------------------------
10
# - Enforce an out-of-source builds before anything else
11 12
#
if(${CMAKE_SOURCE_DIR} STREQUAL ${CMAKE_BINARY_DIR})
13 14 15 16 17 18 19
  message(STATUS "Geant4 requires an out-of-source build.")
  message(STATUS "Please remove these files from ${CMAKE_BINARY_DIR} first:")
  message(STATUS "CMakeCache.txt")
  message(STATUS "CMakeFiles")
  message(STATUS "Once these files are removed, create a separate directory")
  message(STATUS "and run CMake from there")
  message(FATAL_ERROR "in-source build detected")
20 21
endif()

22
#-----------------------------------------------------------------------
23
# - Define CMake requirements and override make rules as needed
24
#
25
cmake_minimum_required(VERSION 3.3 FATAL_ERROR)
26

27
# - Any policy requirements should go here
28

29
# - Make overrides for default flags, so they appear in interfaces
30 31 32
set(CMAKE_USER_MAKE_RULES_OVERRIDE_CXX
   ${CMAKE_SOURCE_DIR}/cmake/Modules/Geant4MakeRules_cxx.cmake)

33 34
#-----------------------------------------------------------------------
# - Project definition and basic configuration
35 36 37
#   Version handled manually as project(... VERSION ...) is not used
#   in tests/examples which are subprojects. All calls must use
#   the same form.
38
project(Geant4)
39
set(${PROJECT_NAME}_VERSION_MAJOR 10)
40 41
set(${PROJECT_NAME}_VERSION_MINOR  5)
set(${PROJECT_NAME}_VERSION_PATCH  0)
42
set(${PROJECT_NAME}_VERSION "${${PROJECT_NAME}_VERSION_MAJOR}.${${PROJECT_NAME}_VERSION_MINOR}.${${PROJECT_NAME}_VERSION_PATCH}")
43

44
# - Prepend our own CMake Modules to the search path
45 46
# NB: if our custom modules include others that we don't supply, those in
# the base path will be used, so watch for incompatibilities!!
47 48
#
set(CMAKE_MODULE_PATH
49
    ${PROJECT_SOURCE_DIR}/cmake/Modules
50 51
    ${CMAKE_MODULE_PATH})

52
#-----------------------------------------------------------------------
53 54
# - Include CMake category main module
#   Factored into category for convenience in tagging
55
#
56
include(G4CMakeMain)
57