CMakeLists.txt 2.09 KB
Newer Older
1 2
#-----------------------------------------------------------------------
# - Top Level CMakeLists.txt for Geant4 Build
3 4 5 6 7
#
# 21st September 2010 Ben Morgan
#
#

8
#-----------------------------------------------------------------------
9
# - Enforce an out-of-source builds before anything else
10 11
#
if(${CMAKE_SOURCE_DIR} STREQUAL ${CMAKE_BINARY_DIR})
12 13 14 15 16 17 18
  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")
19 20
endif()

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

26
# - Any policy requirements should go here
27

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

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

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

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