CMake: fix finding Python 3 libraries

This commit is contained in:
Matthias Hochsteger 2017-01-09 14:02:50 +01:00
parent f44a32e4de
commit fc64b97e77
2 changed files with 3 additions and 9 deletions

View File

@ -2,7 +2,7 @@ if(NOT CMAKE_BUILD_TYPE)
set(CMAKE_BUILD_TYPE "RelWithDebInfo" CACHE STRING INTERNAL)
endif(NOT CMAKE_BUILD_TYPE)
cmake_minimum_required(VERSION 2.8.9)
cmake_minimum_required(VERSION 2.8.12)
if(NOT WIN32)
option( USE_NATIVE_ARCH "build which -march=native" ON)
endif(NOT WIN32)

View File

@ -69,14 +69,8 @@ if (USE_PYTHON)
else( PYBIND_INCLUDE_DIR )
message(FATAL_ERROR "Could NOT find pybind11!")
endif( PYBIND_INCLUDE_DIR )
set(CMAKE_MODULE_PATH "${CMAKE_MODULE_PATH}" "${PROJECT_SOURCE_DIR}/cmake_modules/python")
set(PYTHON_VERSION "3" CACHE STRING "Python version (only Python >= 3.0 supported)")
set(Python_ADDITIONAL_VERSIONS 3.5)
if( PYTHON_VERSION VERSION_LESS 3 )
message(FATAL_ERROR "Netgen supports only Python 3")
endif( PYTHON_VERSION VERSION_LESS 3 )
find_package(PythonInterp ${PYTHON_VERSION} REQUIRED)
find_package(PythonLibs ${PYTHON_VERSION} REQUIRED)
find_package(PythonInterp 3 REQUIRED)
find_package(PythonLibs 3 REQUIRED)
set(PYTHON_LIBS "${PYTHON_LIBRARIES}")
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)