Skip to content

Commit eb5dbbd

Browse files
committed
Fixed python finding
1 parent c42d35f commit eb5dbbd

File tree

4 files changed

+14
-14
lines changed

4 files changed

+14
-14
lines changed

CMakeLists.txt

+9-9
Original file line numberDiff line numberDiff line change
@@ -46,19 +46,19 @@ else()
4646
message(STATUS "Found xtensor: ${xtensor_INCLUDE_DIRS}/xtensor")
4747
endif()
4848

49-
# Running find_package(PythonInterp) to retrieve the Python version
50-
# which is not exported by Pybind11's cmake.
51-
# Cf. https://github.com/pybind/pybind11/issues/2268
52-
find_package(PythonInterp ${PythonLibsNew_FIND_VERSION} REQUIRED)
49+
find_package(Python COMPONENTS Interpreter REQUIRED)
5350

5451
set(pybind11_REQUIRED_VERSION 2.6.1)
55-
if(TARGET pybind11 OR TARGET pybind11::headers)
56-
# pybind11 has a variable that indicates its version already, so use that
57-
message(STATUS "Found pybind11 v${pybind11_VERSION}")
58-
else()
52+
if (NOT TARGET pybind11::headers)
53+
# Defaults to ON for cmake >= 3.18
54+
# https://github.com/pybind/pybind11/blob/35ff42b56e9d34d9a944266eb25f2c899dbdfed7/CMakeLists.txt#L96
55+
set(PYBIND11_FINDPYTHON OFF)
5956
find_package(pybind11 ${pybind11_REQUIRED_VERSION} REQUIRED)
6057
message(STATUS "Found pybind11: ${pybind11_INCLUDE_DIRS}/pybind11")
61-
endif()
58+
else ()
59+
# pybind11 has a variable that indicates its version already, so use that
60+
message(STATUS "Found pybind11 v${pybind11_VERSION}")
61+
endif ()
6262

6363
# Look for NumPy headers, except if NUMPY_INCLUDE_DIRS is passed,
6464
# which is required under some circumstances (such as wasm, where

cmake/FindNumPy.cmake

+2-2
Original file line numberDiff line numberDiff line change
@@ -40,9 +40,9 @@
4040

4141
# Finding NumPy involves calling the Python interpreter
4242
if(NumPy_FIND_REQUIRED)
43-
find_package(PythonInterp REQUIRED)
43+
find_package(Python COMPONENTS Interpreter REQUIRED)
4444
else()
45-
find_package(PythonInterp)
45+
find_package(Python COMPONENTS Interpreter)
4646
endif()
4747

4848
if(NOT PYTHONINTERP_FOUND)

test/copyGTest.cmake.in

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
# The full license is in the file LICENSE, distributed with this software. #
88
############################################################################
99

10-
cmake_minimum_required(VERSION 2.8.2)
10+
cmake_minimum_required(VERSION 3.29)
1111

1212
project(googletest-download NONE)
1313

test/downloadGTest.cmake.in

+2-2
Original file line numberDiff line numberDiff line change
@@ -7,14 +7,14 @@
77
# The full license is in the file LICENSE, distributed with this software. #
88
############################################################################
99

10-
cmake_minimum_required(VERSION 2.8.2)
10+
cmake_minimum_required(VERSION 3.29)
1111

1212
project(googletest-download NONE)
1313

1414
include(ExternalProject)
1515
ExternalProject_Add(googletest
1616
GIT_REPOSITORY https://github.com/google/googletest.git
17-
GIT_TAG release-1.10.0
17+
GIT_TAG v1.16.0
1818
SOURCE_DIR "${CMAKE_CURRENT_BINARY_DIR}/googletest-src"
1919
BINARY_DIR "${CMAKE_CURRENT_BINARY_DIR}/googletest-build"
2020
CONFIGURE_COMMAND ""

0 commit comments

Comments
 (0)