-
Notifications
You must be signed in to change notification settings - Fork 9
/
CMakeLists.txt
73 lines (58 loc) · 2.23 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
cmake_minimum_required(VERSION 3.14 FATAL_ERROR)
#Use the compilers found in the path
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)
SET(Prob3plusplus_VERSION 3.10.4)
project(Prob3plusplus VERSION ${Prob3plusplus_VERSION} LANGUAGES CXX C)
#Changes default install path to be a subdirectory of the build dir.
#Can set build dir at configure time with -DCMAKE_INSTALL_PREFIX=/install/path
if(CMAKE_INSTALL_PREFIX STREQUAL "" OR CMAKE_INSTALL_PREFIX STREQUAL
"/usr/local")
set(CMAKE_INSTALL_PREFIX "${CMAKE_BINARY_DIR}/${CMAKE_SYSTEM_NAME}")
elseif(NOT DEFINED CMAKE_INSTALL_PREFIX)
set(CMAKE_INSTALL_PREFIX "${CMAKE_BINARY_DIR}/${CMAKE_SYSTEM_NAME}")
endif()
if(CMAKE_BUILD_TYPE STREQUAL "")
set(CMAKE_BUILD_TYPE RELWITHDEBINFO)
elseif(NOT DEFINED CMAKE_BUILD_TYPE)
set(CMAKE_BUILD_TYPE RELWITHDEBINFO)
endif()
SET(HEADERS EarthDensity.h
BargerPropagator.h
NeutrinoPropagator.h
mosc.h
mosc3.h)
SET(SOURCE EarthDensity.cc
BargerPropagator.cc
mosc.c
mosc3.c)
add_library(Prob3plusplus SHARED ${SOURCE})
set_target_properties(Prob3plusplus PROPERTIES
PUBLIC_HEADER "${HEADERS}"
EXPORT_NAME Prob3plusplus)
target_include_directories(
Prob3plusplus PUBLIC $<BUILD_INTERFACE:${PROJECT_SOURCE_DIR}>
$<INSTALL_INTERFACE:include>
)
install(TARGETS Prob3plusplus
EXPORT Prob3plusplus-target
LIBRARY DESTINATION lib/
PUBLIC_HEADER DESTINATION include/)
install(EXPORT Prob3plusplus-target
FILE Prob3plusplusTargets.cmake
NAMESPACE Prob3plusplus::
DESTINATION ${CMAKE_INSTALL_PREFIX}/lib/cmake/Prob3plusplus
)
include(CMakePackageConfigHelpers)
configure_package_config_file(
Prob3plusplusConfig.cmake.in ${CMAKE_BINARY_DIR}/Prob3plusplusConfig.cmake
INSTALL_DESTINATION
/this/is/ignored/for/some/reason/thanks/kitware
NO_SET_AND_CHECK_MACRO
NO_CHECK_REQUIRED_COMPONENTS_MACRO)
install(FILES
${CMAKE_BINARY_DIR}/Prob3plusplusConfig.cmake
DESTINATION ${CMAKE_INSTALL_PREFIX}/lib/cmake/Prob3plusplus)
write_basic_package_version_file(${CMAKE_INSTALL_PREFIX}/lib/cmake/Prob3plusplus/Prob3plusplusConfigVersion.cmake
VERSION ${Prob3plusplus_VERSION}
COMPATIBILITY AnyNewerVersion)