From 44a269f32d4498977ee78ba7693bbf9979244cff Mon Sep 17 00:00:00 2001 From: Martin Quinson Date: Tue, 25 Jan 2022 01:45:04 +0100 Subject: [PATCH] try to honor CMAKE_INSTALL_PREFIX when installing the python package --- CMakeLists.txt | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 981691faed..10ccdbdfc2 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -840,8 +840,13 @@ if(enable_python) set_property(TARGET python-bindings APPEND PROPERTY INCLUDE_DIRECTORIES "${INTERNAL_INCLUDES}") + if("${CMAKE_INSTALL_PREFIX}" STREQUAL "/usr") + set(pybind_install_dir ${Python3_SITEARCH}) + else() + string(REGEX REPLACE "^/usr/" "${CMAKE_INSTALL_PREFIX}/" pybind_install_dir ${Python3_SITEARCH}) + endif() install(TARGETS python-bindings - LIBRARY DESTINATION "${Python3_SITEARCH}") + LIBRARY DESTINATION "${pybind_install_dir}") else() message(FATAL_ERROR "Please install pybind11-dev to build the Python bindings (or disable that option).") endif() @@ -946,7 +951,7 @@ endif() if(pybind11_FOUND) message(" Compile Python bindings .....: ${enable_python}") message(" module ....................: ${PYTHON_MODULE_PREFIX}simgrid${PYTHON_MODULE_EXTENSION}") - message(" install path ..............: ${Python3_SITEARCH}") + message(" install path ..............: ${pybind_install_dir}") else() message(" Compile Python bindings .....: OFF (disabled, or pybind11 not found)") endif() -- 2.20.1