FindQt4: Do not use qmake from Qt5
Wihtout this, if qmake binary is from Qt5 the FindQt4 fails even though the Qt4 version of qmake would be installed as qmake-qt4. On Archlinux this is the case. Reviewed-by: Clinton Stimpson <clinton@elemtech.com>
This commit is contained in:
parent
5990a5637e
commit
21123416b4
|
@ -509,14 +509,26 @@ function(_QT4_QUERY_QMAKE VAR RESULT)
|
||||||
endif()
|
endif()
|
||||||
endfunction()
|
endfunction()
|
||||||
|
|
||||||
|
function(_QT4_GET_VERSION_COMPONENTS VERSION RESULT_MAJOR RESULT_MINOR RESULT_PATCH)
|
||||||
|
string(REGEX REPLACE "^([0-9]+)\\.[0-9]+\\.[0-9]+.*" "\\1" QT_VERSION_MAJOR "${QTVERSION}")
|
||||||
|
string(REGEX REPLACE "^[0-9]+\\.([0-9]+)\\.[0-9]+.*" "\\1" QT_VERSION_MINOR "${QTVERSION}")
|
||||||
|
string(REGEX REPLACE "^[0-9]+\\.[0-9]+\\.([0-9]+).*" "\\1" QT_VERSION_PATCH "${QTVERSION}")
|
||||||
|
|
||||||
set(QT4_INSTALLED_VERSION_TOO_OLD FALSE)
|
set(${RESULT_MAJOR} ${QT_VERSION_MAJOR} PARENT_SCOPE)
|
||||||
|
set(${RESULT_MINOR} ${QT_VERSION_MINOR} PARENT_SCOPE)
|
||||||
|
set(${RESULT_PATCH} ${QT_VERSION_PATCH} PARENT_SCOPE)
|
||||||
|
endfunction()
|
||||||
|
|
||||||
|
function(_QT4_FIND_QMAKE QMAKE_NAMES QMAKE_RESULT VERSION_RESULT)
|
||||||
|
list(LENGTH QMAKE_NAMES QMAKE_NAMES_LEN)
|
||||||
|
if(${QMAKE_NAMES_LEN} EQUAL 0)
|
||||||
|
return()
|
||||||
|
endif()
|
||||||
|
list(GET QMAKE_NAMES 0 QMAKE_NAME)
|
||||||
|
|
||||||
get_filename_component(qt_install_version "[HKEY_CURRENT_USER\\Software\\trolltech\\Versions;DefaultQtVersion]" NAME)
|
get_filename_component(qt_install_version "[HKEY_CURRENT_USER\\Software\\trolltech\\Versions;DefaultQtVersion]" NAME)
|
||||||
# check for qmake
|
|
||||||
# Debian uses qmake-qt4
|
find_program(QT_QMAKE_EXECUTABLE NAMES ${QMAKE_NAME}
|
||||||
# macports' Qt uses qmake-mac
|
|
||||||
find_program(QT_QMAKE_EXECUTABLE NAMES qmake qmake4 qmake-qt4 qmake-mac
|
|
||||||
PATHS
|
PATHS
|
||||||
ENV QTDIR
|
ENV QTDIR
|
||||||
"[HKEY_CURRENT_USER\\Software\\Trolltech\\Versions\\${qt_install_version};InstallDir]"
|
"[HKEY_CURRENT_USER\\Software\\Trolltech\\Versions\\${qt_install_version};InstallDir]"
|
||||||
|
@ -524,39 +536,44 @@ find_program(QT_QMAKE_EXECUTABLE NAMES qmake qmake4 qmake-qt4 qmake-mac
|
||||||
DOC "The qmake executable for the Qt installation to use"
|
DOC "The qmake executable for the Qt installation to use"
|
||||||
)
|
)
|
||||||
|
|
||||||
# double check that it was a Qt4 qmake, if not, re-find with different names
|
set(major 0)
|
||||||
if (QT_QMAKE_EXECUTABLE)
|
if (QT_QMAKE_EXECUTABLE)
|
||||||
|
_qt4_query_qmake(QT_VERSION QTVERSION)
|
||||||
if(QT_QMAKE_EXECUTABLE_LAST)
|
_qt4_get_version_components("${QTVERSION}" major minor patch)
|
||||||
string(COMPARE NOTEQUAL "${QT_QMAKE_EXECUTABLE_LAST}" "${QT_QMAKE_EXECUTABLE}" QT_QMAKE_CHANGED)
|
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
set(QT_QMAKE_EXECUTABLE_LAST "${QT_QMAKE_EXECUTABLE}" CACHE INTERNAL "" FORCE)
|
if (NOT QT_QMAKE_EXECUTABLE OR NOT "${major}" EQUAL 4)
|
||||||
|
set(curr_qmake "${QT_QMAKE_EXECUTABLE}")
|
||||||
|
set(curr_qt_version "${QTVERSION}")
|
||||||
|
|
||||||
_qt4_query_qmake(QT_VERSION QTVERSION)
|
|
||||||
|
|
||||||
# check for qt3 qmake and then try and find qmake4 or qmake-qt4 in the path
|
|
||||||
if(NOT QTVERSION)
|
|
||||||
set(QT_QMAKE_EXECUTABLE NOTFOUND CACHE FILEPATH "" FORCE)
|
set(QT_QMAKE_EXECUTABLE NOTFOUND CACHE FILEPATH "" FORCE)
|
||||||
find_program(QT_QMAKE_EXECUTABLE NAMES qmake4 qmake-qt4 PATHS
|
list(REMOVE_AT QMAKE_NAMES 0)
|
||||||
"[HKEY_CURRENT_USER\\Software\\Trolltech\\Qt3Versions\\4.0.0;InstallDir]/bin"
|
_qt4_find_qmake("${QMAKE_NAMES}" QMAKE QTVERSION)
|
||||||
"[HKEY_CURRENT_USER\\Software\\Trolltech\\Versions\\4.0.0;InstallDir]/bin"
|
|
||||||
$ENV{QTDIR}/bin
|
_qt4_get_version_components("${QTVERSION}" major minor patch)
|
||||||
DOC "The qmake executable for the Qt installation to use"
|
if (NOT ${major} EQUAL 4)
|
||||||
)
|
# Restore possibly found qmake and it's version; these are used later
|
||||||
if(QT_QMAKE_EXECUTABLE)
|
# in error message if incorrect version is found
|
||||||
_qt4_query_qmake(QT_VERSION QTVERSION)
|
set(QT_QMAKE_EXECUTABLE "${curr_qmake}" CACHE FILEPATH "" FORCE)
|
||||||
endif()
|
set(QTVERSION "${curr_qt_version}")
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
|
||||||
|
set(${QMAKE_RESULT} "${QT_QMAKE_QMAKE_EXECUTABLE}" PARENT_SCOPE)
|
||||||
|
set(${VERSION_RESULT} "${QTVERSION}" PARENT_SCOPE)
|
||||||
|
endfunction()
|
||||||
|
|
||||||
|
|
||||||
|
set(QT4_INSTALLED_VERSION_TOO_OLD FALSE)
|
||||||
|
|
||||||
|
set(_QT4_QMAKE_NAMES qmake qmake4 qmake-qt4 qmake-mac)
|
||||||
|
_qt4_find_qmake("${_QT4_QMAKE_NAMES}" QT_QMAKE_EXECUTABLE QTVERSION)
|
||||||
|
|
||||||
if (QT_QMAKE_EXECUTABLE AND QTVERSION)
|
if (QT_QMAKE_EXECUTABLE AND QTVERSION)
|
||||||
|
|
||||||
# set version variables
|
_qt4_get_version_components("${QTVERSION}" QT_VERSION_MAJOR QT_VERSION_MINOR QT_VERSION_PATCH)
|
||||||
string(REGEX REPLACE "^([0-9]+)\\.[0-9]+\\.[0-9]+.*" "\\1" QT_VERSION_MAJOR "${QTVERSION}")
|
|
||||||
string(REGEX REPLACE "^[0-9]+\\.([0-9]+)\\.[0-9]+.*" "\\1" QT_VERSION_MINOR "${QTVERSION}")
|
|
||||||
string(REGEX REPLACE "^[0-9]+\\.[0-9]+\\.([0-9]+).*" "\\1" QT_VERSION_PATCH "${QTVERSION}")
|
|
||||||
|
|
||||||
# ask qmake for the mkspecs directory
|
# ask qmake for the mkspecs directory
|
||||||
# we do this first because QT_LIBINFIX might be set
|
# we do this first because QT_LIBINFIX might be set
|
||||||
|
@ -1330,7 +1347,7 @@ else()
|
||||||
|
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
if (QT_VERSION_MAJOR GREATER 4)
|
if (NOT QT_VERSION_MAJOR EQUAL 4)
|
||||||
set(VERSION_MSG "Found unsuitable Qt version \"${QTVERSION}\" from ${QT_QMAKE_EXECUTABLE}")
|
set(VERSION_MSG "Found unsuitable Qt version \"${QTVERSION}\" from ${QT_QMAKE_EXECUTABLE}")
|
||||||
set(QT4_FOUND FALSE)
|
set(QT4_FOUND FALSE)
|
||||||
if(Qt4_FIND_REQUIRED)
|
if(Qt4_FIND_REQUIRED)
|
||||||
|
|
Loading…
Reference in New Issue