forked from milq/milq
-
Notifications
You must be signed in to change notification settings - Fork 0
/
CMakeLists.txt
89 lines (79 loc) · 3.19 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
cmake_minimum_required(VERSION 2.8.12)
project(library)
# -----------------------------------------------
# USER DEFINED VARIABLES
# -----------------------------------------------
option(BUILD_DOC "Build documentation with Doxygen" ON)
option(BUILD_EXAMPLES "Build examples to test functionality" ON)
option(BUILD_SHARED_LIBS "Build shared libraries, set OFF to static" ON)
# -----------------------------------------------
# BUILD TYPE CONFIGURATION
# -----------------------------------------------
if (NOT CMAKE_BUILD_TYPE)
set(CMAKE_BUILD_TYPE Debug)
endif()
# -----------------------------------------------
# COMPILER FLAGS
# -----------------------------------------------
if(${CMAKE_COMPILER_IS_GNUCXX})
if (${CMAKE_BUILD_TYPE} STREQUAL "Debug")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11 -Wall -Wextra -pedantic")
endif()
if (${CMAKE_BUILD_TYPE} STREQUAL "Release")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11 -O3 -msse4.1 -pthread")
endif()
endif()
# -----------------------------------------------
# DEPENDENCIES (uncomment what is needed)
# -----------------------------------------------
# find_package(OpenCV REQUIRED)
# find_package(OpenGL REQUIRED)
# find_package(Qt5Quick REQUIRED)
# find_package(Qt5Widgets REQUIRED)
# -----------------------------------------------
# INCLUDE DIRECTORIES (uncomment what is needed)
# -----------------------------------------------
include_directories(include)
# include_directories(${OpenCV_INCLUDE_DIRS})
# -----------------------------------------------
# SHARED LIBS
# -----------------------------------------------
if (BUILD_SHARED_LIBS)
set(LIB_COMPONENTS ${PROJECT_NAME})
else()
set(LIB_COMPONENTS ${REQUIRED_LIBRARIES} ${PROJECT_NAME})
endif()
# -----------------------------------------------
# SUBDIRECTORIES
# -----------------------------------------------
add_subdirectory(src)
add_subdirectory(examples)
# -----------------------------------------------
# DOCUMENTATION
# -----------------------------------------------
if(BUILD_DOC)
find_package(Doxygen)
if(DOXYGEN_FOUND)
configure_file(${PROJECT_SOURCE_DIR}/doc/Doxygen/Doxyfile.in ${PROJECT_BINARY_DIR}/doc/Doxyfile @ONLY)
add_custom_target(${PROJECT_NAME}_doc ALL ${DOXYGEN_EXECUTABLE} ${PROJECT_BINARY_DIR}/doc/Doxyfile)
endif()
endif()
# -----------------------------------------------
# CONFIGURE FILE
# -----------------------------------------------
configure_file("${PROJECT_SOURCE_DIR}/cmake/config.cmake.in" "${PROJECT_BINARY_DIR}/${PROJECT_NAME}Config.cmake" @ONLY)
install(FILES "${PROJECT_BINARY_DIR}/${PROJECT_NAME}Config.cmake" DESTINATION lib/cmake/${PROJECT_NAME}/)
# -----------------------------------------------
# BUILD SUMARY
# -----------------------------------------------
message("")
message("---------------------------------------------")
message(${PROJECT_NAME} " Configuration Summary")
message("")
message("Installation prefix: " ${CMAKE_INSTALL_PREFIX})
message("Build type: " ${CMAKE_BUILD_TYPE})
message("Build with documentation: " ${BUILD_DOC})
message("Build examples: " ${BUILD_EXAMPLES})
message("Build library as shared: " ${BUILD_SHARED_LIBS})
message("---------------------------------------------")
message("")