【问题标题】:Qt 5.1 problems Qt5::XmlPatterns (VS2012 + CMake)Qt 5.1 问题 Qt5::XmlPatterns (VS2012 + CMake)
【发布时间】:2013-07-04 14:39:32
【问题描述】:

我为 VS2012 x64 构建 Qt5.1。现在我想用 Qt 来构建一个简单的 UI 应用程序。不幸的是,CMake 给了我一些错误信息:

CMake Error at C:/thirdparty/vs2012/x64/qt-everywhere-opensource-src-5.1.0/qtbase/lib/cmake/Qt5XmlPatterns/Qt5XmlPatternsConfig.cmake:15 (message):
  The imported target "Qt5::XmlPatterns" references the file

     "C:/thirdparty/vs2012/x64/qt-everywhere-opensource-src-5.1.0/qtbase/include/QtXmlPatterns/5.1.0"

  but this file does not exist.  Possible reasons include:

  * The file was deleted, renamed, or moved to another location.

  * An install or uninstall procedure did not complete successfully.

  * The installation package was faulty and contained

     "C:/thirdparty/vs2012/x64/qt-everywhere-opensource-src-5.1.0/qtbase/lib/cmake/Qt5XmlPatterns/Qt5XmlPatternsConfig.cmake"

  but not all the files it references.

Call Stack (most recent call first):
  C:/thirdparty/vs2012/x64/qt-everywhere-opensource-src-5.1.0/qtbase/lib/cmake/Qt5XmlPatterns/Qt5XmlPatternsConfig.cmake:58 (_qt5_XmlPatterns_check_file_exists)
  CMakeLists.txt:59 (find_package)

同一个项目适用于 Qt 5.0.2 和 Qt 5.0.1。

我设置了 Qt5Core_DIR 和 Qt5Xml_DIR 的路径,但是 Qt5XmlPatterns_DIR 不起作用。在查看 Qt lib 目录时,我看到成功构建的 Qt5XmlPatterns - 我还可以执行设计器应用程序。

我使用以下说明构建 Qt 5.1.0:

  1. 配置 -developer-build -opensource -nomake 示例 -nomake 测试
  2. nmake

目录“C:/thirdparty/vs2012/x64/qt-everywhere-opensource-src-5.1.0/qtbase/include/QtXmlPatterns/5.1.0”不存在。但是目录“C:/thirdparty/vs2012/x64/qt-everywhere-opensource-src-5.1.0/qtbase/include/QtXmlPatterns”确实存在。该目录只包含一个文件:“QtXmlPatternsDepends”

任何想法出了什么问题?

更新:我现在使用 Qt 网站 (MS2012 x64) 提供的安装程序。下载并安装后,我尝试使用已安装的版本设置项目。这次它起作用了——可能在构建 Qt 5.1.0 时出了点问题——但是:似乎 CMake 配置文件指向了错误的目录(指向“qtbase”而不是“qtxmlpatterns”)——可能有什么东西不能正常工作在 Qt5XmlPatternsConfig.cmake 文件中……

第二次更新:我从头开始重新构建 Qt5.1 - 但我仍然遇到相同的错误...

第三次更新:我将文件从目录“C:\thirdparty\vs2012\x64\qt-everywhere-opensource-src-5.1.0\qtxmlpatterns\include\QtXmlPatterns”复制到“ C:\thirdparty\vs2012\x64\qt-everywhere-opensource-src-5.1.0\qtxmlpatterns\include\QtXmlPatterns" 并为 QtDeclarative 和 QtScript 做了同样的事情

CMake 中的所有错误都消失了 - 但是在编译时找不到某些标头...

【问题讨论】:

    标签: qt visual-c++ cmake


    【解决方案1】:

    我使用的是自建版本的Qt5.1 for vs2012,我不得不修改每个${prefix}/lib/cmake/${Qt5LibraryName}文件夹中的Qt5xxx.cmake文件。例如,我不得不修改 来自

    的 Qt5AxContainer.cmake

    。 . . 设置(_Qt5AxContainer_OWN_INCLUDE_DIRS) . .

    。 . 设置(_Qt5AxContainer_OWN_INCLUDE_DIRS "${_qt5Gui_install_prefix}/../qtactiveqt/include/" "${_qt5Gui_install_prefix}/../qtactiveqt/include/ActiveQt" ) . .

    我发现 _Qt5XXX_OWN_INCLUDE_DIRS 用于实际标头的目录路径,并且必须正确添加/修改多个路径。

    虽然我还没有将此行为提交给 Qt 的错误跟踪系统,但它似乎是构建脚本中的错误。

    【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2015-08-18
    • 1970-01-01
    • 2021-10-14
    • 1970-01-01
    • 2013-09-11
    • 1970-01-01
    相关资源
    最近更新 更多