Skip to content

Commit f65e373

Browse files
Corrected find_package(Python...) and added a new variable OPENFHE_REQUIRED_VERSION to specify the OpenFHE version externally"
1 parent 9de2de4 commit f65e373

1 file changed

Lines changed: 9 additions & 11 deletions

File tree

CMakeLists.txt

Lines changed: 9 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -8,14 +8,19 @@ set(OPENFHE_PYTHON_VERSION_PATCH 0)
88
set(OPENFHE_PYTHON_VERSION_TWEAK 0)
99
set(OPENFHE_PYTHON_VERSION ${OPENFHE_PYTHON_VERSION_MAJOR}.${OPENFHE_PYTHON_VERSION_MINOR}.${OPENFHE_PYTHON_VERSION_PATCH}.${OPENFHE_PYTHON_VERSION_TWEAK})
1010

11+
# OpenFHE version can be specified externally (-DOPENFHE_REQUIRED_VERSION=1.3.0)
12+
set(OPENFHE_REQUIRED_VERSION "1.3.0" CACHE STRING "Required OpenFHE version")
13+
1114
set(CMAKE_CXX_STANDARD 17)
1215
option( BUILD_STATIC "Set to ON to include static versions of the library" OFF)
1316

1417
if(APPLE)
1518
set(CMAKE_CXX_VISIBILITY_PRESET default)
1619
endif()
1720

18-
find_package(OpenFHE 1.3.0 REQUIRED)
21+
find_package(OpenFHE ${OPENFHE_REQUIRED_VERSION} REQUIRED)
22+
message(STATUS "Building with OpenFHE version: ${OPENFHE_REQUIRED_VERSION}")
23+
1924
set(PYBIND11_FINDPYTHON ON)
2025
find_package(pybind11 REQUIRED)
2126

@@ -66,20 +71,13 @@ pybind11_add_module(openfhe
6671
### Python installation
6772
# Allow the user to specify the path to Python executable (if not provided, find it)
6873
option(PYTHON_EXECUTABLE_PATH "Path to Python executable" "")
69-
70-
if(NOT PYTHON_EXECUTABLE_PATH)
71-
# Find Python and its development components
72-
find_package(Python REQUIRED COMPONENTS Interpreter Development)
73-
else()
74-
# Set Python_EXECUTABLE to the specified path
74+
if(PYTHON_EXECUTABLE_PATH)
7575
set(Python_EXECUTABLE "${PYTHON_EXECUTABLE_PATH}")
7676
endif()
77-
78-
# Find Python interpreter
79-
find_package(PythonInterp REQUIRED)
77+
find_package(Python REQUIRED COMPONENTS Interpreter Development)
8078

8179
# Check Python version
82-
if(${PYTHON_VERSION_MAJOR} EQUAL 3 AND ${PYTHON_VERSION_MINOR} GREATER_EQUAL 10)
80+
if(${Python_VERSION_MAJOR} EQUAL 3 AND ${Python_VERSION_MINOR} GREATER_EQUAL 10)
8381
execute_process(
8482
COMMAND "${Python_EXECUTABLE}" -c "from sys import exec_prefix; print(exec_prefix)"
8583
OUTPUT_VARIABLE PYTHON_SITE_PACKAGES

0 commit comments

Comments
 (0)