Skip to content

Commit

Permalink
Unify Python3_Development_FOUND checks (#662)
Browse files Browse the repository at this point in the history
The value of this variable may change if other code paths
call find_package(Python3), so move the warning to be
co-located with the add_subdirectory call.

Signed-off-by: Steve Peters <[email protected]>
  • Loading branch information
scpeters authored Feb 12, 2025
1 parent 585c190 commit 62957f7
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
3 changes: 0 additions & 3 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -103,9 +103,6 @@ else()
COMPONENTS Interpreter
OPTIONAL_COMPONENTS Development
)
if (NOT Python3_Development_FOUND)
GZ_BUILD_WARNING("Python development libraries are missing: Python interfaces are disabled.")
endif()
endif()

# Location of "fake install folder" used in tests
Expand Down
8 changes: 6 additions & 2 deletions src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,12 @@ gz_build_tests(TYPE UNIT SOURCES ${gtest_sources})
add_subdirectory(graph)

# Bindings subdirectories
if (Python3_Development_FOUND AND NOT SKIP_PYBIND11)
add_subdirectory(python_pybind11)
if (NOT SKIP_PYBIND11)
if (Python3_Development_FOUND)
add_subdirectory(python_pybind11)
else()
message(WARNING "Python development libraries are missing: Python interfaces are disabled.")
endif()
endif()

if (SWIG_FOUND AND NOT SKIP_SWIG)
Expand Down

0 comments on commit 62957f7

Please sign in to comment.