ENH: fixed up qt stuff from Clinton Stimpson

This commit is contained in:
Bill Hoffman 2005-08-10 08:48:03 -04:00
parent 8a52a910e1
commit df37d871c4
2 changed files with 42 additions and 50 deletions

View File

@ -21,9 +21,11 @@
IF(NOT QT_FOUND)
SET(QT_FOUND "NO")
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.
SET(FOUNDQT_CALLED "YES")
FIND_PROGRAM(QT_QMAKE qmake)
# check for qmake
IF(NOT QT_QMAKE_EXECUTABLE)
FIND_PROGRAM(QT_QMAKE_EXECUTABLE NAMES qmake PATHS $ENV{QTDIR}/bin)
ENDIF(NOT QT_QMAKE_EXECUTABLE)
# compatibility to CMakeList.txt files for Qt3 projects
IF(NOT QT_MAX_VERSION)
@ -41,12 +43,12 @@ ENDIF(NOT QT_MIN_VERSION)
#
#######################################
IF( NOT QT_QGLOBAL_H_FILE)
IF(QT_QMAKE)
EXEC_PROGRAM( qmake
IF(QT_QMAKE_EXECUTABLE)
EXEC_PROGRAM( ${QT_QMAKE_EXECUTABLE}
ARGS "-query QT_INSTALL_HEADERS"
OUTPUT_VARIABLE qt_headers )
ENDIF(QT_QMAKE)
ENDIF(QT_QMAKE_EXECUTABLE)
# Qt4-like search paths
FIND_FILE( QT4_QGLOBAL_H_FILE qglobal.h
${qt_headers}/Qt
@ -284,7 +286,5 @@ IF(QT_VERSION_SMALL_ENOUGH AND QT_VERSION_BIG_ENOUGH)
ENDIF(QT_VERSION_SMALL_ENOUGH AND QT_VERSION_BIG_ENOUGH)
MARK_AS_ADVANCED(QT4_QGLOBAL_H_FILE QT3_QGLOBAL_H_FILE QT_QMAKE_EXECUTABLE)
MARK_AS_ADVANCED(QT4_QGLOBAL_H_FILE QT3_QGLOBAL_H_FILE QT_QMAKE)

View File

@ -79,16 +79,12 @@
# QT_QT_LIBRARY , Qt-Library is now splitt into different parts
# QT_QTMAIN_LIBRARY , Qt-Library is now splitt into different parts
########################################
#
# Make sure nobody runs this
# script directly
# only FoundQt.cmake are allowed to
#
########################################
IF(NOT FOUNDQT_CALLED)
MESSAGE( FATAL_ERROR "Never call FoundQt4.cmake directly. Use FoundQt.cmake.")
ENDIF(NOT FOUNDQT_CALLED)
# check for qmake
IF(NOT QT_QMAKE_EXECUTABLE)
FIND_PROGRAM(QT_QMAKE_EXECUTABLE NAMES qmake PATHS $ENV{QTDIR}/bin)
ENDIF(NOT QT_QMAKE_EXECUTABLE)
########################################
#
# Setting the INCLUDE-Variables
@ -96,11 +92,11 @@ ENDIF(NOT FOUNDQT_CALLED)
########################################
# Set QT_QT_INCLUDE_DIR by searching for qglobal.h
IF(NOT QT_QT_INCLUDE_DIR)
IF(QT_QMAKE)
EXEC_PROGRAM( qmake
IF(QT_QMAKE_EXECUTABLE)
EXEC_PROGRAM( ${QT_QMAKE_EXECUTABLE}
ARGS "-query QT_INSTALL_HEADERS"
OUTPUT_VARIABLE qt_headers )
ENDIF(QT_QMAKE)
ENDIF(QT_QMAKE_EXECUTABLE)
FIND_PATH( QT_QT_INCLUDE_DIR qglobal.h
${qt_headers}/Qt
$ENV{QTDIR}/include/Qt
@ -114,10 +110,11 @@ IF(NOT QT_QT_INCLUDE_DIR)
ENDIF(NOT QT_QT_INCLUDE_DIR)
# Set QT_INCLUDE_DIR by removine "/Qt" in the string ${QT_QT_INCLUDE_DIR}
MESSAGE(STATUS "Looking for QT_INCLUDE_DIR")
IF(NOT QT_INCLUDE_DIR)
IF( QT_QT_INCLUDE_DIR AND NOT QT_INCLUDE_DIR)
STRING( REGEX REPLACE "/Qt$" "" qt4_include_dir ${QT_QT_INCLUDE_DIR})
SET( QT_INCLUDE_DIR ${qt4_include_dir})
SET( QT_INCLUDE_DIR ${qt4_include_dir} CACHE PATH "")
ELSE( QT_QT_INCLUDE_DIR AND NOT QT_INCLUDE_DIR)
IF( NOT Qt_FIND_QUIETLY AND Qt_FIND_REQUIRED)
MESSAGE( SEND_ERROR "Could not find qglobal.h")
@ -157,7 +154,7 @@ ENDIF(NOT QT_QTCORE_INCLUDE_DIR)
# Set QT_QTDESIGNER_INCLUDE_DIR
IF(NOT QT_QTDESIGNER_INCLUDE_DIR)
FIND_PATH( QT_QTDESIGNER_INCLUDE_DIR QtDesigner ${QT_INCLUDE_DIR}/QDesignerComponents)
FIND_PATH( QT_QTDESIGNER_INCLUDE_DIR QDesignerComponents ${QT_INCLUDE_DIR}/QtDesigner)
IF( NOT QT_QTDESIGNER_INCLUDE_DIR )
IF( NOT Qt_FIND_QUIETLY)
MESSAGE( STATUS "Could not find ${QT_INCLUDE_DIR}/QtDesigner")
@ -276,11 +273,11 @@ SET( QT_INCLUDES
#
########################################
IF(NOT QT_QTCORE_LIBRARY)
IF(QT_QMAKE)
EXEC_PROGRAM( qmake
IF(QT_QMAKE_EXECUTABLE)
EXEC_PROGRAM( ${QT_QMAKE_EXECUTABLE}
ARGS "-query QT_INSTALL_LIBS"
OUTPUT_VARIABLE qt_libs )
ENDIF(QT_QMAKE)
ENDIF(QT_QMAKE_EXECUTABLE)
# Set QT_QTCORE_LIBRARY by searching for a lib with "QtCore." as part of the filename
FIND_LIBRARY( QT_QTCORE_LIBRARY
NAMES QtCore QtCore4
@ -298,11 +295,11 @@ ENDIF(NOT QT_QTCORE_LIBRARY)
# 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(QT_QMAKE)
EXEC_PROGRAM( qmake
IF(QT_QMAKE_EXECUTABLE)
EXEC_PROGRAM( ${QT_QMAKE_EXECUTABLE}
ARGS "-query QT_INSTALL_LIBS"
OUTPUT_VARIABLE qt_libs )
ENDIF(QT_QMAKE)
ENDIF(QT_QMAKE_EXECUTABLE)
FIND_LIBRARY( QT_QTCORE_LIBRARY_DEBUG
NAMES QtCore_debug QtCored4
PATHS
@ -319,18 +316,12 @@ ENDIF(NOT QT_QTCORE_LIBRARY_DEBUG)
# Set QT_LIBRARY_DIR
IF(NOT QT_LIBRARY_DIR)
IF( QT_QTCORE_LIBRARY )
STRING(REGEX MATCH "[^/]*$" qt_qtcore "${QT_QTCORE_LIBRARY}")
STRING(REGEX REPLACE "/${qt_qtcore}" "" QT_LIBRARY_DIR "${QT_QTCORE_LIBRARY}")
ELSE( QT_QTCORE_LIBRARY )
IF( QT_QTCORE_LIBRARY_DEBUG )
STRING(REGEX MATCH "[^/]*$" qt_qtcore_debug "${QT_QTCORE_LIBRARY_DEBUG}")
STRING(REGEX REPLACE "/${qt_qtcore_debug}" "" QT_LIBRARY_DIR "${QT_QTCORE_LIBRARY_DEBUG}")
ENDIF( QT_QTCORE_LIBRARY_DEBUG )
ENDIF( QT_QTCORE_LIBRARY )
EXEC_PROGRAM( ${QT_QMAKE_EXECUTABLE}
ARGS "-query QT_INSTALL_LIBS"
OUTPUT_VARIABLE QT_LIBRARY_DIR_TMP )
SET(QT_LIBRARY_DIR ${QT_LIBRARY_DIR_TMP} CACHE PATH "Qt library dir")
ENDIF(NOT QT_LIBRARY_DIR)
# Set QT_QT3SUPPORT_LIBRARY
IF(NOT QT_QT3SUPPORT_LIBRARY)
FIND_LIBRARY(QT_QT3SUPPORT_LIBRARY NAMES Qt3Support Qt3Support4 PATHS ${QT_LIBRARY_DIR})
@ -657,11 +648,12 @@ ENDIF(NOT QT_LIBRARIES_TRYDEBUG)
#
#######################################
IF(NOT QT_MOC_EXECUTABLE)
IF(QT_QMAKE)
EXEC_PROGRAM( qmake
IF(QT_QMAKE_EXECUTABLE)
EXEC_PROGRAM( ${QT_QMAKE_EXECUTABLE}
ARGS "-query QT_INSTALL_BINS"
OUTPUT_VARIABLE qt_bins )
ENDIF(QT_QMAKE)
ENDIF(QT_QMAKE_EXECUTABLE)
MESSAGE(STATUS ${qt_bins})
FIND_PROGRAM(QT_MOC_EXECUTABLE
NAMES moc
PATHS
@ -683,11 +675,11 @@ ELSE(QT_MOC_EXECUTABLE)
ENDIF(QT_MOC_EXECUTABLE)
IF(NOT QT_UIC_EXECUTABLE )
IF(QT_QMAKE)
EXEC_PROGRAM( qmake
IF(QT_QMAKE_EXECUTABLE)
EXEC_PROGRAM( ${QT_QMAKE_EXECUTABLE}
ARGS "-query QT_INSTALL_BINS"
OUTPUT_VARIABLE qt_bins )
ENDIF(QT_QMAKE)
ENDIF(QT_QMAKE_EXECUTABLE)
FIND_PROGRAM(QT_UIC_EXECUTABLE
NAMES uic
PATHS
@ -709,11 +701,11 @@ ELSE(QT_UIC_EXECUTABLE)
ENDIF(QT_UIC_EXECUTABLE)
IF(NOT QT_RCC_EXECUTABLE)
IF(QT_QMAKE)
EXEC_PROGRAM( qmake
IF(QT_QMAKE_EXECUTABLE)
EXEC_PROGRAM( ${QT_QMAKE_EXECUTABLE}
ARGS "-query QT_INSTALL_BINS"
OUTPUT_VARIABLE qt_bins )
ENDIF(QT_QMAKE)
ENDIF(QT_QMAKE_EXECUTABLE)
FIND_PROGRAM(QT_RCC_EXECUTABLE
NAMES rcc
PATHS