Bim
Bim

Reputation: 1068

Qt 5.2.1, VTK 6.1.0, CMake configuring does not work, Windows 7 x64

I compiled and installed Qt 5.2.1, but now have problems even configuring VTK 6.1.0 with CMake. I checked "VTK_Group_Qt", set the Qt version to 5, provided a path to qmake.exe and set CMAKE_PREFIX_PATH to the Qt install dir, which is "D:/Qt/Qt-5.2.1/win32". That worked so far. When I now configure again, CMake complains:

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)

The error is correct, because the directory at "D:/Qt/Qt-5.2.1/install/include/" is actually missing... When opening up the "Qt5WidgetsConfig.cmake" file I find hardcoded paths like

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

which is just wrong. The "install" should imo not be there.

When configuring Qt I had set the prefix option "-prefix ./install", so I have a clean install directory after "nmake install" (in contrast to using the default qtbase, which is a mess) and it seems to have written this path into the generated .cmake files...

Is this a Qt bug? Is there a workaround?!

Upvotes: 0

Views: 1655

Answers (1)

Winston Chow
Winston Chow

Reputation: 21

This question is old, but I've finished struggling one whole week to build Qt 5.2.1 and VTK 6.1.0 for my project, and I figure some poor soul could use my experience.

My environment:

  • 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 (very useful if you have multiple CPU cores, otherwise nmake takes forever)

jom, perl, python, ruby all must be in the PATH.

ICU unpacked and installed here:

C:\icu53_1

OpenSSL unpacked and installed here:

C:\OpenSSL-Win64

Unpack Qt 5.2.1 to:

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

Unpack VTK 6.1.0 to:

C:\VTK-6.1.0

Run following in 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=

Configure a shadow build of Qt and then build with jom like so (change configuration to your needs):

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

After the build and installation of Qt is complete, we finally configure, build and install 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

Upvotes: 2

Related Questions