CMake: improve searching for PythonQt

- don't log when libs not found
 - log that it's the Python libraries version (not Python itself)
 - fix RE that was getting the wrong results for maj.min
This commit is contained in:
Adriaan de Groot 2017-11-06 06:12:26 -05:00
parent 62c03d6857
commit fda4b4e3c2

View File

@ -9,12 +9,19 @@ if(NOT PYTHONLIBS_FOUND)
message(FATAL_ERROR "error: Python is required to build PythonQt")
endif()
# Cut X.Y[.Z] down to just X.Y
string(REGEX REPLACE
"^([0-9][0-9]*)\.([0-9][0-9]*)"
"\\1"
PYTHONLIBS_MAJMIN
"\\1.\\2@"
_PYTHONLIBS_MAJMIN
${PYTHONLIBS_VERSION_STRING}
)
string(REGEX REPLACE
"@.*"
""
PYTHONLIBS_MAJMIN
${_PYTHONLIBS_MAJMIN}
)
if(NOT EXISTS "${PYTHONQT_INSTALL_DIR}")
find_path(PYTHONQT_INSTALL_DIR include/PythonQt/PythonQt.h DOC "Directory where PythonQt was installed.")
@ -30,7 +37,7 @@ find_path(PYTHONQT_INCLUDE_DIR PythonQt.h
DOC "Path to the PythonQt include directory")
if ( NOT PythonQt_FIND_QUIETLY )
message( STATUS "Searching for PythonQt (Python ${PYTHONLIBS_MAJMIN}) .." )
message( STATUS "Searching for PythonQt (PythonLibs ${PYTHONLIBS_MAJMIN}) .." )
if ( PYTHONQT_INCLUDE_DIR )
message( STATUS " .. found include ${PYTHONQT_INCLUDE_DIR}" )
endif()
@ -99,9 +106,13 @@ if(PYTHONQT_QTALL_LIBRARY_DEBUG)
endif()
if ( NOT PythonQt_FIND_QUIETLY )
if ( PYTHONQT_LIBRARY )
message( STATUS " .. found library ${PYTHONQT_LIBRARY}" )
endif()
if ( PYTHONQT_QTALL_LIBRARY )
message( STATUS " .. found qtall ${PYTHONQT_QTALL_LIBRARY}" )
endif()
endif()
mark_as_advanced(PYTHONQT_INSTALL_DIR)