Skip to content

Commit

Permalink
Update CMakeLists.txt
Browse files Browse the repository at this point in the history
  • Loading branch information
mwydmuch committed Jan 21, 2025
1 parent 07acf72 commit 9895a9d
Showing 1 changed file with 4 additions and 12 deletions.
16 changes: 4 additions & 12 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -81,20 +81,12 @@ if (PYTHON)
find_package(Python ${PYTHON_VERSION} EXACT COMPONENTS Interpreter Development.Module REQUIRED)
endif()

add_subdirectory(pybind11)
add_subdirectory(python)

set(BUILD_PYTHON_VERSION "" CACHE STRING "Version of Python to build bindings for")

if("${BUILD_PYTHON_VERSION}" STREQUAL "")
# Try to find Python 3 if BUILD_PYTHON_VERSION is not set
message(STATUS "BUILD_PYTHON_VERSION is not set, trying to find Python 3, Python_ROOT_DIR is ${Python_ROOT_DIR}")
find_package(Python 3 COMPONENTS Interpreter Development REQUIRED)
set(BUILD_PYTHON_VERSION ${Python_VERSION_MAJOR}.${Python_VERSION_MINOR})
endif()
set(PYBIND11_PYTHON_VERSION ${PYTHON_VERSION})
set(PYBIND11_FINDPYTHON True)

set(PYBIND11_PYTHON_VERSION ${BUILD_PYTHON_VERSION})
set(PYBIND11_FINDPYTHON True)
add_subdirectory(pybind11)
add_subdirectory(python)
endif ()

if (EXE)
Expand Down

0 comments on commit 9895a9d

Please sign in to comment.