-
Notifications
You must be signed in to change notification settings - Fork 79
/
CMakeLists.txt
86 lines (67 loc) · 2.5 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
# Common variables.
cmake_minimum_required (VERSION 2.8)
project (munkres-cpp)
set (munkres-cpp_VERSION_MAJOR 2)
set (munkres-cpp_VERSION_MINOR 0)
set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11")
set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Wextra")
set (CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS} -O0 -ggdb3 -DDEBUG")
set (CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS} -O3")
include_directories (${PROJECT_SOURCE_DIR}/src)
include_directories (${PROJECT_SOURCE_DIR}/src/adapters)
# Sources.
set (
MunkresCppLib_SOURCES
${PROJECT_SOURCE_DIR}/src/munkres.cpp
)
# Headers.
set (
MunkresCppLib_HEADERS
${PROJECT_SOURCE_DIR}/src/matrix.h
${PROJECT_SOURCE_DIR}/src/matrix.cpp
${PROJECT_SOURCE_DIR}/src/munkres.h
)
add_subdirectory(${PROJECT_SOURCE_DIR}/src/adapters)
# Library.
add_library (
munkres STATIC
${MunkresCppLib_SOURCES}
)
install (TARGETS munkres DESTINATION lib PERMISSIONS OWNER_READ OWNER_WRITE GROUP_READ WORLD_READ)
install (FILES ${MunkresCppLib_HEADERS} DESTINATION include/munkres PERMISSIONS OWNER_READ OWNER_WRITE GROUP_READ WORLD_READ)
# Binary example
set (MunkresCppBin_SOURCES ${PROJECT_SOURCE_DIR}/examples/main.cpp)
add_executable (munkres.bin EXCLUDE_FROM_ALL ${MunkresCppBin_SOURCES})
target_link_libraries (munkres.bin munkres)
add_custom_target (example)
add_dependencies (example munkres.bin)
option(MUNKRESCPP_DEVEL_MODE "Configure project in development mode." OFF)
if (MUNKRESCPP_DEVEL_MODE)
# Enable the ExternalProject_Add directive.
# Which used for getting external tools for the Project.
include (ExternalProject)
# Testing
add_subdirectory (tests)
# Benchmarking
add_subdirectory (benchmarks)
# Custom target to build everything.
add_custom_target (full)
add_dependencies (
full
munkres
example
tests
benchmarks
)
# celero needs curses library
#find_package(Curses)
#include_directories(${CURSES_INCLUDE_DIR})
# Static code analyse.
set (CppCheck_REPORT ${PROJECT_BINARY_DIR}/cppcheck.report)
add_custom_command (
OUTPUT ${CppCheck_REPORT}
COMMAND cppcheck ${MunkresCppLib_SOURCES} ${MunkresCppBin_SOURCES} -I${PROJECT_SOURCE_DIR}/src -I${PROJECT_SOURCE_DIR} --enable=all --force --inconclusive > cppcheck.report 2>&1
)
add_custom_target (cppcheck DEPENDS ${CppCheck_REPORT})
set_directory_properties (PROPERTIES ADDITIONAL_MAKE_CLEAN_FILES ${CppCheck_REPORT})
endif (MUNKRESCPP_DEVEL_MODE)