ENH: clean up the find qt stuff some

This commit is contained in:
Bill Hoffman 2005-09-09 21:51:23 -04:00
parent b66c08fc40
commit afbc9b7b07
4 changed files with 25 additions and 12 deletions

View File

@ -41,7 +41,7 @@ ENDIF(GLOB_TEMP_VAR)
SET(GLOB_TEMP_VAR)
# now find qmake
FIND_PROGRAM(QT_QMAKE_EXECUTABLE NAMES qmake PATHS $ENV{QTDIR}/bin)
FIND_PROGRAM(QT_QMAKE_EXECUTABLE NAMES qmake PATHS "${QT_SEARCH_PATH}/bin" "$ENV{QTDIR}/bin")
IF(QT_QMAKE_EXECUTABLE)
EXEC_PROGRAM(${QMAKE_PATH} ARGS "-query QT_VERSION"
OUTPUT_VARIABLE QTVERSION)
@ -60,7 +60,8 @@ IF(QT_QMAKE_EXECUTABLE)
ENDIF(QT_QMAKE_EXECUTABLE)
FIND_FILE( QT4_QGLOBAL_H_FILE qglobal.h
"[HKEY_CURRENT_USER\Software\Trolltech\Qt3Versions\4.0.0;InstallDir]/include/Qt"
"${QT_SEARCH_PATH}/Qt/include"
"[HKEY_CURRENT_USER\\Software\\Trolltech\\Qt3Versions\\4.0.0;InstallDir]/include/Qt"
${qt_headers}/Qt
$ENV{QTDIR}/include/Qt
/usr/local/qt/include/Qt
@ -68,16 +69,17 @@ FIND_FILE( QT4_QGLOBAL_H_FILE qglobal.h
/usr/lib/qt/include/Qt
/usr/include/Qt
/usr/share/qt4/include/Qt
C:/Progra~1/qt/include/Qt )F
C:/Progra~1/qt/include/Qt )
IF(QT4_QGLOBAL_H_FILE)
SET(QT4_INSTALLED TRUE)
ENDIF(QT4_QGLOBAL_H_FILE)
FIND_FILE( QT3_QGLOBAL_H_FILE qglobal.h
"[HKEY_CURRENT_USER\Software\Trolltech\Qt3Versions\3.2.1;InstallDir]/include/Qt"
"[HKEY_CURRENT_USER\Software\Trolltech\Qt3Versions\3.2.0;InstallDir]/include/Qt"
"[HKEY_CURRENT_USER\Software\Trolltech\Qt3Versions\3.1.0;InstallDir]/include/Qt"
"${QT_SEARCH_PATH}/Qt/include"
"[HKEY_CURRENT_USER\\Software\\Trolltech\\Qt3Versions\\3.2.1;InstallDir]/include/Qt"
"[HKEY_CURRENT_USER\\Software\\Trolltech\\Qt3Versions\\3.2.0;InstallDir]/include/Qt"
"[HKEY_CURRENT_USER\\Software\\Trolltech\\Qt3Versions\\3.1.0;InstallDir]/include/Qt"
C:/Qt/3.3.3Educational/include
$ENV{QTDIR}/include
/usr/include/qt3/Qt
@ -95,14 +97,14 @@ ENDIF(QT3_QGLOBAL_H_FILE)
IF(QT3_INSTALLED AND QT4_INSTALLED )
# force user to pick if we have both
OPTION(DESIRED_QT_VERSION "Pick a version of QT to use" 0)
SET(DESIRED_QT_VERSION 0 CACHE STRING "Pick a version of QT to use: 3 or 4")
ELSE(QT3_INSTALLED AND QT4_INSTALLED )
# if only one found then pick that one
IF(QT3_INSTALLED)
OPTION(DESIRED_QT_VERSION "Pick a version of QT to use" 3)
SET(DESIRED_QT_VERSION 3 CACHE STRING "Pick a version of QT to use: 3 or 4")
ENDIF(QT3_INSTALLED)
IF(QT4_INSTALLED)
OPTION(DESIRED_QT_VERSION "Pick a version of QT to use" 4)
SET(DESIRED_QT_VERSION 4 CACHE STRING "Pick a version of QT to use: 3 or 4")
ENDIF(QT4_INSTALLED)
ENDIF(QT3_INSTALLED AND QT4_INSTALLED )
@ -120,6 +122,7 @@ ELSE(NOT QT3_INSTALLED AND NOT QT4_INSTALLED)
MESSAGE(SEND_ERROR "Multiple versions of QT found please set DESIRED_QT_VERSION")
ENDIF(NOT QT_FOUND AND NOT DESIRED_QT_VERSION)
IF(NOT QT_FOUND AND DESIRED_QT_VERSION)
MESSAGE(SEND_ERROR "CMake was unable to find QT version: ${DESIRED_QT_VERSION}")
MESSAGE(SEND_ERROR "CMake was unable to find QT version: ${DESIRED_QT_VERSION}. Set advanced values QT_QMAKE_EXECUTABLE and QT${DESIRED_QT_VERSION}_QGLOBAL_FILE.")
ENDIF(NOT QT_FOUND AND DESIRED_QT_VERSION)
ENDIF(NOT QT3_INSTALLED AND NOT QT4_INSTALLED)
MARK_AS_ADVANCED(QT3_QGLOBAL_H_FILE QT4_QGLOBAL_H_FILE QT_QMAKE_EXECUTABLE)

View File

@ -21,6 +21,9 @@
FIND_PATH(QT_INCLUDE_DIR qt.h
"[HKEY_CURRENT_USER\\Software\\Trolltech\\Qt3Versions\\3.2.1;InstallDir]/include/Qt"
"[HKEY_CURRENT_USER\\Software\\Trolltech\\Qt3Versions\\3.2.0;InstallDir]/include/Qt"
"[HKEY_CURRENT_USER\\Software\\Trolltech\\Qt3Versions\\3.1.0;InstallDir]/include/Qt"
$ENV{QTDIR}/include
/usr/local/qt/include
/usr/local/include
@ -50,6 +53,9 @@ IF (QT_MT_REQUIRED)
FIND_LIBRARY(QT_QT_LIBRARY
NAMES qt-mt qt-mt${qt_version_str_lib} qt-mtedu${qt_version_str_lib} qt-mt230nc
PATHS
"[HKEY_CURRENT_USER\\Software\\Trolltech\\Qt3Versions\\3.2.1;InstallDir]/lib"
"[HKEY_CURRENT_USER\\Software\\Trolltech\\Qt3Versions\\3.2.0;InstallDir]/lib"
"[HKEY_CURRENT_USER\\Software\\Trolltech\\Qt3Versions\\3.1.0;InstallDir]/lib"
$ENV{QTDIR}/lib
/usr/local/qt/lib
/usr/local/lib

View File

@ -116,7 +116,10 @@ IF (WIN32)
ENDIF(WIN32)
# check for qmake
FIND_PROGRAM(QT_QMAKE_EXECUTABLE NAMES qmake PATHS $ENV{QTDIR}/bin)
FIND_PROGRAM(QT_QMAKE_EXECUTABLE NAMES qmake PATHS
$ENV{QTDIR}/bin
"[HKEY_CURRENT_USER\\Software\\Trolltech\\Qt3Versions\\4.0.0;InstallDir]/bin"
)
# Set QT_LIBRARY_DIR
IF(NOT QT_LIBRARY_DIR)
@ -153,6 +156,7 @@ IF (NOT QT_HEADERS_DIR)
ENDIF(QT_QMAKE_EXECUTABLE)
ENDIF (NOT QT_HEADERS_DIR)
FIND_PATH( QT_QT_INCLUDE_DIR qglobal.h
"[HKEY_CURRENT_USER\\Software\\Trolltech\\Qt3Versions\\4.0.0;InstallDir]/include/Qt"
${QT_HEADERS_DIR}/Qt
${QT_LIBRARY_DIR}/QtCore.framework/Headers
$ENV{QTDIR}/include/Qt

View File

@ -99,7 +99,7 @@ ADD_CUSTOM_TARGET(wraplibJava ALL
SET (QT_WRAP_CPP "On")
SET (QT_MOC_EXE "echo")
SET(DESIRED_QT_VERSION 3)
INCLUDE( ${CMAKE_ROOT}/Modules/FindQt.cmake )
IF (QT_FOUND AND QT_UIC_EXECUTABLE)