From ec6fdfc930883a34dec42028acb618ba47b486bc Mon Sep 17 00:00:00 2001 From: "Addisu Z. Taddese" Date: Tue, 5 Nov 2024 13:29:02 -0600 Subject: [PATCH] Only look for psutil if testing is enabled 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 --- CMakeLists.txt | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index f1eed1eaa..2eb3e0f83 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -136,9 +136,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() ########################################