summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorClinton Stimpson <clinton@elemtech.com>2008-05-21 17:36:37 (GMT)
committerClinton Stimpson <clinton@elemtech.com>2008-05-21 17:36:37 (GMT)
commitdb52ce45fa3b82435535428687fd32f20ce6bd7e (patch)
tree41aea0e6910d1538cb6d7ce03702c8bd6dce5a23
parente25a9a416966506f43428e611e3eb59c2b0fb3e2 (diff)
downloadCMake-db52ce45fa3b82435535428687fd32f20ce6bd7e.zip
CMake-db52ce45fa3b82435535428687fd32f20ce6bd7e.tar.gz
CMake-db52ce45fa3b82435535428687fd32f20ce6bd7e.tar.bz2
ENH: Make Qt not found if the QtCore library can't be found.
Also report an error when trying to use MSVC with Qt built by mingw.
-rw-r--r--Modules/FindQt4.cmake20
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})