From 62957f715c0eca06c57eb47027e8f24cd7a4f6ee Mon Sep 17 00:00:00 2001 From: Steve Peters Date: Wed, 12 Feb 2025 11:28:05 -0800 Subject: [PATCH] Unify Python3_Development_FOUND checks (#662) 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 --- CMakeLists.txt | 3 --- src/CMakeLists.txt | 8 ++++++-- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 7cd29693..bbd2009d 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -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 diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 85582b6f..c915db63 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -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)