-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathCMakeLists.txt
82 lines (52 loc) · 2.91 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
# ──────────────────────────────────────────────────────────────────────────── #
# Project #
cmake_minimum_required(VERSION 3.15.0 FATAL_ERROR)
project(point-cloud-denoising LANGUAGES CXX VERSION 1.0.0)
set(CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/cmake/modules" ${CMAKE_MODULE_PATH})
# ──────────────────────────────────────────────────────────────────────────── #
# Flags #
# Define CMake flags related to C++, some compilation flags and library flags #
# CMake flags
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_CXX_EXTENSIONS OFF)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fPIC -pthread")
set(CMAKE_SUPPRESS_DEVELOPER_WARNINGS 1 CACHE INTERNAL "No dev warnings")
# Compilation flags
if(MSVC)
# MSVC https://msdn.microsoft.com/en-us/library/thxezb7y.aspx
add_compile_options(/MP /W4 /WX)
else()
# Gcc https://gcc.gnu.org/onlinedocs/gcc/Warning-Options.html
# Clang http://clang.llvm.org/docs/UsersManual.html
add_compile_options(-fdiagnostics-show-option -Wall -Wextra -pedantic -Werror)
endif()
# Sanitize flags
if(CMAKE_BUILD_TYPE STREQUAL "Debug")
find_package(Sanitizers)
endif()
# Ignore PCL errors in Clang
if(CMAKE_CXX_COMPILER_ID MATCHES "Clang")
add_compile_options(-Wno-gnu-anonymous-struct -Wno-nested-anon-types)
endif()
# ──────────────────────────────────────────────────────────────────────────── #
# Find packages #
# OpenCV
find_package(OpenCV CONFIG REQUIRED) # ${OpenCV_LIBRARIES}
# pugixml
find_package(pugixml CONFIG REQUIRED) # pugixml
# ──────────────────────────────────────────────────────────────────────────── #
# Add targets #
add_subdirectory(point_cloud_denoising)
# ──────────────────────────────────────────────────────────────────────────── #
# Uninstallation #
if(NOT TARGET uninstall)
configure_file(
"${CMAKE_SOURCE_DIR}/cmake/cmake_uninstall.cmake.in"
"${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake"
IMMEDIATE @ONLY
)
add_custom_target(uninstall
COMMAND ${CMAKE_COMMAND} -P ${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake
)
endif()