forked from iris-ua/iris_lama
-
Notifications
You must be signed in to change notification settings - Fork 0
/
CMakeLists.txt
53 lines (42 loc) · 1.69 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
cmake_minimum_required(VERSION 3.5)
project(iris_lama LANGUAGES CXX C)
set(IRIS_LAMA_VERSION 1.3.1)
# provides default CMAKE_INSTALL_<dir> variables
include(GNUInstallDirs)
# helpers to generate <package>Config.cmake
include(CMakePackageConfigHelpers)
# install location of generated cmake config files
set(ConfigPackageLocation ${CMAKE_INSTALL_LIBDIR}/${CMAKE_PROJECT_NAME}/cmake)
# dependencies
find_package(Eigen3 3.3 REQUIRED NO_MODULE)
# the code
add_subdirectory(src)
# header files, note the "/" after include
install(DIRECTORY include/
DESTINATION ${CMAKE_INSTALL_INCLUDEDIR})
# for build tree / in workspace
export(EXPORT ${CMAKE_PROJECT_NAME}Targets
FILE ${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_PROJECT_NAME}Targets.cmake
NAMESPACE ${CMAKE_PROJECT_NAME}::)
# exported targets
install(EXPORT ${CMAKE_PROJECT_NAME}Targets
FILE ${CMAKE_PROJECT_NAME}Targets.cmake
NAMESPACE ${CMAKE_PROJECT_NAME}::
DESTINATION ${ConfigPackageLocation})
# generate package version file
write_basic_package_version_file(
${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_PROJECT_NAME}ConfigVersion.cmake
VERSION ${IRIS_LAMA_VERSION}
COMPATIBILITY SameMajorVersion)
# generate package configuration file
set(INCLUDE_INSTALL_DIR ${CMAKE_INSTALL_INCLUDEDIR})
configure_package_config_file(
${CMAKE_CURRENT_SOURCE_DIR}/cmake/${CMAKE_PROJECT_NAME}Config.cmake.in
${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_PROJECT_NAME}Config.cmake
INSTALL_DESTINATION ${ConfigPackageLocation}
PATH_VARS INCLUDE_INSTALL_DIR)
# install the package configuration files
install(FILES
${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_PROJECT_NAME}Config.cmake
${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_PROJECT_NAME}ConfigVersion.cmake
DESTINATION ${ConfigPackageLocation})