From 0fd82579e33111bc842dfe35d7adebd4da1840ff Mon Sep 17 00:00:00 2001 From: Olivier Parcollet Date: Wed, 24 Sep 2014 17:23:33 +0200 Subject: [PATCH] [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. --- cmake/FindPython.cmake | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/cmake/FindPython.cmake b/cmake/FindPython.cmake index 819bfb05..54febfb2 100644 --- a/cmake/FindPython.cmake +++ b/cmake/FindPython.cmake @@ -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)