hepmc - Blame information for rev 511
Subversion Repositories:
| Rev | Author | Line No. | Line |
|---|---|---|---|
| 483 | garren | 1 | #------------------------------------------------------------------------------ |
| 2 | # Top Level CMakeLists.txt for HepMC | ||
| 3 | # cmake -Dmomentum:STRING=[MEV|GEV] -Dlength:STRING=[MM|CM] | ||
| 4 | # [-DCMAKE_INSTALL_PREFIX=/install/path] | ||
| 5 | # [-DCMAKE_BUILD_TYPE=Debug|Release|RelWithDebInfo|MinSizeRel] | ||
| 6 | # [-Dbuild_docs:BOOL=ON] | ||
| 7 | # /path/to/source | ||
| 8 | # make | ||
| 9 | # make test | ||
| 10 | # make install | ||
| 11 | # | ||
| 12 | # The default HepMC build type is CMAKE_BUILD_TYPE=RelWithDebInfo, | ||
| 13 | # which matches the default HepMC autoconf flags | ||
| 14 | #------------------------------------------------------------------------------ | ||
| 15 | |||
| 16 | # use cmake 2.6 or later | ||
| 17 | cmake_minimum_required (VERSION 2.6) | ||
| 18 | |||
| 19 | # project name and version | ||
| 20 | project(HepMC) | ||
| 511 | garren | 21 | set( version 2.06.07 ) |
| 483 | garren | 22 | |
| 23 | if ( momentum ) | ||
| 24 | set( HEPMC_DEFAULT_MOM_UNIT ${momentum} ) | ||
| 25 | else() | ||
| 26 | message(FATAL_ERROR "You must specify the momentum units with -Dmomentum:STRING=[MEV|GEV]") | ||
| 27 | endif() | ||
| 28 | |||
| 29 | if ( length ) | ||
| 30 | set( HEPMC_DEFAULT_LEN_UNIT ${length} ) | ||
| 31 | else() | ||
| 32 | message(FATAL_ERROR "You must specify the length units with -Dlength:STRING=[MM|CM]") | ||
| 33 | endif() | ||
| 34 | |||
| 490 | garren | 35 | message(STATUS "default momentum and length are ${HEPMC_DEFAULT_MOM_UNIT} ${HEPMC_DEFAULT_LEN_UNIT}") |
| 36 | |||
| 483 | garren | 37 | # find the HepMC cmake modules |
| 38 | set(CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/cmake/Modules ${CMAKE_MODULE_PATH}) | ||
| 39 | |||
| 40 | # make sure we are not building from within the source code directory | ||
| 490 | garren | 41 | string(COMPARE EQUAL "${CMAKE_SOURCE_DIR}" "${CMAKE_BINARY_DIR}" in_source) |
| 42 | string( REGEX MATCH "${CMAKE_SOURCE_DIR}/" in_source_subdir | ||
| 43 | "${CMAKE_BINARY_DIR}") | ||
| 44 | if (in_source OR in_source_subdir) | ||
| 45 | message(FATAL_ERROR " | ||
| 46 | ERROR: In source builds of this project are not allowed. | ||
| 47 | A separate build directory is required. | ||
| 48 | Please create one and run cmake from the build directory. | ||
| 49 | Also note that cmake has just added files to your source code directory. | ||
| 50 | We suggest getting a new copy of the source code. | ||
| 51 | Otherwise, delete `CMakeCache.txt' and the directory `CMakeFiles'. | ||
| 52 | ") | ||
| 53 | endif () | ||
| 483 | garren | 54 | |
| 55 | # build_docs is OFF (false) by default | ||
| 56 | if ( build_docs ) | ||
| 57 | message(STATUS "documents WILL be built and installed" ) | ||
| 58 | else() | ||
| 59 | message(STATUS "documents WILL NOT be installed" ) | ||
| 60 | endif() | ||
| 61 | |||
| 62 | # various handy macros | ||
| 63 | include(HepMCVariables) | ||
| 490 | garren | 64 | #include(HepMCParseVersion) |
| 483 | garren | 65 | |
| 66 | # because we want to move these libraries about, | ||
| 67 | # do not embed full path in shared libraries or executables | ||
| 68 | set (CMAKE_SKIP_RPATH) | ||
| 69 | |||
| 70 | ENABLE_TESTING() | ||
| 71 | |||
| 72 | # include search path | ||
| 73 | include_directories ("${CMAKE_CURRENT_SOURCE_DIR}") | ||
| 74 | |||
| 75 | #build all libraries in a single directory to facilitate testing | ||
| 76 | SET(LIBRARY_OUTPUT_PATH ${PROJECT_BINARY_DIR}/lib) | ||
| 77 | |||
| 490 | garren | 78 | # parse the version |
| 79 | STRING( REGEX REPLACE "^([0-9]+)[.][0-9]+[.][0-9]+.*" "\\1" VERSION_MAJOR "${version}" ) | ||
| 80 | STRING( REGEX REPLACE "^[0-9]+[.]([0-9]+)[.][0-9]+.*" "\\1" VERSION_MINOR "${version}" ) | ||
| 81 | STRING( REGEX REPLACE "^[0-9]+[.][0-9]+[.]([0-9]+)+.*" "\\1" VERSION_PATCH "${version}" ) | ||
| 82 | message(STATUS "${project} version ${version} parses to ${VERSION_MAJOR} ${VERSION_MINOR} ${VERSION_PATCH}" ) | ||
| 83 | |||
| 483 | garren | 84 | # set our preferred compiler flags and other variables |
| 490 | garren | 85 | include(CMakeDetermineFortranCompiler) |
| 483 | garren | 86 | hepmc_set_compiler_flags() |
| 87 | |||
| 88 | add_subdirectory(HepMC) | ||
| 89 | add_subdirectory(src) | ||
| 90 | add_subdirectory(fio) | ||
| 91 | add_subdirectory(test) | ||
| 92 | add_subdirectory(examples) | ||
| 93 | add_subdirectory(doc) | ||
| 94 | |||
| 95 | # Packaging utility | ||
| 96 | include(HepMCUseCpack) | ||
| 97 |
