⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 findqt4.cmake

📁 Gaussian Mixture Algorithm
💻 CMAKE
📖 第 1 页 / 共 3 页
字号:
# - Find QT 4# This module can be used to find Qt4.# The most important issue is that the Qt4 qmake is available via the system path.# This qmake is then used to detect basically everything else.# This module defines a number of key variables and macros. First is # QT_USE_FILE which is the path to a CMake file that can be included to compile# Qt 4 applications and libraries.  By default, the QtCore and QtGui # libraries are loaded. This behavior can be changed by setting one or more # of the following variables to true:#                    QT_DONT_USE_QTCORE#                    QT_DONT_USE_QTGUI#                    QT_USE_QT3SUPPORT#                    QT_USE_QTASSISTANT#                    QT_USE_QTDESIGNER#                    QT_USE_QTMOTIF#                    QT_USE_QTMAIN#                    QT_USE_QTNETWORK#                    QT_USE_QTNSPLUGIN#                    QT_USE_QTOPENGL#                    QT_USE_QTSQL#                    QT_USE_QTXML#                    QT_USE_QTSVG#                    QT_USE_QTTEST#                    QT_USE_QTUITOOLS## All the libraries required are stored in a variable called QT_LIBRARIES.  # Add this variable to your TARGET_LINK_LIBRARIES.#  #  macro QT4_WRAP_CPP(outfiles inputfile ... )#  macro QT4_WRAP_UI(outfiles inputfile ... )#  macro QT4_ADD_RESOURCE(outfiles inputfile ... )#  macro QT4_AUTOMOC(inputfile ... )#  macro QT4_GENERATE_MOC(inputfile outputfile )#  #  QT_FOUND         If false, don't try to use Qt.#  QT4_FOUND        If false, don't try to use Qt 4.#                      #  QT_QTCORE_FOUND        True if QtCore was found.#  QT_QTGUI_FOUND         True if QtGui was found.#  QT_QT3SUPPORT_FOUND    True if Qt3Support was found.#  QT_QTASSISTANT_FOUND   True if QtAssistant was found.#  QT_QTDESIGNER_FOUND    True if QtDesigner was found.#  QT_QTMOTIF_FOUND       True if QtMotif was found.#  QT_QTNETWORK_FOUND     True if QtNetwork was found.#  QT_QTNSPLUGIN_FOUND    True if QtNsPlugin was found.#  QT_QTOPENGL_FOUND      True if QtOpenGL was found.#  QT_QTSQL_FOUND         True if QtSql was found.#  QT_QTXML_FOUND         True if QtXml was found.#  QT_QTSVG_FOUND         True if QtSvg was found.#  QT_QTTEST_FOUND        True if QtTest was found.#  QT_QTUITOOLS_FOUND     True if QtUiTools was found.#                      #  QT_DEFINITIONS   Definitions to use when compiling code that uses Qt.#                  #  QT_INCLUDES      List of paths to all include directories of #                   Qt4 QT_INCLUDE_DIR and QT_QTCORE_INCLUDE_DIR are#                   always in this variable even if NOTFOUND,#                   all other INCLUDE_DIRS are#                   only added if they are found.#   #  QT_INCLUDE_DIR              Path to "include" of Qt4#  QT_QT_INCLUDE_DIR           Path to "include/Qt" #  QT_QT3SUPPORT_INCLUDE_DIR   Path to "include/Qt3Support" #  QT_QTASSISTANT_INCLUDE_DIR  Path to "include/QtAssistant" #  QT_QTCORE_INCLUDE_DIR       Path to "include/QtCore"         #  QT_QTDESIGNER_INCLUDE_DIR   Path to "include/QtDesigner" #  QT_QTGUI_INCLUDE_DIR        Path to "include/QtGui" #  QT_QTMOTIF_INCLUDE_DIR      Path to "include/QtMotif" #  QT_QTNETWORK_INCLUDE_DIR    Path to "include/QtNetwork" #  QT_QTNSPLUGIN_INCLUDE_DIR   Path to "include/QtNsPlugin" #  QT_QTOPENGL_INCLUDE_DIR     Path to "include/QtOpenGL" #  QT_QTSQL_INCLUDE_DIR        Path to "include/QtSql" #  QT_QTXML_INCLUDE_DIR        Path to "include/QtXml" #  QT_QTSVG_INCLUDE_DIR        Path to "include/QtSvg"#  QT_QTTEST_INCLUDE_DIR       Path to "include/QtTest"#                            #  QT_LIBRARY_DIR              Path to "lib" of Qt4#                            #  QT_PLUGINS_DIR              Path to "plugins" for Qt4#                            # For every library of Qt there are three variables:#  QT_QTFOO_LIBRARY_RELEASE, which contains the full path to the release version#  QT_QTFOO_LIBRARY_DEBUG, which contains the full path to the debug version#  QT_QTFOO_LIBRARY, the full path to the release version if available, otherwise to the debug version## So there are the following variables:# The Qt3Support library:     QT_QT3SUPPORT_LIBRARY#                             QT_QT3SUPPORT_LIBRARY_RELEASE#                             QT_QT3SUPPORT_DEBUG## The QtAssistant library:    QT_QTASSISTANT_LIBRARY#                             QT_QTASSISTANT_LIBRARY_RELEASE#                             QT_QTASSISTANT_LIBRARY_DEBUG## The QtCore library:         QT_QTCORE_LIBRARY#                             QT_QTCORE_LIBRARY_RELEASE#                             QT_QTCORE_LIBRARY_DEBUG## The QtDesigner library:     QT_QTDESIGNER_LIBRARY#                             QT_QTDESIGNER_LIBRARY_RELEASE#                             QT_QTDESIGNER_LIBRARY_DEBUG## The QtGui library:          QT_QTGUI_LIBRARY#                             QT_QTGUI_LIBRARY_RELEASE#                             QT_QTGUI_LIBRARY_DEBUG## The QtMotif library:        QT_QTMOTIF_LIBRARY#                             QT_QTMOTIF_LIBRARY_RELEASE#                             QT_QTMOTIF_LIBRARY_DEBUG## The QtNetwork library:      QT_QTNETWORK_LIBRARY#                             QT_QTNETWORK_LIBRARY_RELEASE#                             QT_QTNETWORK_LIBRARY_DEBUG## The QtNsPLugin library:     QT_QTNSPLUGIN_LIBRARY#                             QT_QTNSPLUGIN_LIBRARY_RELEASE#                             QT_QTNSPLUGIN_LIBRARY_DEBUG## The QtOpenGL library:       QT_QTOPENGL_LIBRARY#                             QT_QTOPENGL_LIBRARY_RELEASE#                             QT_QTOPENGL_LIBRARY_DEBUG## The QtSql library:          QT_QTSQL_LIBRARY#                             QT_QTSQL_LIBRARY_RELEASE#                             QT_QTSQL_LIBRARY_DEBUG## The QtXml library:          QT_QTXML_LIBRARY#                             QT_QTXML_LIBRARY_RELEASE#                             QT_QTXML_LIBRARY_DEBUG## The QtSvg library:          QT_QTSVG_LIBRARY#                             QT_QTSVG_LIBRARY_RELEASE#                             QT_QTSVG_LIBRARY_DEBUG## The QtTest library:         QT_QTTEST_LIBRARY#                             QT_QTTEST_LIBRARY_RELEASE#                             QT_QTTEST_LIBRARY_DEBUG## The qtmain library for Windows QT_QTMAIN_LIBRARY#                             QT_QTMAIN_LIBRARY_RELEASE#                             QT_QTMAIN_LIBRARY_DEBUG##The QtUiTools library:       QT_QTUITOOLS_LIBRARY#                             QT_QTUITOOLS_LIBRARY_RELEASE#                             QT_QTUITOOLS_LIBRARY_DEBUG#  # also defined, but NOT for general use are#  QT_MOC_EXECUTABLE          Where to find the moc tool.#  QT_UIC_EXECUTABLE          Where to find the uic tool.#  QT_UIC3_EXECUTABLE         Where to find the uic3 tool.#  QT_RCC_EXECUTABLE          Where to find the rcc tool#  #  QT_DOC_DIR                 Path to "doc" of Qt4#  QT_MKSPECS_DIR             Path to "mkspecs" of Qt4### These are around for backwards compatibility # they will be set#  QT_WRAP_CPP  Set true if QT_MOC_EXECUTABLE is found#  QT_WRAP_UI   Set true if QT_UIC_EXECUTABLE is found#  # These variables do _NOT_ have any effect anymore (compared to FindQt.cmake)#  QT_MT_REQUIRED         Qt4 is now always multithreaded#  # These variables are set to "" Because Qt structure changed # (They make no sense in Qt4)#  QT_QT_LIBRARY        Qt-Library is now splitINCLUDE(CheckSymbolExists)INCLUDE(MacroAddFileDependencies)SET(QT_USE_FILE ${CMAKE_ROOT}/Modules/UseQt4.cmake)SET( QT_DEFINITIONS "")# check for qmakeFIND_PROGRAM(QT_QMAKE_EXECUTABLE NAMES qmake qmake-qt4 PATHS  "[HKEY_CURRENT_USER\\Software\\Trolltech\\Qt3Versions\\4.0.0;InstallDir]/bin"  "[HKEY_CURRENT_USER\\Software\\Trolltech\\Versions\\4.0.0;InstallDir]/bin"  $ENV{QTDIR}/bin  )SET(QT4_INSTALLED_VERSION_TOO_OLD FALSE)##  macro for asking qmake to process pro filesMACRO(QT_QUERY_QMAKE outvar invar)  FILE(WRITE ${CMAKE_CURRENT_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmpQmake/tmp.pro    "message(CMAKE_MESSAGE<$$${invar}>)")  EXECUTE_PROCESS(COMMAND ${QT_QMAKE_EXECUTABLE}    WORKING_DIRECTORY      ${CMAKE_CURRENT_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmpQmake    OUTPUT_VARIABLE _qmake_query_output    ERROR_VARIABLE _qmake_query_output )  FILE(REMOVE_RECURSE     "${CMAKE_CURRENT_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmpQmake")  STRING(REGEX REPLACE ".*CMAKE_MESSAGE<([^>]*).*" "\\1" ${outvar} "${_qmake_query_output}")ENDMACRO(QT_QUERY_QMAKE)IF (QT_QMAKE_EXECUTABLE)   SET(QT4_QMAKE_FOUND FALSE)      EXEC_PROGRAM(${QT_QMAKE_EXECUTABLE} ARGS "-query QT_VERSION" OUTPUT_VARIABLE QTVERSION)  # check for qt3 qmake and then try and find qmake-qt4 in the path  IF("${QTVERSION}" MATCHES "Unknown")    SET(QT_QMAKE_EXECUTABLE NOTFOUND CACHE FILEPATH "" FORCE)    FIND_PROGRAM(QT_QMAKE_EXECUTABLE NAMES qmake-qt4 PATHS      "[HKEY_CURRENT_USER\\Software\\Trolltech\\Qt3Versions\\4.0.0;InstallDir]/bin"      "[HKEY_CURRENT_USER\\Software\\Trolltech\\Versions\\4.0.0;InstallDir]/bin"      $ENV{QTDIR}/bin      )    IF(QT_QMAKE_EXECUTABLE)      EXEC_PROGRAM(${QT_QMAKE_EXECUTABLE}         ARGS "-query QT_VERSION" OUTPUT_VARIABLE QTVERSION)    ENDIF(QT_QMAKE_EXECUTABLE)  ENDIF("${QTVERSION}" MATCHES "Unknown")   # check that we found the Qt4 qmake, Qt3 qmake output won't match here   STRING(REGEX MATCH "^[0-9]+\\.[0-9]+\\.[0-9]+" qt_version_tmp "${QTVERSION}")   IF (qt_version_tmp)      # we need at least version 4.0.0      IF (NOT QT_MIN_VERSION)         SET(QT_MIN_VERSION "4.0.0")      ENDIF (NOT QT_MIN_VERSION)         #now parse the parts of the user given version string into variables      STRING(REGEX MATCH "^[0-9]+\\.[0-9]+\\.[0-9]+" req_qt_major_vers "${QT_MIN_VERSION}")      IF (NOT req_qt_major_vers)         MESSAGE( FATAL_ERROR "Invalid Qt version string given: \"${QT_MIN_VERSION}\", expected e.g. \"4.0.1\"")      ENDIF (NOT req_qt_major_vers)         # now parse the parts of the user given version string into variables      STRING(REGEX REPLACE "^([0-9]+)\\.[0-9]+\\.[0-9]+" "\\1" req_qt_major_vers "${QT_MIN_VERSION}")      STRING(REGEX REPLACE "^[0-9]+\\.([0-9])+\\.[0-9]+" "\\1" req_qt_minor_vers "${QT_MIN_VERSION}")      STRING(REGEX REPLACE "^[0-9]+\\.[0-9]+\\.([0-9]+)" "\\1" req_qt_patch_vers "${QT_MIN_VERSION}")         IF (NOT req_qt_major_vers EQUAL 4)         MESSAGE( FATAL_ERROR "Invalid Qt version string given: \"${QT_MIN_VERSION}\", major version 4 is required, e.g. \"4.0.1\"")      ENDIF (NOT req_qt_major_vers EQUAL 4)         # and now the version string given by qmake      STRING(REGEX REPLACE "^([0-9]+)\\.[0-9]+\\.[0-9]+.*" "\\1" found_qt_major_vers "${QTVERSION}")      STRING(REGEX REPLACE "^[0-9]+\\.([0-9])+\\.[0-9]+.*" "\\1" found_qt_minor_vers "${QTVERSION}")      STRING(REGEX REPLACE "^[0-9]+\\.[0-9]+\\.([0-9]+).*" "\\1" found_qt_patch_vers "${QTVERSION}")         # compute an overall version number which can be compared at once      MATH(EXPR req_vers "${req_qt_major_vers}*10000 + ${req_qt_minor_vers}*100 + ${req_qt_patch_vers}")      MATH(EXPR found_vers "${found_qt_major_vers}*10000 + ${found_qt_minor_vers}*100 + ${found_qt_patch_vers}")         IF (found_vers LESS req_vers)         SET(QT4_QMAKE_FOUND FALSE)         SET(QT4_INSTALLED_VERSION_TOO_OLD TRUE)      ELSE (found_vers LESS req_vers)    SET(QT4_QMAKE_FOUND TRUE)      ENDIF (found_vers LESS req_vers)   ENDIF (qt_version_tmp)ENDIF (QT_QMAKE_EXECUTABLE)IF (QT4_QMAKE_FOUND)  # ask qmake for the library dir  # Set QT_LIBRARY_DIR  IF (NOT QT_LIBRARY_DIR)    EXEC_PROGRAM( ${QT_QMAKE_EXECUTABLE}      ARGS "-query QT_INSTALL_LIBS"      OUTPUT_VARIABLE QT_LIBRARY_DIR_TMP )    IF(EXISTS "${QT_LIBRARY_DIR_TMP}")      SET(QT_LIBRARY_DIR ${QT_LIBRARY_DIR_TMP} CACHE PATH "Qt library dir")    ELSE(EXISTS "${QT_LIBRARY_DIR_TMP}")      MESSAGE("Warning: QT_QMAKE_EXECUTABLE reported QT_INSTALL_LIBS as ${QT_LIBRARY_DIR_TMP}")       MESSAGE("Warning: ${QT_LIBRARY_DIR_TMP} does NOT exist, Qt must NOT be installed correctly.")    ENDIF(EXISTS "${QT_LIBRARY_DIR_TMP}")  ENDIF(NOT QT_LIBRARY_DIR)    IF (APPLE)    IF (EXISTS ${QT_LIBRARY_DIR}/QtCore.framework)      SET(QT_USE_FRAMEWORKS ON        CACHE BOOL "Set to ON if Qt build uses frameworks.")    ELSE (EXISTS ${QT_LIBRARY_DIR}/QtCore.framework)      SET(QT_USE_FRAMEWORKS OFF        CACHE BOOL "Set to ON if Qt build uses frameworks.")    ENDIF (EXISTS ${QT_LIBRARY_DIR}/QtCore.framework)        MARK_AS_ADVANCED(QT_USE_FRAMEWORKS)  ENDIF (APPLE)    # ask qmake for the binary dir  IF (NOT QT_BINARY_DIR)     EXEC_PROGRAM(${QT_QMAKE_EXECUTABLE}        ARGS "-query QT_INSTALL_BINS"        OUTPUT_VARIABLE qt_bins )     SET(QT_BINARY_DIR ${qt_bins} CACHE INTERNAL "")  ENDIF (NOT QT_BINARY_DIR)  # ask qmake for the include dir  IF (NOT QT_HEADERS_DIR)      EXEC_PROGRAM( ${QT_QMAKE_EXECUTABLE}        ARGS "-query QT_INSTALL_HEADERS"         OUTPUT_VARIABLE qt_headers )      SET(QT_HEADERS_DIR ${qt_headers} CACHE INTERNAL "")  ENDIF(NOT QT_HEADERS_DIR)  # ask qmake for the documentation directory  IF (NOT QT_DOC_DIR)    EXEC_PROGRAM( ${QT_QMAKE_EXECUTABLE}      ARGS "-query QT_INSTALL_DOCS"      OUTPUT_VARIABLE qt_doc_dir )    SET(QT_DOC_DIR ${qt_doc_dir} CACHE PATH "The location of the Qt docs")  ENDIF (NOT QT_DOC_DIR)  # ask qmake for the mkspecs directory  IF (NOT QT_MKSPECS_DIR)    EXEC_PROGRAM( ${QT_QMAKE_EXECUTABLE}      ARGS "-query QMAKE_MKSPECS"      OUTPUT_VARIABLE qt_mkspecs_dir )    SET(QT_MKSPECS_DIR ${qt_mkspecs_dir} CACHE PATH "The location of the Qt mkspecs")  ENDIF (NOT QT_MKSPECS_DIR)  # ask qmake for the plugins directory  IF (NOT QT_PLUGINS_DIR)    EXEC_PROGRAM( ${QT_QMAKE_EXECUTABLE}      ARGS "-query QT_INSTALL_PLUGINS"      OUTPUT_VARIABLE qt_plugins_dir )    SET(QT_PLUGINS_DIR ${qt_plugins_dir} CACHE PATH "The location of the Qt plugins")  ENDIF (NOT QT_PLUGINS_DIR)  ########################################  #  #       Setting the INCLUDE-Variables  #  ########################################  FIND_PATH(QT_QTCORE_INCLUDE_DIR QtGlobal    ${QT_HEADERS_DIR}/QtCore    ${QT_LIBRARY_DIR}/QtCore.framework/Headers    NO_DEFAULT_PATH   )  # Set QT_INCLUDE_DIR by removine "/QtCore" in the string ${QT_QTCORE_INCLUDE_DIR}  IF( QT_QTCORE_INCLUDE_DIR AND NOT QT_INCLUDE_DIR)    IF (QT_USE_FRAMEWORKS)      SET(QT_INCLUDE_DIR ${QT_HEADERS_DIR})

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -