Skip to content

Commit 7bbd65c

Browse files
committed
fix: update CMake minimum version and Python target references
1 parent 3ae1bff commit 7bbd65c

2 files changed

Lines changed: 6 additions & 31 deletions

File tree

CMakeLists.txt

Lines changed: 5 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
cmake_minimum_required(VERSION 3.10)
1+
cmake_minimum_required(VERSION 3.19)
22

33
# ##############################################################################
44
# Import CMake modules
@@ -272,36 +272,11 @@ endif()
272272

273273
# Python
274274
find_package(
275-
Python3
275+
Python
276276
COMPONENTS Interpreter Development.Module
277+
OPTIONAL_COMPONENTS Development.SABIModule
277278
REQUIRED)
278-
include_directories(SYSTEM PRIVATE ${Python3_INCLUDE_DIRS})
279-
280-
# Ensure Python::Interpreter target exists (needed by nanobind to avoid
281-
# re-resolving a different Python interpreter).
282-
if(NOT TARGET Python::Interpreter)
283-
add_executable(Python::Interpreter IMPORTED)
284-
# cmake-format: off
285-
set_target_properties(Python::Interpreter PROPERTIES
286-
IMPORTED_LOCATION "${Python3_EXECUTABLE}")
287-
# cmake-format: on
288-
endif()
289-
290-
# Ensure Python::Module target exists (needed for nanobind on Windows)
291-
if(NOT TARGET Python::Module)
292-
if(NOT TARGET Python::Python)
293-
add_library(Python::Python INTERFACE IMPORTED)
294-
set_target_properties(
295-
Python::Python
296-
PROPERTIES INTERFACE_INCLUDE_DIRECTORIES "${Python3_INCLUDE_DIRS}"
297-
INTERFACE_LINK_LIBRARIES "${Python3_LIBRARIES}")
298-
endif()
299-
add_library(Python::Module INTERFACE IMPORTED)
300-
# cmake-format: off
301-
set_target_properties(
302-
Python::Module PROPERTIES INTERFACE_LINK_LIBRARIES "Python::Python")
303-
# cmake-format: on
304-
endif()
279+
include_directories(SYSTEM PRIVATE ${Python_INCLUDE_DIRS})
305280

306281
# BLAS
307282
#
@@ -560,7 +535,7 @@ set(CONFIG_LINES
560535
"BLAS: ${BLA_VENDOR}"
561536
"Code Coverage: ${CODE_COVERAGE_LINE}"
562537
"Clang-Tidy: ${CLANG_TIDY_LINE}"
563-
"Python3: ${Python3_VERSION}"
538+
"Python: ${Python_VERSION}"
564539
"======================================================================")
565540

566541
foreach(line ${CONFIG_LINES})

setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -343,7 +343,7 @@ def build_cmake(self, ext: CMakeExtension) -> None:
343343
cmake_args: list[str] = [
344344
"-DCMAKE_BUILD_TYPE=" + cfg,
345345
"-DCMAKE_LIBRARY_OUTPUT_DIRECTORY=" + extdir,
346-
"-DPython3_EXECUTABLE=" + sys.executable,
346+
"-DPython_EXECUTABLE=" + sys.executable,
347347
*self.set_cmake_user_options(),
348348
]
349349
build_args = ["--config", cfg]

0 commit comments

Comments
 (0)