diff options
author | Vasilii Chernov <vchernov@inr.ru> | 2016-03-02 14:38:59 +0100 |
---|---|---|
committer | Vasilii Chernov <vchernov@inr.ru> | 2016-03-02 14:38:59 +0100 |
commit | 02d0026e2df2ba5c68c0c1a67aec4437c9e8e8f3 (patch) | |
tree | 2714eb4c293453e04d4886c356d033bbd7923012 /CMakeLists.txt | |
parent | 8e7c95957ee73d6c11ef28f7c0e2319a11103783 (diff) | |
download | pcitool-02d0026e2df2ba5c68c0c1a67aec4437c9e8e8f3.tar.gz pcitool-02d0026e2df2ba5c68c0c1a67aec4437c9e8e8f3.tar.bz2 pcitool-02d0026e2df2ba5c68c0c1a67aec4437c9e8e8f3.tar.xz pcitool-02d0026e2df2ba5c68c0c1a67aec4437c9e8e8f3.zip |
Add Python3 support
Diffstat (limited to 'CMakeLists.txt')
-rw-r--r-- | CMakeLists.txt | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt index 856e23c..bc9abc7 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -38,9 +38,10 @@ find_package(PkgConfig REQUIRED) find_package(Threads REQUIRED) if (NOT DISABLE_PYTHON) - - find_package(PythonLibs 2.7 REQUIRED) - find_package(PythonInterp 2 REQUIRED) + set(PYTHON_VERSION 2.7 CACHE PATH "python version") + + find_package(PythonLibs ${PYTHON_VERSION} REQUIRED) + find_package(PythonInterp ${PYTHON_VERSION} REQUIRED) find_package(SWIG REQUIRED) if (NOT PYTHON_VERSION_STRING VERSION_EQUAL PYTHONLIBS_VERSION_STRING) @@ -49,9 +50,9 @@ if (NOT DISABLE_PYTHON) # execute_process (COMMAND ${PYTHON_EXECUTABLE} -c "from sysconfig import get_path; print get_path('platlib')" OUTPUT_VARIABLE PYTHON_INSTALL_DIR OUTPUT_STRIP_TRAILING_WHITESPACE) - execute_process (COMMAND ${PYTHON_EXECUTABLE} -c "import site; print site.PREFIXES[-1]" OUTPUT_VARIABLE PYTHON_PREFIX OUTPUT_STRIP_TRAILING_WHITESPACE) + execute_process (COMMAND ${PYTHON_EXECUTABLE} -c "import site; print(site.PREFIXES[-1])" OUTPUT_VARIABLE PYTHON_PREFIX OUTPUT_STRIP_TRAILING_WHITESPACE) file (TO_CMAKE_PATH "${PYTHON_PREFIX}" PYTHON_PREFIX) - execute_process (COMMAND ${PYTHON_EXECUTABLE} -c "import site; print site.getsitepackages()[0]" OUTPUT_VARIABLE PYTHON_SITE_DIR OUTPUT_STRIP_TRAILING_WHITESPACE) + execute_process (COMMAND ${PYTHON_EXECUTABLE} -c "import site; print(site.getsitepackages()[0])" OUTPUT_VARIABLE PYTHON_SITE_DIR OUTPUT_STRIP_TRAILING_WHITESPACE) file (TO_CMAKE_PATH "${PYTHON_SITE_DIR}" PYTHON_SITE_DIR) string (REGEX REPLACE "^${PYTHON_PREFIX}/" "${CMAKE_INSTALL_PREFIX}/" PYTHON_SITE_DIR "${PYTHON_SITE_DIR}") |