From 0f69062e8baaf6045557d004ecf8747e48694bd4 Mon Sep 17 00:00:00 2001 From: Silvio Traversaro Date: Wed, 4 Oct 2023 16:42:12 +0200 Subject: [PATCH] Do not redefine GZ_PYTHON_INSTALL_PATH if it is already defined (#393) Signed-off-by: Silvio Traversaro --- CMakeLists.txt | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index b3133776..a6c5c418 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -108,16 +108,18 @@ endif() # Find Python find_package(Python3 REQUIRED COMPONENTS Interpreter) -if(USE_SYSTEM_PATHS_FOR_PYTHON_INSTALLATION) - if(USE_DIST_PACKAGES_FOR_PYTHON) - string(REPLACE "site-packages" "dist-packages" GZ_PYTHON_INSTALL_PATH ${Python3_SITELIB}) +if(NOT GZ_PYTHON_INSTALL_PATH) + if(USE_SYSTEM_PATHS_FOR_PYTHON_INSTALLATION) + if(USE_DIST_PACKAGES_FOR_PYTHON) + string(REPLACE "site-packages" "dist-packages" GZ_PYTHON_INSTALL_PATH ${Python3_SITELIB}) + else() + # Python3_SITELIB might use dist-packages in some platforms + string(REPLACE "dist-packages" "site-packages" GZ_PYTHON_INSTALL_PATH ${Python3_SITELIB}) + endif() else() - # Python3_SITELIB might use dist-packages in some platforms - string(REPLACE "dist-packages" "site-packages" GZ_PYTHON_INSTALL_PATH ${Python3_SITELIB}) + # If not a system installation, respect local paths + set(GZ_PYTHON_INSTALL_PATH ${GZ_LIB_INSTALL_DIR}/python) endif() -else() - # If not a system installation, respect local paths - set(GZ_PYTHON_INSTALL_PATH ${GZ_LIB_INSTALL_DIR}/python) endif() #============================================================================ # Configure the build