CMakeLists.txt 3.07 KB
Newer Older
1
2
3
4
#------------------------------------------------------------------------------
# Top Level CMakeLists.txt for CLHEP
#  cmake [-DCMAKE_INSTALL_PREFIX=/install/path] 
#        [-DCMAKE_BUILD_TYPE=Debug|Release|RelWithDebInfo|MinSizeRel]
5
#        [-DCLHEP_BUILD_DOCS=ON] 
6
7
8
9
10
11
12
13
14
#        /path/to/source
#  make
#  make test
#  make install
#
# The default CLHEP build type is CMAKE_BUILD_TYPE=RelWithDebInfo,
# which matches the default CLHEP autoconf flags
#------------------------------------------------------------------------------

15
16
17
18
# Ensure out of source build before anything else
include(${CMAKE_CURRENT_SOURCE_DIR}/cmake/Modules/ClhepOutOfSourceBuild.cmake)
clhep_ensure_out_of_source_build()

19
# use cmake 2.6 or later
20
21
cmake_minimum_required(VERSION 2.6)

22
23
# project name
project(CLHEP)
Lynn Garren's avatar
Lynn Garren committed
24
set( VERSION 2.1.1.0 )
25

26
27
28
29
set(CMAKE_MODULE_PATH 
      ${CMAKE_CURRENT_SOURCE_DIR}/cmake/Modules 
      ${CMAKE_MODULE_PATH}
      )
30

31
32
33
34
35
36
# CLHEP_BUILD_DOCS is OFF (false) by default
option(CLHEP_BUILD_DOCS "Build and install CLHEP documentation" OFF)
if(CLHEP_BUILD_DOCS)
  # backwards compatibility variable
  set(build_docs ON)
  message(STATUS "Enabled build and install of documents")
37
endif()
38

39
# CLHEP custom modules
40
41
42
include(ClhepCopyHeaders)
include(ClhepBuildTest)
include(ClhepBuildLibrary)
43
include(ClhepVariables)
Lynn Garren's avatar
Lynn Garren committed
44
include(CheckFunctionExists)
45
include(ClhepToolchain)
46

47
48
# Custom Packaging
include(ClhepPackaging)
49
50
51

# because we want to move these libraries about,
# do not embed full path in shared libraries or executables
52
set(CMAKE_SKIP_RPATH)
53
54
55
56
57

ENABLE_TESTING()

# include search path
include_directories ("${PROJECT_BINARY_DIR}")
Lynn Garren's avatar
Lynn Garren committed
58
59
# add CLHEP/Random to search path so we find gaussTables.cdat
include_directories ("${CMAKE_SOURCE_DIR}/Random")
60

61
62
63
# Put all library build products in standard locations under build tree
set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${PROJECT_BINARY_DIR}/lib)
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${PROJECT_BINARY_DIR}/lib)
64
65
66

# define common flags
set( CMAKE_INCLUDE_PATH  ${CLHEP_BINARY_DIR} )
67

68
69
# set our preferred compiler flags
clhep_set_compiler_flags()
70

Lynn Garren's avatar
Lynn Garren committed
71
72
# the main CLHEP config script
clhep_config()
73

Lynn Garren's avatar
Lynn Garren committed
74
75
# check for required functions
CHECK_FUNCTION_EXISTS(drand48 found_drand48)
76

Lynn Garren's avatar
Lynn Garren committed
77
# all the packages
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
set( CLHEP_subdirs
        Units
	Utility
	Vector
	Evaluator
	GenericFunctions
	Geometry
        Random
	Matrix
	RandomObjects
	Cast
	RefCount
	Exceptions
	)

Lynn Garren's avatar
Lynn Garren committed
93
# The Units and Utility packages are just headers.
94
95
96
97
98
99
100
101
102
103
104
105
106
set( CLHEP_libraries
       Vector
       Evaluator
       GenericFunctions
       Geometry
       Random
       Matrix
       RandomObjects
       Cast
       RefCount
       Exceptions
       )

Lynn Garren's avatar
Lynn Garren committed
107
clhep_copy_headers( ${CLHEP_subdirs} )
108

Lynn Garren's avatar
Lynn Garren committed
109
110
111
112
113
114
115
116
117
118
119
120
121
add_subdirectory(Units)
add_subdirectory(Utility) 
add_subdirectory(Vector) 
add_subdirectory(Evaluator) 
add_subdirectory(GenericFunctions) 
add_subdirectory(Geometry) 
add_subdirectory(Random) 
add_subdirectory(Matrix) 
add_subdirectory(RandomObjects) 
add_subdirectory(Cast) 
add_subdirectory(RefCount) 
add_subdirectory(Exceptions)

122
# libCLHEP.a and libCLHEP.so
Lynn Garren's avatar
Lynn Garren committed
123
clhep_build_libclhep( ${CLHEP_libraries} )
124
125
126

# provide tools for other packages to include CLHEP easily
clhep_toolchain()