[CMake] FindPythonLibs no longer finding Python libs in Windows 7 64 bit?

DriscollTheresa M DriscollTheresaM at JohnDeere.com
Tue Jul 19 11:32:12 EDT 2011


On a 64 bit Windows 7 machine, the call to find the python libraries using the FindPythonLibs.cmake module is not finding where python is installed. I tried this with both version 2.8.4 and with 2.8.5 of CMake, with Python 2.7 installed. Using the same code, FindPythonLibs works ok on my Windows XP machine.

I did some investigation, and it looks like reading the windows registry in Windows 7 is no longer working. The FindPythonLibs module makes a call to Find_Library, telling it to also check a registry key:

FIND_LIBRARY(PYTHON_LIBRARY
    NAMES python${_CURRENT_VERSION_NO_DOTS} python${_CURRENT_VERSION}
    PATHS
      [HKEY_LOCAL_MACHINE\\SOFTWARE\\Python\\PythonCore\\${_CURRENT_VERSION}\\InstallPath]/libs
    # Avoid finding the .dll in the PATH.  We want the .lib.
    NO_SYSTEM_ENVIRONMENT_PATH
  )


On my Windows 7 machine, the registry key [HKEY_LOCAL_MACHINE\\SOFTWARE\\Python\\PythonCore\\${_CURRENT_VERSION}\\InstallPath] (where _CURRENT_VERSION is 2.7) exists and the default key contains the correct path to the python libraries yet PYTHON_LIBRARY gets set to NotFound. Per the FAQS and the thread posted at http://cmake.3232098.n2.nabble.com/Reading-registry-broken-on-Windows-7-td4030673.html, I tried using SET_FILENAME_COMPONENT to read the contents of the registry key. The result is the variable being set to \registry instead of the correct path to the python libraries.


Is there another way to find the install location of the python libraries that works on Windows 7 and Windows XP, 32 bit and 64 bit machines?

Theresa
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.cmake.org/pipermail/cmake/attachments/20110719/c2fdd027/attachment.htm>


More information about the CMake mailing list