-
Notifications
You must be signed in to change notification settings - Fork 3
/
CMakeLists.txt
155 lines (123 loc) · 5.44 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
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
##############################################################################
# CMAKE CONFIGURATION
##############################################################################
cmake_minimum_required(VERSION 3.5.1 FATAL_ERROR)
# set project name
project(align_cloud VERSION 1.0.0 LANGUAGES CXX)
# set build type = Release mode
set(CMAKE_BUILD_TYPE Release)
message("\n" "=========================================")
message("Project: ${PROJECT_NAME} ")
message("=========================================")
# set(CMAKE_C_COMPILER /usr/bin/gcc)
# set(CMAKE_CXX_COMPILER /usr/bin/g++)
# set(QT_QMAKE_EXECUTABLE "/usr/lib/x86_64-linux-gnu/qt5/bin/qmake")
# set the include directive in the same project folder
set(CMAKE_INCLUDE_CURRENT_DIR ON)
#set(${PROJECT_SOURCE_DIR} src)
#message(STATUS " source dir: ${PROJECT_SOURCE_DIR}")
# set corresponding package directories
set(PCL_DIR /opt/pcl-1.8.1/build)
#set the CMP0074 policy to old behavior (disable warnings) (CMake 3.12.0-rc1)
if(${CMAKE_VERSION} MATCHES 3.12.0)
cmake_policy(SET CMP0074 OLD)
if(POLICY CMP0048)
cmake_policy(SET CMP0048 NEW)
endif(POLICY CMP0048)
endif()
#set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11")
#message(STATUS "path work: ${CMAKE_BINARY_DIR}")
# Include dependencies of pcl 1.8.1 in project directorie
set(CMAKE_MODULE_PATH ${PCL_DIR}/../cmake/Modules)
# set cmake for use std c++11 and output executable folder to bin
#set(EXECUTABLE_OUTPUT_PATH ${CMAKE_CURRENT_BINARY_DIR}/bin)
# set turn off the output rule messages of cmake
##set_property(GLOBAL PROPERTY RULE_MESSAGES OFF)
##set_property(GLOBAL PROPERTY USE_FOLDERS ON)
#SET(LIBRARIES_EXTERNAL_SOURCE_DIR ${PROJECT_SOURCE_DIR}/libraries CACHE PATH "Libs")
#add_subdirectory(${LIBRARIES_EXTERNAL_SOURCE_DIR} libraries)
#set(CMAKE_INSTALL_PREFIX ${CMAKE_BINARY_DIR})
#set(CMAKE_MODULE_PATH ${OpenMVG_PATH}/../src)
#set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${OpenMP_CXX_FLAGS}")
#set(CMAKE_C_COMPILER /usr/bin/gcc)
#set(CMAKE_CXX_COMPILER /usr/bin/g++)
#set(QT_QMAKE_EXECUTABLE "/usr/lib/x86_64-linux-gnu/qt5/bin/qmake")
#SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fopenmp -lpthread ")
#SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fopenmp -lpthread ")
##############################################################################
# PACKAGES
##############################################################################
message("***********************")
message("point cloud library pkg")
message("***********************")
find_package(PCL 1.9 PATHS ${PCL_DIR} QUIET)
if(PCL_FOUND)
message(STATUS "PCL status:")
message(STATUS " version: ${PCL_VERSION}")
message(STATUS " directorie: ${PCL_DIR}")
else()
message(WARNING " PCL 1.9 not found, attempting 1.8...")
find_package(PCL 1.8 QUIET)
if(PCL_FOUND)
message(STATUS "PCL status:")
message(STATUS " version: ${PCL_VERSION}")
message(STATUS " directorie: ${PCL_DIR}")
else()
message(WARNING " PCL 1.8 not found, attempting 1.7...")
find_package(PCL 1.7 REQUIRED QUIET)
if(PCL_FOUND)
message(STATUS "PCL status:")
message(STATUS " version: ${PCL_VERSION}")
message(STATUS " directorie: ${PCL_DIR}")
else()
message(FATAL_ERROR " ERROR: PCL minimum required version 1.7. Not found")
endif()
endif()
endif()
#if(${PCL_VERBOSITY_LEVEL} STREQUAL Error)
#set(VERBOSITY_LEVEL_ERROR 1)
#endif()
##############################################################################
# HEADERS
##############################################################################
include_directories(
${PCL_INCLUDE_DIRS}
${Boost_INCLUDE_DIRS}
)
include(CheckFunctionExists)
# Use the compile definitions defined in PCL
add_definitions(${PCL_DEFINITIONS})
##############################################################################
# LIBRARIES PATH
##############################################################################
link_directories(${PCL_LIBRARY_DIRS}
)
##############################################################################
# SOURCE CODE
##############################################################################
set(MAIN_SOURCE "src/main.cpp")
set(MAIN_SOURCE2 "src/main_align2.cpp")
##############################################################################
# EXECUTABLES
##############################################################################
add_executable(${PROJECT_NAME}
${MAIN_SOURCE}
)
add_executable(align_cloud2
${MAIN_SOURCE2}
)
##############################################################################
# TARGET LIBRARIES
##############################################################################
target_link_libraries(${PROJECT_NAME}
${PCL_LIBRARIES}
${Boost_LIBRARIES}
)#Eigen3::Eigen)
target_link_libraries(align_cloud2
${PCL_LIBRARIES}
${Boost_LIBRARIES}
)
message("=========================================")
message("Project: ${PROJECT_NAME} COMPILED WITH CMAKE " ${CMAKE_VERSION})
message("=========================================")