CMakeLists.txt 2.45 KB
Newer Older
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
#------------------------------------------------------------------------------
# Top Level CMakeLists.txt for CLHEP
#  cmake [-DCMAKE_INSTALL_PREFIX=/install/path] 
#        [-DCMAKE_BUILD_TYPE=Debug|Release|RelWithDebInfo|MinSizeRel]
#        [-Dbuild_docs] 
#        /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}" )
if ( build_docs )
   message(STATUS "documents WILL be built and installed" )
else()
   message(STATUS "documents WILL NOT be installed" )
endif()
# various handy macros
include(EnsureOutOfSourceBuild)
include(CopyHeaders)
include(BuildTest)
include(BuildLibrary)
include(ClhepVariables)
Lynn Garren's avatar
Lynn Garren committed
35
include(CheckFunctionExists)
36
37
38
39
40
41
42
43
44
45
46
47

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

#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()
# get automake/autoconf variables
clhep_autoconf_variables()

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

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