-
Notifications
You must be signed in to change notification settings - Fork 15
/
CMakeLists.txt
61 lines (51 loc) · 1.92 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
# ~~~
# @file CMakeLists.txt
# @author Ignacio Vizzo [[email protected]]
#
# Copyright (c) 2020 Ignacio Vizzo, all rights reserved
cmake_minimum_required(VERSION 3.1)
project(starter_project)
# Set build type if not set.
if(NOT CMAKE_BUILD_TYPE)
set(CMAKE_BUILD_TYPE Release)
endif()
# Build options
option(ENABLE_CPPCHECK "Enable static analysis with cppcheck" ON)
option(ENABLE_CLANG_TIDY "Enable static analysis with clang-tidy" ON)
option(ENABLE_COVERAGE "Enable coverage reporting" OFF)
# Attempt to find OpenCV4 on your system, for more details please read
# /usr/share/OpenCV/OpenCVConfig.cmake
find_package(OpenCV 4 REQUIRED)
if(OpenCV_FOUND)
message(STATUS "Found OpenCV version ${OpenCV_VERSION}")
message(STATUS "OpenCV directories: ${OpenCV_INCLUDE_DIRS}")
include_directories(${OpenCV_INCLUDE_DIRS})
else()
message(FATAL_ERROR "OpenCV not found, please read the README.md")
endif(OpenCV_FOUND)
# Enable testing
enable_testing()
find_package(GTest REQUIRED)
# Set additional flags.
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
set(CMAKE_CXX_FLAGS "-Wall -Wextra")
set(CMAKE_CXX_FLAGS_DEBUG "-g -O0")
set(CMAKE_CXX_FLAGS_RELEASE "-O3")
set(CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake")
# Code Coverage, clang-format, clan=tidy, cppcheck, Configuration:
include(TestCoverage)
include(ClangFormat)
include(StaticAnalyzers)
include_directories(${CMAKE_CURRENT_SOURCE_DIR}/src/)
include_directories(${CMAKE_CURRENT_SOURCE_DIR}/src/lib/)
include_directories(${CMAKE_CURRENT_SOURCE_DIR}/include/)
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR})
# Use this directory to test your installation script
set(CMAKE_INSTALL_PREFIX ${PROJECT_SOURCE_DIR}/results)
install(DIRECTORY ${CMAKE_SOURCE_DIR}/include/
DESTINATION ${CMAKE_INSTALL_PREFIX}/include/)
# After all are setup is done, we can go to our src/ directory to build our
# files
add_subdirectory(src)
add_subdirectory(tests)