ENH: make sure qmake is on the machine before running it

This commit is contained in:
Bill Hoffman 2005-07-20 12:48:12 -04:00
parent 712e64ebb3
commit 380f8f6b4b
2 changed files with 38 additions and 25 deletions

View File

@ -23,6 +23,7 @@ IF(NOT QT_FOUND)
ENDIF(NOT QT_FOUND) ENDIF(NOT QT_FOUND)
# if a project needs Qt it has to call FoundQt.cmake and NOT FoundQt3.cmake, FoundQt4.cmake etc. This gets checked in FoundQt4.cmake etc. # if a project needs Qt it has to call FoundQt.cmake and NOT FoundQt3.cmake, FoundQt4.cmake etc. This gets checked in FoundQt4.cmake etc.
SET(FOUNDQT_CALLED "YES") SET(FOUNDQT_CALLED "YES")
FIND_PROGRAM(QT_QMAKE qmake)
# compatibility to CMakeList.txt files for Qt3 projects # compatibility to CMakeList.txt files for Qt3 projects
IF(NOT QT_MAX_VERSION) IF(NOT QT_MAX_VERSION)
@ -40,9 +41,11 @@ ENDIF(NOT QT_MIN_VERSION)
# #
####################################### #######################################
IF( NOT QT_QGLOBAL_H_FILE) IF( NOT QT_QGLOBAL_H_FILE)
EXEC_PROGRAM( qmake IF(QT_QMAKE)
ARGS "-query QT_INSTALL_HEADERS" EXEC_PROGRAM( qmake
OUTPUT_VARIABLE qt_headers ) ARGS "-query QT_INSTALL_HEADERS"
OUTPUT_VARIABLE qt_headers )
ENDIF(QT_QMAKE)
# Qt4-like search paths # Qt4-like search paths
FIND_FILE( QT4_QGLOBAL_H_FILE qglobal.h FIND_FILE( QT4_QGLOBAL_H_FILE qglobal.h

View File

@ -85,7 +85,6 @@
IF(NOT FOUNDQT_CALLED) IF(NOT FOUNDQT_CALLED)
MESSAGE( FATAL_ERROR "Never call FoundQt4.cmake directly. Use FoundQt.cmake.") MESSAGE( FATAL_ERROR "Never call FoundQt4.cmake directly. Use FoundQt.cmake.")
ENDIF(NOT FOUNDQT_CALLED) ENDIF(NOT FOUNDQT_CALLED)
######################################## ########################################
# #
# Setting the INCLUDE-Variables # Setting the INCLUDE-Variables
@ -93,9 +92,11 @@ ENDIF(NOT FOUNDQT_CALLED)
######################################## ########################################
# Set QT_QT_INCLUDE_DIR by searching for qglobal.h # Set QT_QT_INCLUDE_DIR by searching for qglobal.h
IF(NOT QT_QT_INCLUDE_DIR) IF(NOT QT_QT_INCLUDE_DIR)
EXEC_PROGRAM( qmake IF(QT_QMAKE)
ARGS "-query QT_INSTALL_HEADERS" EXEC_PROGRAM( qmake
OUTPUT_VARIABLE qt_headers ) ARGS "-query QT_INSTALL_HEADERS"
OUTPUT_VARIABLE qt_headers )
ENDIF(QT_QMAKE)
FIND_PATH( QT_QT_INCLUDE_DIR qglobal.h FIND_PATH( QT_QT_INCLUDE_DIR qglobal.h
${qt_headers}/Qt ${qt_headers}/Qt
$ENV{QTDIR}/include/Qt $ENV{QTDIR}/include/Qt
@ -271,9 +272,11 @@ SET( QT_INCLUDES
# #
######################################## ########################################
IF(NOT QT_QTCORE_LIBRARY) IF(NOT QT_QTCORE_LIBRARY)
EXEC_PROGRAM( qmake IF(QT_QMAKE)
ARGS "-query QT_INSTALL_LIBS" EXEC_PROGRAM( qmake
OUTPUT_VARIABLE qt_libs ) ARGS "-query QT_INSTALL_LIBS"
OUTPUT_VARIABLE qt_libs )
ENDIF(QT_QMAKE)
# Set QT_QTCORE_LIBRARY by searching for a lib with "QtCore." as part of the filename # Set QT_QTCORE_LIBRARY by searching for a lib with "QtCore." as part of the filename
FIND_LIBRARY( QT_QTCORE_LIBRARY FIND_LIBRARY( QT_QTCORE_LIBRARY
NAMES QtCore NAMES QtCore
@ -291,9 +294,11 @@ ENDIF(NOT QT_QTCORE_LIBRARY)
# Set QT_QTCORE_LIBRARY_DEBUG by searching for a lib with "QtCore_debug" as part of the filename # Set QT_QTCORE_LIBRARY_DEBUG by searching for a lib with "QtCore_debug" as part of the filename
IF(NOT QT_QTCORE_LIBRARY_DEBUG) IF(NOT QT_QTCORE_LIBRARY_DEBUG)
EXEC_PROGRAM( qmake IF(QT_QMAKE)
ARGS "-query QT_INSTALL_LIBS" EXEC_PROGRAM( qmake
OUTPUT_VARIABLE qt_libs ) ARGS "-query QT_INSTALL_LIBS"
OUTPUT_VARIABLE qt_libs )
ENDIF(QT_QMAKE)
FIND_LIBRARY( QT_QTCORE_LIBRARY_DEBUG FIND_LIBRARY( QT_QTCORE_LIBRARY_DEBUG
NAMES QtCore_debug NAMES QtCore_debug
PATHS PATHS
@ -648,10 +653,11 @@ ENDIF(NOT QT_LIBRARIES_TRYDEBUG)
# #
####################################### #######################################
IF(NOT QT_MOC_EXECUTABLE) IF(NOT QT_MOC_EXECUTABLE)
EXEC_PROGRAM( qmake IF(QT_QMAKE)
ARGS "-query QT_INSTALL_BINS" EXEC_PROGRAM( qmake
OUTPUT_VARIABLE qt_bins ) ARGS "-query QT_INSTALL_BINS"
OUTPUT_VARIABLE qt_bins )
ENDIF(QT_QMAKE)
FIND_PROGRAM(QT_MOC_EXECUTABLE FIND_PROGRAM(QT_MOC_EXECUTABLE
NAMES moc NAMES moc
PATHS PATHS
@ -673,9 +679,11 @@ ELSE(QT_MOC_EXECUTABLE)
ENDIF(QT_MOC_EXECUTABLE) ENDIF(QT_MOC_EXECUTABLE)
IF(NOT QT_UIC_EXECUTABLE ) IF(NOT QT_UIC_EXECUTABLE )
EXEC_PROGRAM( qmake IF(QT_QMAKE)
ARGS "-query QT_INSTALL_BINS" EXEC_PROGRAM( qmake
OUTPUT_VARIABLE qt_bins ) ARGS "-query QT_INSTALL_BINS"
OUTPUT_VARIABLE qt_bins )
ENDIF(QT_QMAKE)
FIND_PROGRAM(QT_UIC_EXECUTABLE FIND_PROGRAM(QT_UIC_EXECUTABLE
NAMES uic NAMES uic
PATHS PATHS
@ -697,9 +705,11 @@ ELSE(QT_UIC_EXECUTABLE)
ENDIF(QT_UIC_EXECUTABLE) ENDIF(QT_UIC_EXECUTABLE)
IF(NOT QT_RCC_EXECUTABLE) IF(NOT QT_RCC_EXECUTABLE)
EXEC_PROGRAM( qmake IF(QT_QMAKE)
ARGS "-query QT_INSTALL_BINS" EXEC_PROGRAM( qmake
OUTPUT_VARIABLE qt_bins ) ARGS "-query QT_INSTALL_BINS"
OUTPUT_VARIABLE qt_bins )
ENDIF(QT_QMAKE)
FIND_PROGRAM(QT_RCC_EXECUTABLE FIND_PROGRAM(QT_RCC_EXECUTABLE
NAMES rcc NAMES rcc
PATHS PATHS