-
Notifications
You must be signed in to change notification settings - Fork 401
/
CMakeLists.txt
64 lines (48 loc) · 1.57 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
cmake_minimum_required(VERSION 3.24)
project(xyber_x1_infer LANGUAGES C CXX)
# Set cmake path
list(APPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/cmake)
# Some option
option(XYBER_X1_INFER_BUILD_TESTS "Build test" OFF)
option(XYBER_X1_INFER_SIMULATION "Build simulation" OFF)
# Some necessary settings
set(CMAKE_CXX_STANDARD 20)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_CXX_EXTENSIONS OFF)
set(INSTALL_CONFIG_NAME ${PROJECT_NAME}-config)
# Master project configuration
if(CMAKE_CURRENT_SOURCE_DIR STREQUAL CMAKE_SOURCE_DIR)
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR})
set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR})
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR})
set(CMAKE_CXX_VISIBILITY_PRESET hidden)
set(CMAKE_CXX_VISIBLITY_INLINES_HIDDEN ON)
set(BUILD_SHARED_LIBS OFF)
if(UNIX)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fPIC")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fPIC")
if(XYBER_X1_INFER_BUILD_TESTS)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} --coverage")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} --coverage")
endif()
endif()
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
endif()
# Include cmake module
include(NamespaceTool)
if(XYBER_X1_INFER_BUILD_TESTS)
include(GetGTest)
enable_testing()
endif()
set(YAML_CPP_INSTALL ON)
include(GetAimRT)
find_package(rclcpp REQUIRED)
# Add subdirectory
add_subdirectory(src)
# Install
install(
DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/cmake
DESTINATION ./
FILES_MATCHING
PATTERN "*.cmake")
install(EXPORT ${INSTALL_CONFIG_NAME} DESTINATION lib/cmake/${PROJECT_NAME})