-
Notifications
You must be signed in to change notification settings - Fork 2
/
CMakeLists.txt
77 lines (62 loc) · 3.72 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
CMAKE_MINIMUM_REQUIRED(VERSION 3.16 FATAL_ERROR) # CMAKE_CXX_STANDARD
PROJECT(common VERSION 1.30.0.1 LANGUAGES CXX C)
SET(CMAKE_CXX_STANDARD 17)
SET(CMAKE_CXX_STANDARD_REQUIRED ON)
SET(CMAKE_CXX_EXTENSIONS OFF)
SET(CMAKE_C_STANDARD 99)
SET(CMAKE_C_STANDARD_REQUIRED ON)
#SET(CMAKE_C_EXTENSIONS OFF) commented for libev
SET(PROJECT_NAME_TITLE ${PROJECT_NAME} CACHE STRING "Title for ${PROJECT_NAME}")
SET(PROJECT_DOMAIN "https://fastogt.com" CACHE STRING "Internet domain name for ${PROJECT_NAME}")
SET(PROJECT_COMPANYNAME "FastoGT" CACHE STRING "Company name for ${PROJECT_NAME}")
SET(PROJECT_COPYRIGHT "Copyright (C) 2014-2022 ${PROJECT_COMPANYNAME}. All Rights Reserved.")
SET(PROJECT_COMPANYNAME_DOMAIN "fastogt.com" CACHE STRING "Internet domain name for ${PROJECT_NAME}")
SET(PROJECT_MAINTAINER_MAIL "[email protected]" CACHE STRING "Internet mail address for ${PROJECT_NAME} mainteiner")
SET(PROJECT_MAINTAINER_NAME "Alexandr Topilski" CACHE STRING "Name of ${PROJECT_NAME} mainteiner")
SET(PROJECT_GITHUB_FORK "github.com/fastogt/common" CACHE STRING "Git fork of ${PROJECT_NAME}")
SET(PROJECT_GITHUB_ISSUES "github.com/fastogt/common/issues" CACHE STRING "Git issue link for ${PROJECT_NAME}")
SET(PROJECT_BUILD_TYPE_VERSION "release") #alfa, beta, rc, release
STRING(TOLOWER ${PROJECT_NAME} PROJECT_NAME_LOWERCASE)
STRING(TOUPPER ${PROJECT_NAME} PROJECT_NAME_UPPERRCASE)
########################## Options #########################
OPTION(QT_ENABLED "Enable Qt support" OFF)
OPTION(DEVELOPER_ENABLE_TESTS "Enable tests for ${PROJECT_NAME_TITLE} project" OFF)
OPTION(DEVELOPER_CHECK_STYLE "Enable check style for ${PROJECT_NAME_TITLE} project" OFF)
OPTION(DEVELOPER_GENERATE_DOCS "Generate docs api for ${PROJECT_NAME_TITLE} project" OFF)
OPTION(DEVELOPER_ENABLE_COVERALLS "Generate coveralls data" OFF)
OPTION(DEVELOPER_COVERALLS_UPLOAD "Upload the generated coveralls json" ON)
OPTION(DCHECK_ALWAYS_ON "Enable dcheck in release." OFF)
OPTION(BUILD_WITH_RTTI "Build library with rtti flags." ON)
OPTION(BUILD_WITH_FPIC "Build static library with -fPic flags." ON)
##################################DEFAULT VALUES##########################################
IF(NOT CMAKE_BUILD_TYPE)
SET(CMAKE_BUILD_TYPE DEBUG)
ENDIF(NOT CMAKE_BUILD_TYPE)
# If the user did not customize the install prefix,
# set it to live under build so we don't inadvertently pollute /usr/local
IF(CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT)
SET(CMAKE_INSTALL_PREFIX "${CMAKE_BINARY_DIR}/install" CACHE PATH "default install path" FORCE)
ENDIF(CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT)
IF("${PROJECT_SOURCE_DIR}" STREQUAL "${PROJECT_BINARY_DIR}")
MESSAGE(SendError "In-source builds are not allowed.")
ENDIF("${PROJECT_SOURCE_DIR}" STREQUAL "${PROJECT_BINARY_DIR}")
MESSAGE(STATUS "CMAKE_INSTALL_PREFIX: ${CMAKE_INSTALL_PREFIX}")
############################################################################
SET(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_CURRENT_LIST_DIR}/cmake")
INCLUDE(config) ###################
DEFINE_DEFAULT_DEFINITIONS(${BUILD_WITH_RTTI} ${BUILD_WITH_FPIC} OFF)
DEFINE_PROJECT_DEFINITIONS()
# project sources
SET_PROPERTY(GLOBAL PROPERTY USE_FOLDERS ON)
SET(PROJECT_VERSION_HUMAN "${PROJECT_VERSION} Revision: ${PROJECT_VERSION_GIT}")
ADD_DEFINITIONS(-DPROJECT_VERSION_HUMAN="${PROJECT_VERSION_HUMAN}")
IF(DEVELOPER_GENERATE_DOCS)
CREATE_DOCS(${PROJECT_NAME_LOWERCASE} ${CMAKE_SOURCE_DIR}/docs/Doxyfile.in ${CMAKE_CURRENT_BINARY_DIR}/Doxyfile)
ENDIF(DEVELOPER_GENERATE_DOCS)
IF(DCHECK_ALWAYS_ON)
ADD_DEFINITIONS(-DDCHECK_ALWAYS_ON)
ENDIF(DCHECK_ALWAYS_ON)
ADD_SUBDIRECTORY(src)
IF(NOT EXISTS ${CMAKE_SOURCE_DIR}/.git/hooks/pre-commit)
EXECUTE_PROCESS(COMMAND ${CMAKE_SOURCE_DIR}/scripts/create_pre_commit_hook.sh)
ENDIF(NOT EXISTS ${CMAKE_SOURCE_DIR}/.git/hooks/pre-commit)