CMakeLists.txt 2.5 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
#        [-Dbuild_docs:BOOL=ON] 
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
#        /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)
set( VERSION 2.1.0.1 )

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

# build_docs is OFF (false) by default
26
27
28
29
30
31
if ( build_docs )
   message(STATUS "documents WILL be built and installed" )
else()
   message(STATUS "documents WILL NOT be installed" )
endif()
# various handy macros
32
33
34
35
include(ClhepOutOfSourceBuild)
include(ClhepCopyHeaders)
include(ClhepBuildTest)
include(ClhepBuildLibrary)
36
include(ClhepVariables)
Lynn Garren's avatar
Lynn Garren committed
37
include(CheckFunctionExists)
38
39
40
41
42
43
44
45
46
47
48
49

# 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
50
51
# add CLHEP/Random to search path so we find gaussTables.cdat
include_directories ("${CMAKE_SOURCE_DIR}/Random")
52
53
54
55
56
57
58
59

#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
60
61
# the main CLHEP config script
clhep_config()
62

Lynn Garren's avatar
Lynn Garren committed
63
64
65
# check for required functions
CHECK_FUNCTION_EXISTS(drand48 found_drand48)
set( CLHEP_subdirs Units Utility Vector Evaluator GenericFunctions Geometry
66
                    Random Matrix RandomObjects Cast RefCount Exceptions )
Lynn Garren's avatar
Lynn Garren committed
67
clhep_copy_headers( ${CLHEP_subdirs} )
68

Lynn Garren's avatar
Lynn Garren committed
69
70
71
72
73
74
75
76
77
78
79
80
81
82
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)

clhep_build_libclhep( ${CLHEP_subdirs} )