forked from PX4/PX4-Matrix
-
Notifications
You must be signed in to change notification settings - Fork 2
/
CMakeLists.txt
90 lines (76 loc) · 2.17 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
cmake_minimum_required(VERSION 2.8)
set(VERSION_MAJOR "0")
set(VERSION_MINOR "1")
set(VERSION_PATCH "0")
project(matrix CXX)
if (NOT CMAKE_BUILD_TYPE)
set(CMAKE_BUILD_TYPE "Debug" CACHE STRING "Build type" FORCE)
message(STATUS "set build type to ${CMAKE_BUILD_TYPE}")
endif()
set_property(CACHE CMAKE_BUILD_TYPE PROPERTY
STRINGS "Debug;Release;RelWithDebInfo;MinSizeRel;Profile")
option (SUPPORT_STDIOSTREAM
"If enabled provides support for << operator (as used with
std::cout)" OFF)
if((SUPPORT_STDIOSTREAM))
add_definitions(-DSUPPORT_STDIOSTREAM)
endif()
set(CMAKE_CXX_FLAGS_PROFILE
${CMAKE_CXX_FLAGS_DEBUG}
--coverage
-fno-inline
-fno-inline-small-functions
-fno-default-inline
)
string(REPLACE ";" " " CMAKE_CXX_FLAGS_PROFILE "${CMAKE_CXX_FLAGS_PROFILE}")
set(CMAKE_CXX_FLAGS
${CMAKE_CXX_FLAGS}
-Wall
-Wno-sign-compare
-Wextra
-Wshadow
-Wfloat-equal
-Wpointer-arith
-Wmissing-declarations
-Wno-unused-parameter
-Werror=format-security
-Werror=array-bounds
#-Wfatal-errors
-Werror=unused-variable
-Werror=reorder
-Werror=uninitialized
-Werror=init-self
-Wcast-qual
-Wconversion
-Wcast-align
-Werror
)
string(REPLACE ";" " " CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}")
enable_testing()
include_directories(${CMAKE_SOURCE_DIR})
file(GLOB_RECURSE COV_SRCS matrix/*.hpp matrix/*.cpp)
add_subdirectory(test)
set(astyle_exe ${CMAKE_BINARY_DIR}/astyle/src/bin/astyle)
add_custom_command(OUTPUT ${astyle_exe}
COMMAND wget http://sourceforge.net/projects/astyle/files/astyle/astyle%202.05.1/astyle_2.05.1_linux.tar.gz -O /tmp/astyle.tar.gz
COMMAND tar -xvf /tmp/astyle.tar.gz
COMMAND cd astyle/src && make -f ../build/gcc/Makefile
WORKING_DIRECTORY ${CMAKE_BINARY_DIR}
)
add_custom_target(check_format
COMMAND scripts/format.sh ${astyle_exe} 0
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
DEPENDS ${astyle_exe}
VERBATIM
)
add_custom_target(format
COMMAND scripts/format.sh ${astyle_exe} 1
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
VERBATIM
DEPENDS ${astyle_exe}
)
set(CPACK_PACKAGE_VERSION_MAJOR ${VERSION_MAJOR})
set(CPACK_PACKAGE_VERSION_MINOR ${VERSION_MINOR})
set(CPACK_PACKAGE_VERSION_PATCH ${VERSION_PATCH})
set(CPACK_PACKAGE_CONTACT "[email protected]")
include(CPack)