【问题标题】:Qt 5.2.1, VTK 6.1.0, CMake configuring does not work, Windows 7 x64Qt 5.2.1,VTK 6.1.0,CMake 配置不起作用,Windows 7 x64
【发布时间】:2014-06-17 13:05:10
【问题描述】:

我编译并安装了 Qt 5.2.1,但现在即使使用 CMake 配置 VTK 6.1.0 也有问题。我检查了“VTK_Group_Qt”,将 Qt 版本设置为 5,提供了 qmake.exe 的路径并将 CMAKE_PREFIX_PATH 设置为 Qt 安装目录,即“D:/Qt/Qt-5.2.1/win32”。到目前为止有效。当我现在再次配置时,CMake 抱怨:

CMake Error at D:/Qt/Qt-5.2.1/win32/lib/cmake/Qt5Widgets/Qt5WidgetsConfig.cmake:15 (message):
  The imported target "Qt5::Widgets" references the file

     "D:/Qt/Qt-5.2.1/install/include/"

  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

     "D:/Qt/Qt-5.2.1/win32/lib/cmake/Qt5Widgets/Qt5WidgetsConfig.cmake"

  but not all the files it references.

Call Stack (most recent call first):
  D:/Qt/Qt-5.2.1/win32/lib/cmake/Qt5Widgets/Qt5WidgetsConfig.cmake:58 (_qt5_Widgets_check_file_exists)
  GUISupport/Qt/CMakeLists.txt:58 (find_package)

错误是正确的,因为实际上缺少“D:/Qt/Qt-5.2.1/install/include/”目录...打开“Qt5WidgetsConfig.cmake”文件时,我发现硬编码路径如

set(imported_location "${_qt5Widgets_install_prefix}/install/bin/${LIB_LOCATION}")

这是错误的。 “安装”应该不存在。

在配置 Qt 时,我设置了前缀选项“-prefix ./install”,因此在“nmake install”之后我有一个干净的安装目录(与使用默认的 qtbase 相比,这是一团糟),它似乎已将此路径写入生成的 .cmake 文件中...

这是一个 Qt 错误吗?有解决办法吗?!

【问题讨论】:

  • 一种解决方法显然是将整个 Qt 安装复制到“../install”,但我认为这不是应该的工作方式......

标签: cmake qt5 vtk


【解决方案1】:

这个问题很老了,但我已经为我的项目构建 Qt 5.2.1 和 VTK 6.1.0 苦苦挣扎了一整周,我认为一些可怜的人可以利用我的经验。

我的环境:

  • Windows 7 SP1
  • VS2012 Pro 11.0.50727.1 RTMREL
  • CMake 2.8.11
  • qt-everywhere-opensource-src-5.2.1.zip
  • VTK-6.1.0.zip
  • ActivePerl-5.18.2.1802-MSWin32-x64-298023
  • ActivePython-3.4.1.0-win64-x64
  • rubyinstaller-2.1.3-x64
  • icu_53_1_msvc_2012_64_devel.7z
  • Win64OpenSSL-1_0_1j.exe
  • jom 1.0.4(如果您有多个 CPU 内核,这非常有用,否则 nmake 需要很长时间)

jom、perl、python、ruby 都必须在 PATH 中。

ICU 解压并安装在这里:

C:\icu53_1

OpenSSL 解压并安装在这里:

C:\OpenSSL-Win64

解压 Qt 5.2.1 到:

C:\qt-everywhere-opensource-src-5.2.1

将 VTK 6.1.0 解压到:

C:\VTK-6.1.0

在 cmd.exe 中运行:

REM Set up \Microsoft Visual Studio 2012, where <arch> is \c amd64, \c x86, etc.
CALL "C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\vcvarsall.bat" amd64
SET _ROOT=C:\qt-everywhere-opensource-src-5.2.1
SET PATH=%_ROOT%\qtbase\bin;%_ROOT%\gnuwin32\bin;%PATH%
SET PATH=%PATH%;C:\icu53_1\lib
SET INCLUDE=%INCLUDE%;C:\icu53_1\include;C:\OpenSSL-Win64\include\openssl
SET LIB=%LIB%;C:\icu53_1\lib;C:\OpenSSL-Win64\lib;C:\OpenSSL-Win64\lib\VC;C:\OpenSSL-Win64\lib\VC\static
REM Uncomment the below line when using a git checkout of the source repository
REM SET PATH=%_ROOT%\qtrepotools\bin;%PATH%
SET QMAKESPEC=win32-msvc2012
SET _ROOT=

配置 Qt 的影子构建,然后像这样使用 jom 构建(根据您的需要更改配置):

cd C:\qt-everywhere-opensource-src-5.2.1
mkdir build
cd build
..\configure -prefix c:\Qt\Qt5.2.1 -developer-build -release -opensource -confirm-license -nomake examples -nomake tests -opengl desktop
jom
jom install

Qt搭建安装完成后,我们最后配置、搭建、安装VTK:

cd C:\VTK-6.1.0
mkdir build
cd build
cmake -G "Visual Studio 11 Win64" c:/VTK-6.1.0 -DCMAKE_INSTALL_PREFIX:path=C:/VTK/VTK6.1.0 -DVTK_QT_VERSION:STRING=5 -DQT_QMAKE_EXECUTABLE:PATH=C:/Qt/Qt5.2.1/bin/qmake.exe -DVTK_Group_Qt:BOOL=ON -DCMAKE_PREFIX_PATH:PATH=C:/Qt/Qt5.2.1/lib/cmake
devenv VTK.sln /build release
devenv VTK.sln /build release /project INSTALL

【讨论】:

    猜你喜欢
    • 2011-01-06
    • 1970-01-01
    • 2011-10-02
    • 2012-07-11
    • 2011-02-03
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多