-
Notifications
You must be signed in to change notification settings - Fork 0
/
CMakeLists.txt
executable file
·72 lines (62 loc) · 2.11 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
cmake_minimum_required(VERSION 3.1 FATAL_ERROR)
project(ibow_lcd LANGUAGES CXX)
message(STATUS "Build type: " ${CMAKE_BUILD_TYPE})
# Setting the flags for profiling information or not
if (CMAKE_BUILD_TYPE MATCHES Release)
message(STATUS "Setting Release options")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall -O3")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -O3")
elseif (CMAKE_BUILD_TYPE MATCHES Debug)
message(STATUS "Setting Debug options")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall -O1 -pg")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -O1 -pg")
endif ()
# Set the C++ standard
set(CMAKE_CXX_STANDARD 14)
# Include GNUInstallDirs to set the installation directories
include(GNUInstallDirs)
# Printing the compiling flags
message(STATUS "Compiler flags: ${CMAKE_CXX_FLAGS}")
# Other packages
find_package(OpenCV REQUIRED) # OpenCV
find_package(Boost REQUIRED COMPONENTS system filesystem)
find_package(obindex2 REQUIRED) # obindex2
find_package(OpenMP REQUIRED) # OpenMP
if (OPENMP_FOUND)
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${OpenMP_C_FLAGS}")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${OpenMP_CXX_FLAGS}")
endif ()
### Targets ###
# Library
add_library(lcdetector
SHARED
src/lcdetector.cc
)
target_link_libraries(lcdetector
${OpenCV_LIBRARIES}
${Boost_LIBRARIES}
obindex2::obindex2
)
target_include_directories(lcdetector
PUBLIC
$<INSTALL_INTERFACE:include>
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>
)
install(TARGETS lcdetector
EXPORT lcdetectorConfig
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
INCLUDES DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/ibow_lcd
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
)
install(DIRECTORY include/ DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/)
export(TARGETS
lcdetector
NAMESPACE lcdetector::
FILE "${CMAKE_CURRENT_BINARY_DIR}/lcdetectorConfig.cmake"
)
install(EXPORT
lcdetectorConfig
DESTINATION "${CMAKE_INSTALL_LIBDIR}/lcdetector/cmake"
NAMESPACE lcdetector::
)