-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathCMakeLists.txt
46 lines (36 loc) · 1.25 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
cmake_minimum_required(VERSION 3.8)
project(dr_log)
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_CXX_EXTENSIONS OFF)
add_compile_options(-Wall -Wextra -Wpedantic)
add_link_options(LINKER:--as-needed)
find_package(catkin REQUIRED COMPONENTS)
find_package(Boost REQUIRED COMPONENTS log log_setup system date_time thread)
set(CMAKE_THREAD_PREFER_PTHREAD ON)
find_package(Threads)
catkin_package(
INCLUDE_DIRS include ${Boost_INCLUDE_DIRS}
LIBRARIES ${PROJECT_NAME} ${Boost_LIBRARIES}
)
include_directories(include/${PROJECT_NAME})
include_directories(SYSTEM
${catkin_INCLUDE_DIRS}
${Boost_INCLUDE_DIRS}
)
add_library(${PROJECT_NAME} src/dr_log.cpp)
target_link_libraries(${PROJECT_NAME} ${catkin_LIBRARIES} ${Boost_LIBRARIES} Threads::Threads ${log4cxx_LIBRARIES})
add_executable(${PROJECT_NAME}_test src/test.cpp)
target_link_libraries(${PROJECT_NAME}_test ${PROJECT_NAME} Threads::Threads)
install(
TARGETS "${PROJECT_NAME}"
ARCHIVE DESTINATION "${CATKIN_PACKAGE_LIB_DESTINATION}"
LIBRARY DESTINATION "${CATKIN_PACKAGE_LIB_DESTINATION}"
RUNTIME DESTINATION "${CATKIN_PACKAGE_BIN_DESTINATION}"
COMPONENT runtime
)
install(
DIRECTORY "include/${PROJECT_NAME}/"
DESTINATION "${CATKIN_PACKAGE_INCLUDE_DESTINATION}"
COMPONENT development
)