-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy pathCMakeLists.txt
86 lines (72 loc) · 3.28 KB
/
CMakeLists.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
# $Id$
#
# ------------------------------------------------------------------------------
# The configuration file for CMake build for Virtual Geometry Model
# Copyright (C) 2012, Ivana Hrivnacova
# All rights reserved.
#
# For the licensing terms see vgm/LICENSE.
# Contact: [email protected]
# ------------------------------------------------------------------------------
# The CMake build for Virtual Geometry Model is a result of a merge
# of the CMake configuration files kindly provided
# by Florian Uhlig, GSI and Pere Mato, CERN.
#--- Enforce an out-of-source builds before anything else ---------------------
if(${CMAKE_SOURCE_DIR} STREQUAL ${CMAKE_BINARY_DIR})
message(STATUS "VGM 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")
endif()
#--- CMake required version ----------------------------------------------------
cmake_minimum_required(VERSION 3.8 FATAL_ERROR)
# Required to be able to use non Apple Clang builds on macOS
cmake_policy(SET CMP0025 NEW)
#--- CMake Module Path----------------------------------------------------------
set(CMAKE_MODULE_PATH
${CMAKE_SOURCE_DIR}/cmake
${CMAKE_MODULE_PATH})
#---Project VGM ----------------------------------------------------------------
#
project(VGM)
set(${PROJECT_NAME}_VERSION_MAJOR "5")
set(${PROJECT_NAME}_VERSION_MINOR "3")
set(${PROJECT_NAME}_VERSION_PATCH "1")
set(${PROJECT_NAME}_VERSION
${${PROJECT_NAME}_VERSION_MAJOR}.${${PROJECT_NAME}_VERSION_MINOR}.${${PROJECT_NAME}_VERSION_PATCH})
#--- Default project build mode ------------------------------------------------
include(VGMBuildMode)
#--- Options -------------------------------------------------------------------
option(WITH_GEANT4 "Build Geant4 dependent subpackage (Geant4GM)" ON)
option(WITH_ROOT "Build Root dependent subpackage(RootGM)" ON)
option(WITH_EXAMPLES "Build examples" ON)
option(WITH_TEST "Build test" OFF)
option(WITH_G4ROOT "Build test with G4Root" OFF)
option(INSTALL_EXAMPLES "Install examples" ON)
option(BUILD_SHARED_LIBS "Build the dynamic libraries" ON)
#--- Find required packages ----------------------------------------------------
include(VGMRequiredPackages)
#--- Utility to defined installation lib directory -----------------------------
include(VGMInstallLibDir)
#--- Add the packages sources --------------------------------------------------
add_subdirectory(packages)
#--- Build test ----------------------------------------------------------------
if(WITH_TEST)
if (WITH_GEANT4 AND WITH_ROOT)
add_subdirectory(test)
else()
message(STATUS "VGM test inactivated: requires both WITH_GEANT4 and WITH_ROOT set ON.")
endif()
endif()
#--- Build examples ------------------------------------------------------------
if(WITH_EXAMPLES)
set(VGM_WITH_GEANT4 ${WITH_GEANT4})
set(VGM_WITH_ROOT ${WITH_ROOT})
set(VGM_WITH_EXAMPLES ${WITH_EXAMPLES})
add_subdirectory(examples)
endif()
#--- Build project configuration -----------------------------------------------
include(VGMBuildProject)