diff options
-rw-r--r-- | Modules/FindQt4.cmake | 20 |
1 files changed, 17 insertions, 3 deletions
diff --git a/Modules/FindQt4.cmake b/Modules/FindQt4.cmake index d5f2b17..794c9ae 100644 --- a/Modules/FindQt4.cmake +++ b/Modules/FindQt4.cmake @@ -267,6 +267,7 @@ SET(QT4_INSTALLED_VERSION_TOO_OLD FALSE) # macro for asking qmake to process pro files MACRO(QT_QUERY_QMAKE outvar invar) + IF(QT_QMAKE_EXECUTABLE) FILE(WRITE ${CMAKE_CURRENT_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmpQmake/tmp.pro "message(CMAKE_MESSAGE<$$${invar}>)") @@ -289,6 +290,7 @@ MACRO(QT_QUERY_QMAKE outvar invar) STRING(REGEX REPLACE ".*CMAKE_MESSAGE<([^>]*).*" "\\1" ${outvar} "${_qmake_query_output}") ENDIF(_qmake_result) + ENDIF(QT_QMAKE_EXECUTABLE) ENDMACRO(QT_QUERY_QMAKE) GET_FILENAME_COMPONENT(qt_install_version "[HKEY_CURRENT_USER\\Software\\trolltech\\Versions;DefaultQtVersion]" NAME) @@ -760,6 +762,14 @@ IF (QT4_QMAKE_FOUND) FIND_LIBRARY(QT_QTSCRIPT_LIBRARY_DEBUG NAMES QtScript_debug QtScriptd4 PATHS ${QT_LIBRARY_DIR} NO_DEFAULT_PATH) IF( NOT QT_QTCORE_LIBRARY_DEBUG AND NOT QT_QTCORE_LIBRARY_RELEASE ) + + # try dropping a hint if trying to use Visual Studio with Qt built by mingw + IF(QT_LIBRARY_DIR AND MSVC) + IF(EXISTS ${QT_LIBRARY_DIR}/libqtmain.a) + MESSAGE( FATAL_ERROR "It appears you're trying to use Visual Studio with Qt built by mingw") + ENDIF(EXISTS ${QT_LIBRARY_DIR}/libqtmain.a) + ENDIF(QT_LIBRARY_DIR AND MSVC) + IF( NOT Qt4_FIND_QUIETLY AND Qt4_FIND_REQUIRED) MESSAGE( FATAL_ERROR "Could NOT find QtCore. Check ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeError.log for more details.") ENDIF( NOT Qt4_FIND_QUIETLY AND Qt4_FIND_REQUIRED) @@ -1305,18 +1315,22 @@ IF (QT4_QMAKE_FOUND) ###################################### # if the includes,libraries,moc,uic and rcc are found then we have it - IF( QT_LIBRARY_DIR AND QT_INCLUDE_DIR AND QT_MOC_EXECUTABLE AND QT_UIC_EXECUTABLE AND QT_RCC_EXECUTABLE) + IF( QT_LIBRARY_DIR AND QT_INCLUDE_DIR AND QT_MOC_EXECUTABLE AND + QT_UIC_EXECUTABLE AND QT_RCC_EXECUTABLE AND QT_QTCORE_LIBRARY) SET( QT4_FOUND "YES" ) INCLUDE(FindPackageMessage) FIND_PACKAGE_MESSAGE(Qt4 "Found Qt-Version ${QTVERSION}" "[${QT_LIBRARY_DIR}][${QT_INCLUDE_DIR}][${QT_MOC_EXECUTABLE}][${QT_UIC_EXECUTABLE}][${QT_RCC_EXECUTABLE}]") - ELSE( QT_LIBRARY_DIR AND QT_INCLUDE_DIR AND QT_MOC_EXECUTABLE AND QT_UIC_EXECUTABLE AND QT_RCC_EXECUTABLE) + ELSE( QT_LIBRARY_DIR AND QT_INCLUDE_DIR AND QT_MOC_EXECUTABLE AND + QT_UIC_EXECUTABLE AND QT_RCC_EXECUTABLE AND QT_QTCORE_LIBRARY) SET( QT4_FOUND "NO") SET(QT_QMAKE_EXECUTABLE "${QT_QMAKE_EXECUTABLE}-NOTFOUND" CACHE FILEPATH "Invalid qmake found" FORCE) IF( Qt4_FIND_REQUIRED) MESSAGE( FATAL_ERROR "Qt libraries, includes, moc, uic or/and rcc NOT found!") ENDIF( Qt4_FIND_REQUIRED) - ENDIF( QT_LIBRARY_DIR AND QT_INCLUDE_DIR AND QT_MOC_EXECUTABLE AND QT_UIC_EXECUTABLE AND QT_RCC_EXECUTABLE) + ENDIF( QT_LIBRARY_DIR AND QT_INCLUDE_DIR AND QT_MOC_EXECUTABLE AND + QT_UIC_EXECUTABLE AND QT_RCC_EXECUTABLE AND QT_QTCORE_LIBRARY) + SET(QT_FOUND ${QT4_FOUND}) |