Skip to content

Commit

Permalink
BLD: Find Python is more robust way
Browse files Browse the repository at this point in the history
  • Loading branch information
RUrlus committed May 22, 2022
1 parent 6b01bea commit 7405bbd
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 3 deletions.
5 changes: 4 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,10 @@ ELSE()
# ##############################################################################
# REQUIREMENTS #
# ##############################################################################
FIND_PACKAGE(Python3 COMPONENTS Development.Module NumPy REQUIRED)
FIND_PACKAGE(Python3 COMPONENTS Development NumPy QUIET)
IF (NOT Python3_FOUND)
FIND_PACKAGE(Python3 COMPONENTS Development.Module NumPy REQUIRED)
ENDIF()

# Needed to ensure the same Python executable is found by Pybind11
IF (NOT DEFINED PYTHON_EXECUTABLE)
Expand Down
10 changes: 8 additions & 2 deletions cmake/carmaDependencyTargets.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,15 @@
# ##############################################################################
# Python and Numpy dependencies
IF (carma_FIND_REQUIRED)
FIND_PACKAGE(Python3 COMPONENTS Interpreter Development NumPy REQUIRED)
FIND_PACKAGE(Python3 COMPONENTS Development NumPy QUIET)
IF (NOT Python3_FOUND)
FIND_PACKAGE(Python3 COMPONENTS Development.Module NumPy REQUIRED)
ENDIF()
ELSE ()
FIND_PACKAGE(Python3 COMPONENTS Interpreter Development NumPy)
FIND_PACKAGE(Python3 COMPONENTS Development NumPy QUIET)
IF (NOT Python3_FOUND)
FIND_PACKAGE(Python3 COMPONENTS Development.Module NumPy)
ENDIF()
ENDIF ()
IF (Python3_FOUND)
LIST(APPEND carma_INCLUDE_DIRS ${Python3_INCLUDE_DIRS})
Expand Down

0 comments on commit 7405bbd

Please sign in to comment.