3
0
mirror of https://github.com/triqs/dft_tools synced 2024-12-24 13:23:37 +01:00

[cmake] Fix cmake python for Ubuntu 14.04

There is a bug in Ubuntu 14.04 : the interpreter
does not return the correct position of the libpython.
We add the correct path to the path hints, at the end (lowest priority).
In most machines, the first hint is the correct answer.
This commit is contained in:
Olivier Parcollet 2014-09-24 17:23:33 +02:00
parent 6a38d6747c
commit 0fd82579e3

View File

@ -104,13 +104,14 @@ mark_as_advanced(PYTHON_SITE_PKG)
#EXEC_PYTHON_SCRIPT ("import string; from distutils.sysconfig import * ;print string.join(get_config_vars('VERSION'))" PYTHON_VERSION_MAJOR_MINOR)
EXEC_PYTHON_SCRIPT ("import string; from distutils.sysconfig import *; print '%s/config' % get_python_lib(0,1)" PYTHON_LIBRARY_BASE_PATH)
EXEC_PYTHON_SCRIPT ("import string; from distutils.sysconfig import *; print 'libpython%s' % string.join(get_config_vars('VERSION'))" PYTHON_LIBRARY_BASE_FILE)
set( PYTHON_LIBRARY_SEARCH_PATH ${PYTHON_LIBRARY_BASE_PATH} /usr/lib/python2.7/config-x86_64-linux-gnu/)
IF(BUILD_SHARED_LIBS)
FIND_FILE(PYTHON_LIBRARY NAMES "${PYTHON_LIBRARY_BASE_FILE}.so" PATHS ${PYTHON_LIBRARY_BASE_PATH})
FIND_FILE(PYTHON_LIBRARY NAMES "${PYTHON_LIBRARY_BASE_FILE}.so" PATHS ${PYTHON_LIBRARY_SEARCH_PATH})
IF(NOT PYTHON_LIBRARY)
FIND_FILE(PYTHON_LIBRARY NAMES "${PYTHON_LIBRARY_BASE_FILE}.a" PATHS ${PYTHON_LIBRARY_BASE_PATH})
FIND_FILE(PYTHON_LIBRARY NAMES "${PYTHON_LIBRARY_BASE_FILE}.a" PATHS ${PYTHON_LIBRARY_SEARCH_PATH})
ENDIF(NOT PYTHON_LIBRARY)
ELSE(BUILD_SHARED_LIBS)
FIND_FILE(PYTHON_LIBRARY NAMES "${PYTHON_LIBRARY_BASE_FILE}.a" PATHS ${PYTHON_LIBRARY_BASE_PATH})
FIND_FILE(PYTHON_LIBRARY NAMES "${PYTHON_LIBRARY_BASE_FILE}.a" PATHS ${PYTHON_LIBRARY_SEARCH_PATH})
ENDIF(BUILD_SHARED_LIBS)
MESSAGE(STATUS "PYTHON_LIBRARY = ${PYTHON_LIBRARY}" )
mark_as_advanced(PYTHON_LIBRARY)