-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathCMakeLists.txt
73 lines (56 loc) · 2.3 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)
project(fhiclcpp VERSION 23.06 LANGUAGES CXX)
if(NOT DEFINED CMAKE_INSTALL_PREFIX OR
"${CMAKE_INSTALL_PREFIX}x" STREQUAL "x" OR
"${CMAKE_INSTALL_PREFIX}x" STREQUAL "/usr/localx")
set(CMAKE_INSTALL_PREFIX "${CMAKE_BINARY_DIR}/${CMAKE_SYSTEM_NAME}")
endif()
if(NOT DEFINED CMAKE_BUILD_TYPE OR
"${CMAKE_BUILD_TYPE}x" STREQUAL "x")
set(CMAKE_BUILD_TYPE Release)
endif()
option(DOTEST "Whether to compile tests" OFF)
set(DOTEST_CONFIG FALSE)
if(DOTEST)
enable_testing()
set(DOTEST_CONFIG TRUE)
endif()
if(NOT DEFINED CMAKE_CXX_STANDARD OR CMAKE_CXX_STANDARD LESS 14)
set(CMAKE_CXX_STANDARD 14)
endif()
include (${PROJECT_SOURCE_DIR}/cmake/Modules/fhiclcppDependencies.cmake)
add_library(fhiclcpp_includes INTERFACE)
target_include_directories(fhiclcpp_includes INTERFACE
$<BUILD_INTERFACE:${PROJECT_SOURCE_DIR}>
$<INSTALL_INTERFACE:include>)
target_link_libraries(fhiclcpp_includes INTERFACE linedoc::includes)
set_target_properties(fhiclcpp_includes PROPERTIES EXPORT_NAME fhiclcpp::includes)
install(TARGETS fhiclcpp_includes EXPORT fhiclcppTargets)
add_library(fhiclcpp::includes ALIAS fhiclcpp_includes)
#add a second alias for drop-in compatibility with official standalone fhiclcpp
add_library(fhiclcpp::fhiclcpp ALIAS fhiclcpp_includes)
add_subdirectory(fhiclcpp)
include(CMakePackageConfigHelpers)
write_basic_package_version_file(
"${PROJECT_BINARY_DIR}/fhiclcppConfigVersion.cmake"
VERSION ${PROJECT_VERSION}
COMPATIBILITY AnyNewerVersion
)
configure_package_config_file(
"${CMAKE_CURRENT_LIST_DIR}/cmake/Templates/fhiclcppConfig.cmake.in"
"${PROJECT_BINARY_DIR}/fhiclcppConfig.cmake"
INSTALL_DESTINATION cmake
NO_SET_AND_CHECK_MACRO
NO_CHECK_REQUIRED_COMPONENTS_MACRO
)
install(EXPORT fhiclcppTargets
DESTINATION lib/cmake/fhiclcpp )
install(FILES "${PROJECT_BINARY_DIR}/fhiclcppConfigVersion.cmake"
"${PROJECT_BINARY_DIR}/fhiclcppConfig.cmake"
DESTINATION lib/cmake/fhiclcpp)
configure_file(${CMAKE_CURRENT_LIST_DIR}/cmake/Templates/setup.fhiclcpp.sh.in ${PROJECT_BINARY_DIR}/setup.fhiclcpp.sh @ONLY)
install(PROGRAMS ${PROJECT_BINARY_DIR}/setup.fhiclcpp.sh DESTINATION bin)
if(DOTEST)
file(GLOB EXAMPLE_FCL fcl/*.fcl)
install(FILES ${EXAMPLE_FCL} DESTINATION ${CMAKE_INSTALL_PREFIX}/fcl)
endif()