CMakeLists.txt 2.78 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
15
16
17
18
#        /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
#------------------------------------------------------------------------------

# use cmake 2.6 or later
cmake_minimum_required (VERSION 2.6)
# project name
project(CLHEP)
Lynn Garren's avatar
Lynn Garren committed
19
set( VERSION 2.1.1.0 )
20
21
22
23

set(CMAKE_MODULE_PATH "${CMAKE_ROOT}/Modules")
set(CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/cmake/Modules ${CMAKE_MODULE_PATH})
message(STATUS "module path is ${CMAKE_MODULE_PATH}" )
24

25
26
27
28
29
30
# 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")
31
endif()
32

33
# various handy macros
34
35
36
37
include(ClhepOutOfSourceBuild)
include(ClhepCopyHeaders)
include(ClhepBuildTest)
include(ClhepBuildLibrary)
38
include(ClhepVariables)
Lynn Garren's avatar
Lynn Garren committed
39
include(CheckFunctionExists)
40
41
42
43
44
45
46
47
48
49
50
51

# make sure we are not building in source
clhep_ensure_out_of_source_build()

# because we want to move these libraries about,
# do not embed full path in shared libraries or executables
set (CMAKE_SKIP_RPATH)

ENABLE_TESTING()

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

#build all libraries in a single directory to facilitate testing
SET(LIBRARY_OUTPUT_PATH ${PROJECT_BINARY_DIR}/lib)

# define common flags
set( CMAKE_INCLUDE_PATH  ${CLHEP_BINARY_DIR} )
# set our preferred compiler flags
clhep_set_compiler_flags()
Lynn Garren's avatar
Lynn Garren committed
62
63
# the main CLHEP config script
clhep_config()
64

Lynn Garren's avatar
Lynn Garren committed
65
66
# check for required functions
CHECK_FUNCTION_EXISTS(drand48 found_drand48)
Lynn Garren's avatar
Lynn Garren committed
67
# all the packages
Lynn Garren's avatar
Lynn Garren committed
68
set( CLHEP_subdirs Units Utility Vector Evaluator GenericFunctions Geometry
69
                    Random Matrix RandomObjects Cast RefCount Exceptions )
Lynn Garren's avatar
Lynn Garren committed
70
71
72
# The Units and Utility packages are just headers.
set( CLHEP_libraries Vector Evaluator GenericFunctions Geometry
                    Random Matrix RandomObjects Cast RefCount Exceptions )
Lynn Garren's avatar
Lynn Garren committed
73
clhep_copy_headers( ${CLHEP_subdirs} )
74

Lynn Garren's avatar
Lynn Garren committed
75
76
77
78
79
80
81
82
83
84
85
86
87
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)

Lynn Garren's avatar
Lynn Garren committed
88
clhep_build_libclhep( ${CLHEP_libraries} )