-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathCMakeLists.txt
More file actions
67 lines (56 loc) · 2.58 KB
/
CMakeLists.txt
File metadata and controls
67 lines (56 loc) · 2.58 KB
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
cmake_minimum_required(VERSION 3.21.1 FATAL_ERROR)
project(epf LANGUAGES CXX VERSION 0.0.1)
# For most projects, on non-Windows platforms it is advisable to explicitly set CMAKE_INSTALL_PREFIX to
# a FHS-compliant /opt/... path. This should generally be done only in the top level CMakeLists.txt and
# it should be protected by an appropriate check that the project is in fact the top level of the source
# tree (to support hierarchical project arrangements).
if (NOT WIN32 AND CMAKE_SOURCE_DIR STREQUAL CMAKE_CURRENT_SOURCE_DIR)
set(CMAKE_INSTALL_PREFIX "/opt/${PROJECT_NAME}")
endif ()
list(APPEND CMAKE_MODULE_PATH "${PROJECT_SOURCE_DIR}/cmake" "${CMAKE_BINARY_DIR}")
include(ProjectOption)
# cmake-format: off
configure_project_option(
WARNINGS
TARGET project_warning
LINKER
TARGET project_option
LINKER_NAME mold
LINKER_PATH /usr/local/libexec/mold
SANITIZER
TARGET project_option
IPO
DISABLE_FOR_CONFIG Debug Coverage
PROJ_TARGET
TARGET epf
CXX_STD 17
)
# cmake-format: on
find_package(Boost REQUIRED)
find_package(range-v3 REQUIRED)
find_package(fmt REQUIRED)
find_package(Eigen3 3.4.0 EXACT REQUIRED)
# todo: test install command
add_library(epf::epf ALIAS epf)
target_link_libraries(epf INTERFACE range-v3::range-v3 Eigen3::Eigen)
option(EPF_TEST_ENABLE "Enable epf unit testing" OFF)
if (${EPF_TEST_ENABLE})
add_subdirectory(test)
endif ()
option(EPF_BUILD_EXAMPLE "Build epf example code" ON)
if (${EPF_BUILD_EXAMPLE})
add_subdirectory(example)
endif ()
include(CMakePackageConfigHelpers)
write_basic_package_version_file(${CMAKE_CURRENT_BINARY_DIR}/epf-config-version.cmake VERSION ${epf_VERSION} COMPATIBILITY ExactVersion
ARCH_INDEPENDENT)
include(GNUInstallDirs)
install(TARGETS epf EXPORT epf-targets INCLUDES DESTINATION ${CMAKE_INSTALL_INCLUDEDIR})
# this location is both FHS and ROS compatible
set(ConfigPackageLocation share/epf/cmake)
install(EXPORT epf-targets FILE epf-targets.cmake NAMESPACE epf:: DESTINATION ${ConfigPackageLocation})
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/epf-config-version.cmake cmake/epf-config.cmake DESTINATION ${ConfigPackageLocation})
# If the project does not define framework targets, and it can use CMake 3.23 or later for its minimum
# version, file sets (target_source) should be preferred. For all other cases, headers can be installed
# more generically using install(FILES) or install(DIRECTORY).
install(DIRECTORY include/ DESTINATION ${CMAKE_INSTALL_INCLUDEDIR} FILES_MATCHING PATTERN *.hpp)