c++ - 针对 Qt 5.10.1 编译 QtWebKit 5.212 的私有(private) header 问题

标签 c++ qt cmake qt5 qtwebkit

在 Windows 10、Visual Studio 2015 上,我正在针对 Qt 5.10.1 构建 QtWebKit (5.212),但在构建的配置部分遇到错误。

这是我使用的命令行:

perl Tools\Scripts\build-webkit --qt --release --only-webkit --no-ninja --cmakeargs="-Thost=x64 -DCMAKE_GENERATOR_PLATFORM=x64" -G \"Visual Studio 14 2015 Win64\" --prefix=E:\Qt-5.10.1\QtWebKitBin -v

这里是错误:

-- Performing Test Qt5Gui_PRIVATE_HEADER_FOUND
-- Performing Test Qt5Gui_PRIVATE_HEADER_FOUND - Failed
CMake Error at Source/cmake/OptionsQt.cmake:75 (message):
  Header private/qhexstring_p.h is not found.  Please make sure that:

      1. Private headers of Qt5Gui are installed
      2. Qt5Gui_PRIVATE_INCLUDE_DIRS is correctly defined in Qt5GuiConfig.cmake
Call Stack (most recent call first):
  Source/cmake/OptionsQt.cmake:612 (CHECK_QT5_PRIVATE_INCLUDE_DIRS)
  Source/cmake/WebKitCommon.cmake:50 (include)
  CMakeLists.txt:139 (include)


-- Configuring incomplete, errors occurred!

它用于进行测试的私有(private) header 确实存在于 Qt5 include 目录中,正如人们所期望的那样,在这个位置:

E:\Qt-5.10.1\QtBin\include\QtGui\5.10.1\QtGui\private\qhexstring_p.h

Qt5GuiConfig.cmake文件只存在于Qt安装的E:\Qt-5.10.1\QtBin\lib\cmake\Qt5Gui目录中(不存在于QtWebKit源码安装中)。我不知道它是否以任何方式利用它。

我需要做什么才能让构建根据需要找到这个目录?将 'include\QtGui\5.10.1\QtGui\' 添加到 INCLUDE env var 不起作用,但我不认为这是正确的解决方案。

以下是我的环境中与 Qt 目录相关的部分:

INCLUDE = ...;E:\Qt-5.10.1\QtBin\include;E:\Qt-5.10.1\qt-everywhere-src-5.10.1\include
LIB = ...;E:\Qt-5.10.1\QtBin\lib;E:\Qt-5.10.1\qt-everywhere-src-5.10.1\lib
PATH = E:\Qt-5.10.1\qt-everywhere-src-5.10.1\qtbase\bin;E:\Qt-5.10.1\qt-everywhere-src-5.10.1\gnuwin32\bin;E:\Qt-5.10.1\QtBin\bin;...

QtBin 是我编译的Qt 5.10.1所在的目录。

qt-everywhere-src-5.10.1为Qt 5.10.1源码包

在此先感谢您的帮助。我在 Google 或 StackOverflow 上搜索找不到任何答案。

最佳答案

根据 the wiki ,您应该尝试定义 CMAKE_PREFIX_PATH 以指向您的 Qt 安装

例如:

perl Tools\Scripts\build-webkit --qt --release --only-webkit --no-ninja --cmakeargs="-Thost=x64 -DCMAKE_GENERATOR_PLATFORM=x64 -DCMAKE_PREFIX_PATH=c:\Qt\Qt5.6.0\5.6\msvc2015" -G \"Visual Studio 14 2015 Win64\" --prefix=E:\Qt-5.10.1\QtWebKitBin -v

关于c++ - 针对 Qt 5.10.1 编译 QtWebKit 5.212 的私有(private) header 问题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/52448976/

相关文章:

C++ 哪个函数更快?重复赋值或重复创建

由 小码哥发布于 2019-03-18 标签:c++openmpshared_ptrdatarace

c++ - 匹配参数未知时如何使用 RE2 库

c++ - 外部库的 undefined reference (C++、QT、Ubuntu 14、CCV)

c - 如何使用 CMake 将我的库与 czmq 链接

c++ - 将小部件添加到 QFileDialog

c++ - QGraphicsScene 中的鼠标移动跟踪

c++ - Boost 编译点云库时出现的问题

cmake - 使用 CMake 检测当前的 CMake 版本

c++ - 按下 QDialog Cancel 或 OK 时如何调用函数?