Repository navigation
Expand file tree
/
Copy pathCMakeLists.txt
More file actions
52 lines (40 loc) · 1.72 KB
/
Copy pathCMakeLists.txt
File metadata and controls
52 lines (40 loc) · 1.72 KB
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
# © 2026 AO Kaspersky Lab
# Licensed under the MIT License
# Declare and fetch the KasperskyOS-adapted CPython.
cmake_minimum_required (VERSION 3.29)
project (python VERSION 3.13.2)
include (FetchContent)
option (BUILD_SHARED_LIBS "Build using shared libraries" OFF)
# Configure the source location and patch application for CPython.
# The official CPython repository.
set (GIT_REPOSITORY https://github.com/python/cpython.git)
# Specific version to fetch.
set (GIT_TAG v3.13.2)
# Apply KasperskyOS adaptation patch after downloading.
set (GIT_PATCH ${PROJECT_SOURCE_DIR}/KasperskyOS-CE-adaptation.patch)
set (PATCH_COMMAND git apply ${GIT_PATCH})
# Prevent redundant patch application on subsequent builds.
if (CPYTHON_POPULATED)
# Library has already been fetched — skip patching to avoid conflicts.
set (PATCH_COMMAND)
else ()
message (STATUS "Downloading CPython ${GIT_TAG}")
endif ()
if (KOS)
# Integrate the OpenSSL library into the current build.
include (cmake/openssl.cmake)
# Use the default CONFIG_SITE file if not defined.
if (NOT DEFINED CONFIG_SITE)
set (CONFIG_SITE "${CMAKE_CURRENT_SOURCE_DIR}/config.site-${CMAKE_C_COMPILER_TARGET}")
endif ()
endif ()
# Declare the external dependency with patch configuration.
FetchContent_Declare (cpython
GIT_REPOSITORY ${GIT_REPOSITORY}
GIT_TAG ${GIT_TAG}
GIT_SHALLOW YES
PATCH_COMMAND ${PATCH_COMMAND})
# Execute the download and integration of the CPython into the build system.
FetchContent_MakeAvailable (cpython)
# Cache the population state to optimize subsequent builds.
set (CPYTHON_POPULATED ${cpython_POPULATED} CACHE INTERNAL "")