Skip to content

Commit

Permalink
Add a comment
Browse files Browse the repository at this point in the history
  • Loading branch information
cottsay committed Feb 15, 2024
1 parent f4beb8b commit bc552d2
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion ament_cmake_core/cmake/core/python.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,16 @@
# find_package(Python3 3.8 REQUIRED)
# find_package(ament_cmake REQUIRED)
if(NOT TARGET Python3::Interpreter)
if(NOT Python3_EXECUTABLE)
# We expect that Python dependencies are met for whatever Python interpreter
# is invoked by the "python3" executable, however this may not be the latest
# Python version installed on the system. The default behavior of
# find_package(Python3) would be to use the latest version, so we
# specifically look for a "python3" executable and if found, instruct
# find_package(Python3) to use that.
# On Windows, the find_package(Python3) logic is different and doesn't
# appear to prefer specific versions (i.e. python3.12) over plain
# "python.exe" so this extra logic is unnecessary there.
if(NOT WIN32 AND NOT Python3_EXECUTABLE)
find_program(Python3_EXECUTABLE python3)
endif()
find_package(Python3 REQUIRED COMPONENTS Interpreter)
Expand Down

0 comments on commit bc552d2

Please sign in to comment.