-
Notifications
You must be signed in to change notification settings - Fork 23
/
CMakeLists.txt
84 lines (65 loc) · 2.76 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
# SPDX-FileCopyrightText: 2012-2021 Istituto Italiano di Tecnologia (IIT)
# SPDX-License-Identifier: BSD-3-Clause
cmake_minimum_required(VERSION 3.16)
project(YCM VERSION 0.18.1 LANGUAGES NONE)
# Check if the project is the main project or included via FetchContent
if (NOT CMAKE_SOURCE_DIR STREQUAL PROJECT_SOURCE_DIR)
# Project is included via FetchContent
include(${CMAKE_CURRENT_SOURCE_DIR}/tools/UseYCMFromSource.cmake)
# Propagate relevant variables modified by UseYCMFromSource to who called add_subdirectory
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} PARENT_SCOPE)
set(__USEYCMFROMSOURCE_INCLUDED ${__USEYCMFROMSOURCE_INCLUDED} PARENT_SCOPE)
set(YCM_MODULE_DIR ${YCM_MODULE_DIR} PARENT_SCOPE)
return()
endif()
list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/internal-modules")
list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/modules")
include(YCMInternal)
if(EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/.git")
option(YCM_MAINTAINER_MODE "Enable maintainer mode (download all files and enable CPack) - Latest CMake version is recommended" FALSE)
mark_as_advanced(YCM_MAINTAINER_MODE)
endif()
if(YCM_MAINTAINER_MODE)
if(NOT EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/.git")
message(WARNING "Cannot enable maintainer mode outside a git repository. The YCM_MAINTAINER_MODE option will be disabled.")
unset(YCM_MAINTAINER_MODE)
unset(YCM_MAINTAINER_MODE CACHE)
else()
include(YCMPack)
endif()
endif()
include(GNUInstallDirs)
set(YCM_BUILD_MODULE_DIR "${CMAKE_BINARY_DIR}/${CMAKE_INSTALL_DATADIR}/YCM")
set(YCM_INSTALL_MODULE_DIR "${CMAKE_INSTALL_DATADIR}/YCM")
set(YCM_BUILD_CMAKE_DIR "${CMAKE_BINARY_DIR}")
set(YCM_INSTALL_CMAKE_DIR "${CMAKE_INSTALL_DATADIR}/YCM/cmake")
# FIXME
set(YCM_DOC_DIR ${CMAKE_INSTALL_DOCDIR})
set(YCM_MAN_DIR ${CMAKE_INSTALL_MANDIR})
set_property(GLOBAL PROPERTY USE_FOLDERS ON)
add_subdirectory(modules)
add_subdirectory(find-modules)
add_subdirectory(cmake-next)
add_subdirectory(3rdparty)
add_subdirectory(deprecated)
add_subdirectory(build-modules)
add_subdirectory(style-modules)
add_subdirectory(docs)
include(InstallBasicPackageFiles)
install_basic_package_files(YCM
VERSION ${YCM_VERSION}
COMPATIBILITY AnyNewerVersion
ARCH_INDEPENDENT
NO_EXPORT
EXTRA_PATH_VARS_SUFFIX MODULE_DIR
NO_CHECK_REQUIRED_COMPONENTS_MACRO)
include(AddUninstallTarget)
if(UNIX)
# update-sha1sums target makes no sense on windows, since the .sh script
# will fail to execute
add_custom_target(update-sha1sums
COMMAND "${CMAKE_CURRENT_SOURCE_DIR}/tools/update_sha1sums.sh")
endif()
enable_testing()
include(CTest)
add_subdirectory(tests)