forked from opencv/ade
-
Notifications
You must be signed in to change notification settings - Fork 0
/
CMakeLists.txt
70 lines (57 loc) · 2.06 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
# Copyright (C) 2018 Intel Corporation
#
#
# SPDX-License-Identifier: Apache-2.0
#
cmake_minimum_required(VERSION 3.2)
project(ade)
option(ENABLE_ADE_TESTING "Build tests, require google test" OFF)
option(BUILD_ADE_TUTORIAL "Build tutorial samples" OFF)
option(FORCE_ADE_ASSERTS "Always enable ADE_ASSERT" OFF)
option(BUILD_ADE_DOCUMENTATION "Build doxygen documentation" OFF)
# TODO: this is horrible hack, we must follow cmake
# build/install policy
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib)
set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib)
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin)
function(add_security_flags target)
if(UNIX)
target_compile_definitions( ${target} PRIVATE _FORTIFY_SOURCE=2 )
if( ${CMAKE_CXX_COMPILER_ID} STREQUAL "GNU")
if(CMAKE_CXX_COMPILER_VERSION VERSION_LESS 4.9)
target_compile_options( ${target} PRIVATE -fstack-protector)
else()
target_compile_options( ${target} PRIVATE -fstack-protector-strong)
endif()
elseif(${CMAKE_CXX_COMPILER_ID} STREQUAL "Intel")
target_compile_options( ${target} PRIVATE -fstack-protector-strong)
endif()
elseif(WIN32)
target_compile_options( ${target} PRIVATE /GS /DynamicBase)
if("${CMAKE_SIZEOF_VOID_P}" STREQUAL "4")
# These options for 32 bit builds only
target_compile_options( ${target} PRIVATE /SAFESEH /NXCOMPAT )
endif()
endif()
endfunction()
set(CMAKE_CXX_STANDARD 11)
if (MSVC)
add_definitions(-D_SCL_SECURE_NO_WARNINGS)
endif(MSVC)
add_subdirectory(sources/ade/)
if(ENABLE_ADE_TESTING)
enable_testing()
add_subdirectory(sources/tests)
endif()
if(BUILD_ADE_TUTORIAL)
add_subdirectory(tutorial)
endif()
# cpack
if(CMAKE_BUILD_TYPE STREQUAL "Release")
set(CPACK_STRIP_FILES ON)
endif()
set(CPACK_PACKAGE_VERSION ${THE_PROJECT_VERSION})
set(CPACK_INCLUDE_TOPLEVEL_DIRECTORY OFF)
set(CPACK_ARCHIVE_COMPONENT_INSTALL ON)
set(CPACK_GENERATOR "ZIP")
include(CPack)