This repository has been archived by the owner on Oct 3, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCMakeLists.txt
108 lines (84 loc) · 3.81 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
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
###
### CMakeLists for gvc
###
cmake_minimum_required( VERSION 3.2.0 )
######################################################################################
# CMake functions
######################################################################################
SET(CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/cmake )
INCLUDE(FeatureSummary)
INCLUDE(GNUInstallDirs)
######################################################################################
# Project Definition
######################################################################################
SET( PROJECT_NAME "gvc" CACHE INTERNAL "" FORCE )
SET( PROJECT_LIBRARY "gvc" CACHE INTERNAL "" FORCE )
PROJECT( ${PROJECT_NAME} )
SET( GVC_VERSION_MAJOR "0" )
SET( GVC_VERSION_MINOR "0" )
SET( GVC_VERSION_PATCH "1" )
SET( GVC_VERSION "${GVC_VERSION_MAJOR}.${GVC_VERSION_MINOR}.${GVC_VERSION_PATCH}" CACHE INTERNAL "" FORCE )
######################################################################################
# Dependencies
######################################################################################
OPTION( BUILD_DOC "Build Documentation" OFF )
IF( BUILD_DOC )
FIND_PACKAGE(Doxygen)
SET( BUILD_DOC ${Doxygen_FOUND} )
ENDIF()
SET_PACKAGE_PROPERTIES(Doxygen PROPERTIES URL "http://www.doxygen.org/" DESCRIPTION "Doxygen" TYPE OPTIONAL)
OPTION( BUILD_TESTS "Build Google Tests" OFF )
IF( BUILD_TESTS )
FIND_PACKAGE(GTest)
SET( BUILD_DOC ${GTEST_FOUND} )
IF( GTEST_FOUND )
ENABLE_TESTING()
INCLUDE_DIRECTORIES(${GTEST_INCLUDE_DIRS})
ENDIF()
ENDIF()
######################################################################################
# CMake Defin1itions
######################################################################################
SET(CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/cmake )
INCLUDE(FeatureSummary)
# must go before the project command
SET(CMAKE_CONFIGURATION_TYPES "Debug;Release" CACHE STRING "Configs" FORCE)
IF(DEFINED CMAKE_BUILD_TYPE AND CMAKE_VERSION VERSION_GREATER "2.8")
SET_PROPERTY( CACHE CMAKE_BUILD_TYPE PROPERTY STRINGS ${CMAKE_CONFIGURATION_TYPES} )
ENDIF()
SET( CMAKE_CXX_FLAGS "" )
INCLUDE_DIRECTORIES( ${CMAKE_CURRENT_BINARY_DIR} ${CMAKE_CURRENT_SOURCE_DIR} )
######################################################################################
# Configure targets
######################################################################################
OPTION( USE_WERROR "Warnings as errors" OFF )
OPTION( USE_STATIC "Use static libs" OFF )
SET(CMAKE_CXX_STANDARD 14)
if(CMAKE_COMPILER_IS_GNUCXX)
ADD_DEFINITIONS(-std=gnu++0x)
endif()
IF (NOT CMAKE_BUILD_TYPE )
MESSAGE(STATUS "No build type selected, default to Release")
SET(CMAKE_BUILD_TYPE "Release")
ENDIF()
SET( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall" )
IF( USE_WERROR )
SET( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Werror" )
ENDIF()
SET( CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -g -O0" )
SET( CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -O2" )
ADD_FEATURE_INFO(WErrors USE_WERROR "Warnings as errors" )
ADD_SUBDIRECTORY( lib )
ADD_SUBDIRECTORY( app )
CONFIGURE_FILE( ${CMAKE_CURRENT_SOURCE_DIR}/config.h.in ${CMAKE_CURRENT_BINARY_DIR}/config.h )
######################################################################################
# Final information dump
######################################################################################
MESSAGE("")
MESSAGE( STATUS "${PROJECT_NAME} Information" )
MESSAGE( STATUS "Version: " "${GVC_VERSION_STRING}" )
MESSAGE( STATUS "Configuration:" )
MESSAGE( STATUS " Static libs: " "${USE_STATIC}" )
MESSAGE( STATUS " Build type: " "${CMAKE_BUILD_TYPE}" )
MESSAGE( STATUS " Build flags: " "${CMAKE_CXX_FLAGS}" )
FEATURE_SUMMARY(WHAT ALL INCLUDE_QUIET_PACKAGES FATAL_ON_MISSING_REQUIRED_PACKAGES)