CMakeLists.txt 2.19 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
48
49
50
51
52
53
54
55
56
57
58

# 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}")

#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
59
60
61
# check for required functions
CHECK_FUNCTION_EXISTS(drand48 found_drand48)
set( CLHEP_subdirs Units Utility Vector Evaluator GenericFunctions Geometry
62
                    Random Matrix RandomObjects Cast RefCount Exceptions )
Lynn Garren's avatar
Lynn Garren committed
63
clhep_copy_headers( ${CLHEP_subdirs} )
64
65
66
67
68
69
70
71
72
73
74
75
76

subdirs(Units)
subdirs(Utility) 
subdirs(Vector) 
subdirs(Evaluator) 
subdirs(GenericFunctions) 
subdirs(Geometry) 
subdirs(Random) 
subdirs(Matrix) 
subdirs(RandomObjects) 
subdirs(Cast) 
subdirs(RefCount) 
subdirs(Exceptions)