CMake: find PythonQt better
- replace weird distinction between 3.0 and 3.2 by searching once - prefer 3.2 - also look for suffixed versions (PythonXY) besides the Python3 suffix FIXES #857
This commit is contained in:
parent
f3eb557fdb
commit
970b6fcb19
@ -9,6 +9,13 @@ if(NOT PYTHONLIBS_FOUND)
|
||||
message(FATAL_ERROR "error: Python is required to build PythonQt")
|
||||
endif()
|
||||
|
||||
string(REGEX REPLACE
|
||||
"^([0-9][0-9]*)\.([0-9][0-9]*)"
|
||||
"\\1"
|
||||
PYTHONLIBS_MAJMIN
|
||||
${PYTHONLIBS_VERSION_STRING}
|
||||
)
|
||||
|
||||
if(NOT EXISTS "${PYTHONQT_INSTALL_DIR}")
|
||||
find_path(PYTHONQT_INSTALL_DIR include/PythonQt/PythonQt.h DOC "Directory where PythonQt was installed.")
|
||||
endif()
|
||||
@ -22,17 +29,58 @@ find_path(PYTHONQT_INCLUDE_DIR PythonQt.h
|
||||
"${PYTHONQT_INSTALL_DIR}/src"
|
||||
DOC "Path to the PythonQt include directory")
|
||||
|
||||
# Minimum v3.1 is needed
|
||||
find_library(PYTHONQT_LIBRARY_RELEASE PythonQt PATHS "${PYTHONQT_INSTALL_DIR}/lib" DOC "The PythonQt library.")
|
||||
find_library(PYTHONQT_LIBRARY_DEBUG NAMES PythonQt${CTK_CMAKE_DEBUG_POSTFIX} PythonQt${CMAKE_DEBUG_POSTFIX} PythonQt PATHS "${PYTHONQT_INSTALL_DIR}/lib" DOC "The PythonQt library.")
|
||||
find_library(PYTHONQT_QTALL_LIBRARY_RELEASE PythonQt_QtAll PATHS "${PYTHONQT_INSTALL_DIR}/lib" DOC "Full Qt bindings for the PythonQt library.")
|
||||
find_library(PYTHONQT_QTALL_LIBRARY_DEBUG NAMES PythonQt_QtAll${CTK_CMAKE_DEBUG_POSTFIX} PythonQt_QtAll${CMAKE_DEBUG_POSTFIX} PythonQt_QtAll PATHS "${PYTHONQT_INSTALL_DIR}/lib" DOC "Full Qt bindings for the PythonQt library.")
|
||||
if ( NOT PythonQt_FIND_QUIETLY )
|
||||
message( STATUS "Searching for PythonQt (Python ${PYTHONLIBS_MAJMIN}) .." )
|
||||
if ( PYTHONQT_INCLUDE_DIR )
|
||||
message( STATUS " .. found include ${PYTHONQT_INCLUDE_DIR}" )
|
||||
endif()
|
||||
endif()
|
||||
|
||||
# Also check for v3.2+
|
||||
find_library(PYTHONQT_LIBRARY_RELEASE PythonQt-Qt5-Python3 PATHS "${PYTHONQT_INSTALL_DIR}/lib" DOC "The PythonQt library.")
|
||||
find_library(PYTHONQT_LIBRARY_DEBUG NAMES PythonQt-Qt5-Python3${CTK_CMAKE_DEBUG_POSTFIX} PythonQt-Qt5-Python3${CMAKE_DEBUG_POSTFIX} PythonQt-Qt5-Python3 PATHS "${PYTHONQT_INSTALL_DIR}/lib" DOC "The PythonQt library.")
|
||||
find_library(PYTHONQT_QTALL_LIBRARY_RELEASE PythonQt_QtAll-Qt5-Python3 PATHS "${PYTHONQT_INSTALL_DIR}/lib" DOC "Full Qt bindings for the PythonQt library.")
|
||||
find_library(PYTHONQT_QTALL_LIBRARY_DEBUG NAMES PythonQt_QtAll-Qt5-Python3${CTK_CMAKE_DEBUG_POSTFIX} PythonQt_QtAll-Qt5-Python3${CMAKE_DEBUG_POSTFIX} PythonQt_QtAll-Qt5-Python3 PATHS "${PYTHONQT_INSTALL_DIR}/lib" DOC "Full Qt bindings for the PythonQt library.")
|
||||
# Minimum v3.1 is needed
|
||||
find_library(PYTHONQT_LIBRARY_RELEASE
|
||||
NAMES
|
||||
PythonQt-Qt5-Python${PYTHONLIBS_MAJMIN}
|
||||
PythonQt-Qt5-Python3
|
||||
PythonQt
|
||||
PATHS "${PYTHONQT_INSTALL_DIR}/lib"
|
||||
DOC "The PythonQt library."
|
||||
)
|
||||
find_library(PYTHONQT_LIBRARY_DEBUG
|
||||
NAMES
|
||||
PythonQt-Qt5-Python${PYTHONLIBS_MAJMIN}JMIN${CTK_CMAKE_DEBUG_POSTFIX}
|
||||
PythonQt-Qt5-Python${PYTHONLIBS_MAJMIN}${CMAKE_DEBUG_POSTFIX}
|
||||
PythonQt-Qt5-Python${PYTHONLIBS_MAJMIN}
|
||||
PythonQt-Qt5-Python3${CTK_CMAKE_DEBUG_POSTFIX}
|
||||
PythonQt-Qt5-Python3${CMAKE_DEBUG_POSTFIX}
|
||||
PythonQt-Qt5-Python3
|
||||
PythonQt${CTK_CMAKE_DEBUG_POSTFIX}
|
||||
PythonQt${CMAKE_DEBUG_POSTFIX}
|
||||
PythonQt
|
||||
PATHS "${PYTHONQT_INSTALL_DIR}/lib"
|
||||
DOC "The PythonQt library (debug build)."
|
||||
)
|
||||
find_library(PYTHONQT_QTALL_LIBRARY_RELEASE
|
||||
NAMES
|
||||
PythonQt_QtAll-Qt5-Python${PYTHONLIBS_MAJMIN}
|
||||
PythonQt_QtAll-Qt5-Python3
|
||||
PythonQt_QtAll
|
||||
PATHS "${PYTHONQT_INSTALL_DIR}/lib"
|
||||
DOC "Full Qt bindings for the PythonQt library."
|
||||
)
|
||||
find_library(PYTHONQT_QTALL_LIBRARY_DEBUG
|
||||
NAMES
|
||||
PythonQt_QtAll-Qt5-Python${PYTHONLIBS_MAJMIN}${CTK_CMAKE_DEBUG_POSTFIX}
|
||||
PythonQt_QtAll-Qt5-Python${PYTHONLIBS_MAJMIN}${CMAKE_DEBUG_POSTFIX}
|
||||
PythonQt_QtAll-Qt5-Python${PYTHONLIBS_MAJMIN}
|
||||
PythonQt_QtAll-Qt5-Python3${CTK_CMAKE_DEBUG_POSTFIX}
|
||||
PythonQt_QtAll-Qt5-Python3${CMAKE_DEBUG_POSTFIX}
|
||||
PythonQt_QtAll-Qt5-Python3
|
||||
PythonQt_QtAll${CTK_CMAKE_DEBUG_POSTFIX}
|
||||
PythonQt_QtAll${CMAKE_DEBUG_POSTFIX}
|
||||
PythonQt_QtAll
|
||||
PATHS "${PYTHONQT_INSTALL_DIR}/lib"
|
||||
DOC "Full Qt bindings for the PythonQt library (debug build)."
|
||||
)
|
||||
|
||||
set(PYTHONQT_LIBRARY)
|
||||
if(PYTHONQT_LIBRARY_RELEASE)
|
||||
@ -50,6 +98,12 @@ if(PYTHONQT_QTALL_LIBRARY_DEBUG)
|
||||
list(APPEND PYTHONQT_QTALL_LIBRARY debug ${PYTHONQT_QTALL_LIBRARY_DEBUG})
|
||||
endif()
|
||||
|
||||
if ( NOT PythonQt_FIND_QUIETLY )
|
||||
message( STATUS " .. found library ${PYTHONQT_LIBRARY}" )
|
||||
message( STATUS " .. found qtall ${PYTHONQT_QTALL_LIBRARY}" )
|
||||
endif()
|
||||
|
||||
|
||||
mark_as_advanced(PYTHONQT_INSTALL_DIR)
|
||||
mark_as_advanced(PYTHONQT_INCLUDE_DIR)
|
||||
mark_as_advanced(PYTHONQT_LIBRARY_RELEASE)
|
||||
|
Loading…
Reference in New Issue
Block a user