-
Notifications
You must be signed in to change notification settings - Fork 7
/
CMakeLists.txt
75 lines (62 loc) · 2.4 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
cmake_minimum_required(VERSION 3.16)
project(lnrr CXX)
set(LNRR_VERSION 0.1.0)
set(PROJECT_SOVERSION 0)
set(CMAKE_CXX_STANDARD 17)
set(CXX_STANDARD_REQUIRED ON)
add_compile_options(-O3)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fopenmp")
option(BUILD_TESTS "Build test suite" ON)
list(APPEND CMAKE_MODULE_PATH "${PROJECT_SOURCE_DIR}/cmake")
find_package(OpenMP REQUIRED)
find_package(Eigen3 3.3.7 REQUIRED)
find_package(Ceres 2.2 REQUIRED)
find_package(Fgt REQUIRED)
find_package(PCL 1.10 REQUIRED)
add_subdirectory(src)
if(BUILD_TESTS)
include(CTest)
add_subdirectory(tests)
endif()
if(NOT CMAKE_BUILD_TYPE)
set(default_cmake_build_type "Release")
message("Setting build type to '${default_cmake_build_type}' as none was specified.")
set(CMAKE_BUILD_TYPE "${default_cmake_build_type}" CACHE
STRING "Choose the type of build." FORCE)
# Set the possible values of build type for cmake-gui
set_property(CACHE CMAKE_BUILD_TYPE PROPERTY STRINGS
"Debug" "Release" "MinSizeRel" "RelWithDebInfo")
endif()
message(STATUS "CMAKE_BUILD_TYPE: ${CMAKE_BUILD_TYPE}")
include(CMakePackageConfigHelpers)
write_basic_package_version_file(${PROJECT_BINARY_DIR}/lnrr-config-version.cmake VERSION ${LNRR_VERSION} COMPATIBILITY AnyNewerVersion)
configure_file(cmake/lnrr-config.cmake ${PROJECT_BINARY_DIR}/lnrr-config.cmake @ONLY)
install(FILES ${PROJECT_BINARY_DIR}/lnrr-config.cmake ${PROJECT_BINARY_DIR}/lnrr-config-version.cmake DESTINATION lib/cmake/lnrr)
# if("${CMAKE_CXX_COMPILER_ID}" MATCHES "Clang")
# target_compile_options(Library-C++
# PUBLIC
# -std=c++11
# PRIVATE
# -Wall
# -pedantic
# -Wno-nested-anon-types
# )
# elseif("${CMAKE_CXX_COMPILER_ID}" MATCHES "GNU")
# target_compile_options(Library-C++
# PUBLIC
# -std=c++11
# -Wno-deprecated-declarations
# PRIVATE
# -Wall
# -pedantic
# -Wno-unknown-pragmas
# )
# endif()
install(TARGETS Library-C++ DESTINATION lib EXPORT lnrr-targets)
install(DIRECTORY include/lnrr DESTINATION include)
install(EXPORT lnrr-targets NAMESPACE Lnrr:: DESTINATION lib/cmake/lnrr)
# Create uninstall command
configure_file("${CMAKE_SOURCE_DIR}/cmake/uninstall_target.cmake.in"
"${CMAKE_BINARY_DIR}/uninstall_target.cmake" IMMEDIATE @ONLY)
add_custom_target(uninstall "${CMAKE_COMMAND}" -P
"${CMAKE_BINARY_DIR}/uninstall_target.cmake")