Added USERSPACE_PYTHON_PREFIX cmake variable to allow install IfcPython in userspace instead of system-wide.

This commit is contained in:
Yorik van Havre
2020-06-22 12:24:34 +02:00
committed by Thomas Krijnen
parent 3e9fff6c19
commit c76c72c017
2 changed files with 12 additions and 4 deletions
+11 -4
View File
@@ -68,10 +68,17 @@ endif()
# directory in which the wrapper can be installed.
FIND_PACKAGE(PythonInterp)
IF(PYTHONINTERP_FOUND AND NOT "${PYTHON_EXECUTABLE}" STREQUAL "")
EXECUTE_PROCESS(
COMMAND ${PYTHON_EXECUTABLE} -c "import sys; from distutils.sysconfig import get_python_lib; sys.stdout.write(get_python_lib(1))"
OUTPUT_VARIABLE python_package_dir
)
IF (USERSPACE_PYTHON_PREFIX)
EXECUTE_PROCESS(
COMMAND ${PYTHON_EXECUTABLE} -c "import sys; import site; sys.stdout.write(site.USER_SITE)"
OUTPUT_VARIABLE python_package_dir
)
ELSE ()
EXECUTE_PROCESS(
COMMAND ${PYTHON_EXECUTABLE} -c "import sys; from distutils.sysconfig import get_python_lib; sys.stdout.write(get_python_lib(1))"
OUTPUT_VARIABLE python_package_dir
)
ENDIF()
IF("${python_package_dir}" STREQUAL "")
MESSAGE(WARNING "Unable to locate Python site-package directory, unable to install the Python wrapper")