From 191a9a751d9a209f40e6bbe4c14a0e3f7ceda6b2 Mon Sep 17 00:00:00 2001 From: "Addisu Z. Taddese" Date: Wed, 6 Nov 2024 04:44:25 +0100 Subject: [PATCH] Only look for psutil if testing is enabled (#1495) This avoids an unnecessary CMake warning on builds where tests are disabled, such as [sdformat_vendor](https://github.com/gazebo-release/sdformat_vendor) Signed-off-by: Addisu Z. Taddese Co-authored-by: Steve Peters (cherry picked from commit 9661794312763099cee6da1da613384210fae5db) --- CMakeLists.txt | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 01ec1e525..07329aaf3 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -126,9 +126,11 @@ if (BUILD_SDF) ################################################ # Find psutil python package for memory tests - find_python_module(psutil) - if (NOT PY_PSUTIL) - gz_build_warning("Python psutil package not found. Memory leak tests will be skipped") + if (BUILD_TESTING) + find_python_module(psutil) + if (NOT PY_PSUTIL) + gz_build_warning("Python psutil package not found. Memory leak tests will be skipped") + endif() endif() ########################################