我编译并安装了Qt 5.2.1,但现在甚至在使用CMake配置VTK 6.1.0时也遇到了问题。我检查了“VTK_Group_Qt”,将Qt版本设置为5,提供了qmake.exe的路径,并将CMAKE_PREFIX_PATH设置为Qt install dir,即“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错误吗?有解决方法吗?!
答案 0 :(得分:2)
这个问题已经过时了,但是我已经为我的项目完成了整整一周的努力来构建Qt 5.2.1和VTK 6.1.0,我认为一些可怜的灵魂可以利用我的经验。
我的环境:
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