-
Notifications
You must be signed in to change notification settings - Fork 3
/
CMakeLists.txt
61 lines (49 loc) · 1.77 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
cmake_minimum_required(VERSION 2.8.3)
project(ldlidar_sl)
if(${CMAKE_BUILD_TYPE} MATCHES "Release")
#set(CMAKE_BUILD_TYPE "Release")
set(CMAKE_CXX_FLAGS_RELEASE "$ENV{CXXFLAGS} -std=c++11 -Wall")
#set(CMAKE_CXX_FLAGS_RELEASE "$ENV{CXXFLAGS} -std=c++11 -O3 -Wall")
message(STATUS "Mode: Release")
message(STATUS "optional:-std=c++11 -Wall")
else()
#set(CMAKE_BUILD_TYPE "Debug")
set(CMAKE_CXX_FLAGS_DEBUG "$ENV{CXXFLAGS} -std=c++11 -Wall -Wextra -Wpedantic -g2 -ggdb")
#set(CMAKE_CXX_FLAGS_DEBUG "$ENV{CXXFLAGS} -std=c++11 -O2 -Wall -Wextra -Wpedantic -g2 -ggdb")
message(STATUS "Mode: Debug")
message(STATUS "optional:-std=c++11 -Wall -Wextra -Wpedantic -g2 -ggdb")
endif()
###########
## Build ##
###########
## Specify additional locations of header files
## Your package locations should be listed before other locations
include_directories(
${CMAKE_CURRENT_SOURCE_DIR}/ldlidar_driver/include
)
file(GLOB LDLIDAR_DRI ${CMAKE_CURRENT_SOURCE_DIR}/ldlidar_driver/src/*.cpp)
add_executable(
${PROJECT_NAME}_node
${CMAKE_CURRENT_SOURCE_DIR}/src/linux_demo/demo.cpp
)
add_library(ldlidar_driver_static STATIC
${LDLIDAR_DRI}
)
add_library(ldlidar_driver_shared SHARED
${LDLIDAR_DRI}
)
# rename library name
set_target_properties (ldlidar_driver_static PROPERTIES OUTPUT_NAME "ldlidar_driver")
set_target_properties (ldlidar_driver_shared PROPERTIES OUTPUT_NAME "ldlidar_driver")
# binary file link to library
target_link_libraries(${PROJECT_NAME}_node ldlidar_driver_static pthread)
###########
## Install ##
###########
INSTALL(TARGETS ldlidar_driver_static ldlidar_driver_shared
ARCHIVE DESTINATION lib/ldlidar_driver
LIBRARY DESTINATION share/ldlidar_driver
)
INSTALL(DIRECTORY ${PROJECT_SOURCE_DIR}/ldlidar_driver/include
DESTINATION include/ldlidar_driver
)