@@ -8,14 +8,19 @@ set(OPENFHE_PYTHON_VERSION_PATCH 0)
88set (OPENFHE_PYTHON_VERSION_TWEAK 0)
99set (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+
1114set (CMAKE_CXX_STANDARD 17)
1215option ( BUILD_STATIC "Set to ON to include static versions of the library" OFF )
1316
1417if (APPLE )
1518 set (CMAKE_CXX_VISIBILITY_PRESET default)
1619endif ()
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+
1924set (PYBIND11_FINDPYTHON ON )
2025find_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)
6873option (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} " )
7676endif ()
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