[cmake] Fix default install dir for Python modules

This commit is contained in:
Matthias Hochsteger 2017-11-13 13:41:15 +01:00
parent 874f17d129
commit b1cb2883e7
2 changed files with 9 additions and 3 deletions

View File

@ -108,6 +108,14 @@ include_directories ("${PROJECT_BINARY_DIR}")
set(CMAKE_INCLUDE_CURRENT_DIR ON) set(CMAKE_INCLUDE_CURRENT_DIR ON)
if(USE_PYTHON)
find_package(PythonInterp 3 REQUIRED)
find_package(PythonLibs 3 REQUIRED)
execute_process(COMMAND ${PYTHON_EXECUTABLE} -c "from distutils.sysconfig import get_python_lib; print(get_python_lib(1,0,''))" OUTPUT_VARIABLE PYTHON_PACKAGES_INSTALL_DIR OUTPUT_STRIP_TRAILING_WHITESPACE)
file(TO_CMAKE_PATH ${PYTHON_PACKAGES_INSTALL_DIR} PYTHON_PACKAGES_INSTALL_DIR)
endif(USE_PYTHON)
set(NG_INSTALL_SUFFIX netgen CACHE STRING "Suffix appended to install directories (project name)") set(NG_INSTALL_SUFFIX netgen CACHE STRING "Suffix appended to install directories (project name)")
if(APPLE) if(APPLE)

View File

@ -64,9 +64,7 @@ if (USE_PYTHON)
find_package(PythonInterp 3 REQUIRED) find_package(PythonInterp 3 REQUIRED)
find_package(PythonLibs 3 REQUIRED) find_package(PythonLibs 3 REQUIRED)
execute_process(COMMAND ${PYTHON_EXECUTABLE} -c "from distutils.sysconfig import get_python_lib; print(get_python_lib(1,0,''))" OUTPUT_VARIABLE PYTHON_PACKAGES_INSTALL_DIR OUTPUT_STRIP_TRAILING_WHITESPACE) set_vars(NETGEN_CMAKE_ARGS PYTHON_INCLUDE_DIRS PYTHON_LIBRARIES PYTHON_EXECUTABLE PYTHON_VERSION PYBIND_INCLUDE_DIR)
file(TO_CMAKE_PATH ${PYTHON_PACKAGES_INSTALL_DIR} PYTHON_PACKAGES_INSTALL_DIR)
set_vars(NETGEN_CMAKE_ARGS PYTHON_PACKAGES_INSTALL_DIR PYTHON_INCLUDE_DIRS PYTHON_LIBRARIES PYTHON_EXECUTABLE PYTHON_VERSION PYBIND_INCLUDE_DIR)
endif (USE_PYTHON) endif (USE_PYTHON)
####################################################################### #######################################################################