diff options
author | Stephen Kelly <steveire@gmail.com> | 2014-01-29 15:57:09 (GMT) |
---|---|---|
committer | Stephen Kelly <steveire@gmail.com> | 2014-01-29 16:02:43 (GMT) |
commit | 1fc9ecfae63447f9109475c1b1ffb6a2974458d9 (patch) | |
tree | 32444c6c60e89313a9af07e8e4ca3ce8c9f9bda9 /Modules/FindQt4.cmake | |
parent | f7ae1d8ad6d0db2b6656ed77f7de12189badf05c (diff) | |
download | CMake-1fc9ecfae63447f9109475c1b1ffb6a2974458d9.zip CMake-1fc9ecfae63447f9109475c1b1ffb6a2974458d9.tar.gz CMake-1fc9ecfae63447f9109475c1b1ffb6a2974458d9.tar.bz2 |
FindQt4: Make AUTOMOC work regardless which order Qt 4/5 is found.
Commit 321e348e (QtAutogen: Use Qt 4 IMPORTED targets to find
executable locations., 2014-01-24) attempted to fix this problem,
but only solved it for a particular ordering of find_package for
Qt 4 and Qt 5.
Add a test to ensure that it works with both orderings.
Diffstat (limited to 'Modules/FindQt4.cmake')
-rw-r--r-- | Modules/FindQt4.cmake | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/Modules/FindQt4.cmake b/Modules/FindQt4.cmake index 2d2feae..80ba798 100644 --- a/Modules/FindQt4.cmake +++ b/Modules/FindQt4.cmake @@ -589,6 +589,14 @@ _qt4_find_qmake("${_QT4_QMAKE_NAMES}" QT_QMAKE_EXECUTABLE QTVERSION) if (QT_QMAKE_EXECUTABLE AND QTVERSION) + if (Qt5Core_FOUND) + # Qt5CoreConfig sets QT_MOC_EXECUTABLE as a non-cache variable to the Qt 5 + # path to moc. Unset that variable when Qt 4 and 5 are used together, so + # that when find_program looks for moc, it is not set to the Qt 5 version. + # If FindQt4 has already put the Qt 4 path in the cache, the unset() + # command 'unhides' the (correct) cache variable. + unset(QT_MOC_EXECUTABLE) + endif() if (QT_QMAKE_EXECUTABLE_LAST) string(COMPARE NOTEQUAL "${QT_QMAKE_EXECUTABLE_LAST}" "${QT_QMAKE_EXECUTABLE}" QT_QMAKE_CHANGED) endif() |