-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCMakeLists.txt
82 lines (64 loc) · 2.19 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
cmake_minimum_required(VERSION 3.16)
project(thor_trajectory_lib)
if(NOT CMAKE_BUILD_TYPE)
set(CMAKE_BUILD_TYPE "Release")
#set(CMAKE_BUILD_TYPE "Release")
endif()
if(CMAKE_COMPILER_IS_GNUCXX OR CMAKE_CXX_COMPILER_ID MATCHES "Clang")
if(CMAKE_BUILD_TYPE MATCHES "Release")
add_compile_options(-funroll-loops -Wall -Ofast -flto) #-O3
endif()
if(CMAKE_BUILD_TYPE MATCHES "Debug")
add_compile_options(-Wall -g -Og)
endif()
endif()
set(CMAKE_CXX_STANDARD 20)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
find_package(Eigen3 REQUIRED COMPONENTS Core Dense Geometry)
find_package(cnr_logger REQUIRED)
find_package(cnr_param REQUIRED)
find_package(trajectories_processors_lib REQUIRED)
find_package(thor_math REQUIRED)
set(DEPS
Eigen3::Eigen
cnr_logger::cnr_logger
cnr_param::cnr_param
trajectories_processors_lib::trajectories_processors_lib
thor_math::thor_math
)
add_library(${PROJECT_NAME} SHARED
src/thor_trajectory_processor.cpp)
target_include_directories(${PROJECT_NAME} PUBLIC
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>
$<INSTALL_INTERFACE:include>)
target_link_libraries(${PROJECT_NAME} PUBLIC ${DEPS})
add_library("${PROJECT_NAME}::${PROJECT_NAME}" ALIAS ${PROJECT_NAME})
# Install
install(DIRECTORY include/openmore
DESTINATION include)
install(
TARGETS ${PROJECT_NAME}
EXPORT ${PROJECT_NAME}Targets
ARCHIVE DESTINATION lib
LIBRARY DESTINATION lib
RUNTIME DESTINATION bin
)
install(EXPORT ${PROJECT_NAME}Targets
DESTINATION "share/${PROJECT_NAME}/cmake"
NAMESPACE ${PROJECT_NAME}::
FILE ${PROJECT_NAME}Targets.cmake
)
include(CMakePackageConfigHelpers)
include(GNUInstallDirs)
write_basic_package_version_file(${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}ConfigVersion.cmake
VERSION 0.0.1
COMPATIBILITY AnyNewerVersion)
configure_package_config_file(
${CMAKE_SOURCE_DIR}/cmake_config/${PROJECT_NAME}Config.cmake.in ${PROJECT_NAME}Config.cmake
INSTALL_DESTINATION share/${PROJECT_NAME}/cmake
PATH_VARS CMAKE_INSTALL_INCLUDEDIR CMAKE_INSTALL_LIBDIR
)
install(FILES
${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}Config.cmake
${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}ConfigVersion.cmake
DESTINATION "share/${PROJECT_NAME}/cmake")