-
Notifications
You must be signed in to change notification settings - Fork 27
/
CMakeLists.txt
60 lines (49 loc) · 1.68 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
cmake_minimum_required(VERSION 3.5)
project(ament_index_cpp)
# Default to C++14
if(NOT CMAKE_CXX_STANDARD)
set(CMAKE_CXX_STANDARD 14)
endif()
if(CMAKE_COMPILER_IS_GNUCXX OR CMAKE_CXX_COMPILER_ID MATCHES "Clang")
add_compile_options(-std=c++14 -Wall -Wextra -Wpedantic)
endif()
option(
BUILD_SHARED_LIBS
"Global flag to cause add_library() to create shared libraries if on. \
If set to true, this will cause all libraries to be built shared \
unless the library was explicitly added as a static library."
ON)
find_package(ament_cmake REQUIRED)
add_library(${PROJECT_NAME}
src/get_package_prefix.cpp
src/get_package_share_directory.cpp
src/get_packages_with_prefixes.cpp
src/get_resource.cpp
src/get_resources.cpp
src/get_search_paths.cpp
src/has_resource.cpp
)
target_compile_definitions(${PROJECT_NAME} PRIVATE "AMENT_INDEX_CPP_BUILDING_DLL")
target_include_directories(${PROJECT_NAME} PUBLIC
"$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>"
"$<INSTALL_INTERFACE:include>")
ament_export_include_directories(include)
ament_export_libraries(${PROJECT_NAME})
ament_export_targets(export_${PROJECT_NAME} HAS_LIBRARY_TARGET)
if(BUILD_TESTING)
find_package(ament_lint_auto REQUIRED)
ament_lint_auto_find_test_dependencies()
ament_add_gtest(${PROJECT_NAME}_utest test/utest.cpp)
if(TARGET ${PROJECT_NAME}_utest)
target_include_directories(${PROJECT_NAME}_utest PUBLIC include)
target_link_libraries(${PROJECT_NAME}_utest ${PROJECT_NAME})
endif()
endif()
ament_package()
install(DIRECTORY include/
DESTINATION include)
install(TARGETS ${PROJECT_NAME}
EXPORT export_${PROJECT_NAME}
ARCHIVE DESTINATION lib
LIBRARY DESTINATION lib
RUNTIME DESTINATION bin)