-
Notifications
You must be signed in to change notification settings - Fork 10
/
Copy pathCMakeLists.txt
105 lines (83 loc) · 3.78 KB
/
CMakeLists.txt
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
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
cmake_minimum_required(VERSION 3.5 FATAL_ERROR)
message ( "----> CMAKE version : " ${CMAKE_VERSION} )
string(TIMESTAMP OSTAP_BUILD_TIMESTAMP "%b %d, %Y, %H:%M [UTC]" UTC)
string(TIMESTAMP OSTAP_BUILD_UTCUNIX "%s" UTC)
cmake_host_system_information(RESULT OSTAP_HOSTNAME QUERY HOSTNAME)
cmake_host_system_information(RESULT OSTAP_DOMAIN QUERY FQDN )
if ( ${CMAKE_VERSION} VERSION_GREATER_EQUAL "3.10" )
cmake_host_system_information(RESULT OSTAP_OS_NAME QUERY OS_NAME)
cmake_host_system_information(RESULT OSTAP_OS_VERSION QUERY OS_VERSION)
cmake_host_system_information(RESULT OSTAP_OS_RELEASE QUERY OS_RELEASE)
endif()
if ( ${CMAKE_VERSION} VERSION_GREATER_EQUAL "3.15" )
## https://cmake.org/cmake/help/latest/policy/CMP0094.html
cmake_policy ( SET CMP0094 NEW )
endif()
if ( ${CMAKE_CXX_COMPILER_LAUNCHER} )
else ()
find_program(CCACHE_PROGRAM ccache)
if(CCACHE_PROGRAM)
# Support Unix Makefiles and Ninja
## set_property(GLOBAL PROPERTY CXX_COMPILER_LAUNCHER "${CCACHE_PROGRAM}")
set(CMAKE_CXX_COMPILER_LAUNCHER ${CCACHE_PROGRAM} )
endif()
endif()
project(ostap LANGUAGES CXX)
include(CTest)
set(OSTAP_VERSION_MAJOR 1)
set(OSTAP_VERSION_MINOR 13)
set(OSTAP_VERSION_PATCH 9)
set(OSTAP_VERSION_TWEAK 1)
set(OSTAP_VERSION ${OSTAP_VERSION_MAJOR}.${OSTAP_VERSION_MINOR}.${OSTAP_VERSION_PATCH}.${OSTAP_VERSION_TWEAK})
message ( "----> OSTAP version : " ${OSTAP_VERSION} )
set(OSTAP_PYTHON_SITE_DIR "")
# Use compiler from PATH, not the system one
# http://stackoverflow.com/a/29904501/504346
find_program(CMAKE_C_COMPILER NAMES $ENV{CC} gcc PATHS ENV PATH NO_DEFAULT_PATH)
find_program(CMAKE_CXX_COMPILER NAMES $ENV{CXX} g++ PATHS ENV PATH NO_DEFAULT_PATH)
message ( "----> C-compiler : " $ENV{CC} )
message ( "----> C++-compiler : " $ENV{CXX} )
if ( CMAKE_C_COMPILER_ID )
message ( "----> C-compiler ID : " ${CMAKE_C_COMPILER_ID} )
endif()
if ( CMAKE_CXX_COMPILER_ID )
message ( "----> C++-compiler ID : " ${CMAKE_CXX_COMPILER_ID} )
endif()
if ( CMAKE_C_COMPILER_VERSION )
message ( "----> C-compiler vers : " ${CMAKE_C_COMPILER_VERSION} )
endif()
if ( CMAKE_CXX_COMPILER_VERSION )
message ( "----> C++-compiler vers : " ${CMAKE_CXX_COMPILER_VERSION} )
endif()
if ( CMAKE_CXX_COMPILER_LAUNCHER )
message ( "----> C++-launcher : " ${CMAKE_CXX_COMPILER_LAUNCHER} )
endif()
# You need to tell CMake where to find the ROOT installation. This can be done in a number of ways:
# - ROOT built with classic configure/make use the provided $ROOTSYS/etc/cmake/FindROOT.cmake
# - ROOT built with CMake. Add in CMAKE_PREFIX_PATH the installation prefix for ROOT
list(APPEND CMAKE_PREFIX_PATH $ENV{ROOTSYS})
if ( CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT )
set ( CMAKE_INSTALL_PREFIX ${CMAKE_CURRENT_SOURCE_DIR}/install CACHE PATH "..." FORCE )
endif ( )
add_subdirectory(source)
add_subdirectory(ostap)
add_subdirectory(examples)
add_subdirectory(scripts)
## add_subdirectory(docs)
configure_file(${CMAKE_SOURCE_DIR}/CTestCustom.cmake ${CMAKE_BINARY_DIR})
### where to put the libraries
set(LIBRARY_OUTPUT_PATH "${CMAKE_BINARY_DIR}/lib")
### where to put the executables
set(EXECUTABLE_OUTPUT_PATH "${CMAKE_BINARY_DIR}/bin")
# build a CPack driven installer package
include (InstallRequiredSystemLibraries)
set (CPACK_RESOURCE_FILE_LICENSE "${CMAKE_CURRENT_SOURCE_DIR}/LICENSE")
set (CPACK_PACKAGE_VERSION_MAJOR "${OSTAP_VERSION_MAJOR}")
set (CPACK_PACKAGE_VERSION_MINOR "${OSTAP_VERSION_MINOR}")
set (CPACK_PACKAGE_VERSION_PATCH "${OSTAP_VERSION_PATCH}")
set (CPACK_PACKAGE_VERSION_TWEAK "${OSTAP_VERSION_TWEAK}")
set (CPACK_PACKAGE_ICON ${CMAKE_CURRENT_SOURCE_DIR}/docs/ostap.jpg )
if ( ${CMAKE_VERSION} VERSION_GREATER_EQUAL "3.7" )
set ( CPACK_PACKAGE_CHECKSUM "SHA1" )
endif()
include (CPack)