[CMake] FIND_LIBRARY using registry entries
Hugo Juarez Corrá
hugocorra at gmail.com
Wed Jun 13 23:16:17 EDT 2012
Hello Folks!
I was having some troubles with FindPythonLibs, then I decided to debug it.
I've found out that the CMake wasn't translating the registry string to a
valid path:
FIND_LIBRARY(PYTHON_LIBRARY
NAMES python${_CURRENT_VERSION_NO_DOTS} python${_CURRENT_VERSION}
PATHS
[HKEY_LOCAL_MACHINE\\SOFTWARE\\Python\\PythonCore\\${_CURRENT_VERSION}\\InstallPath]/libs
[HKEY_CURRENT_USER\\SOFTWARE\\Python\\PythonCore\\${_CURRENT_VERSION}\\InstallPath]/libs
# Avoid finding the .dll in the PATH. We want the .lib.
NO_SYSTEM_ENVIRONMENT_PATH
)
I did make the following changes and now it's working fine.
GET_FILENAME_COMPONENT(PYTHON_REGISTER_HLM
[HKEY_LOCAL_MACHINE\\SOFTWARE\\Python\\PythonCore\\${_CURRENT_VERSION}\\InstallPath]
ABSOLUTE)
GET_FILENAME_COMPONENT(PYTHON_REGISTER_HCU
[HKEY_CURRENT_USER\\SOFTWARE\\Python\\PythonCore\\${_CURRENT_VERSION}\\InstallPath]
ABSOLUTE)
FIND_LIBRARY(PYTHON_LIBRARY
NAMES python${_CURRENT_VERSION_NO_DOTS} python${_CURRENT_VERSION}
PATHS
${PYTHON_REGISTER_HLM}/libs
${PYTHON_REGISTER_HCU}/libs
# Avoid finding the .dll in the PATH. We want the .lib.
NO_SYSTEM_ENVIRONMENT_PATH
)
Questions:
Are my changes right?
Why the original FindPythonLibs wasn't working for me?
Thanks,
Hugo.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.cmake.org/pipermail/cmake/attachments/20120614/734f4805/attachment.htm>
More information about the CMake
mailing list