2

I'm trying to fix the installation of a custom built Qt. I'm using the qt.conf from this very similar question. However, CMake 2.8.7 is still unable to find moc, uic, and rcc.

CMake Error at C:/Program Files (x86)/CMake 2.8/share/cmake-2.8/Modules/FindPackageHandleStandardArgs.cmake:97 (MESSAGE):
  Could NOT find Qt4 (missing: QT_MOC_EXECUTABLE QT_RCC_EXECUTABLE
  QT_UIC_EXECUTABLE) (found suitable exact version "4.8.1")

I have manually set the QT_QMAKE_EXECUTABLE variable to the correct value, namely B:/lib/vs10/Qt-4.8.1-VS10x64/bin/qmake.exe. After deploying the qt.conf file, qmake -v returns the correct path:

c:\>B:/lib/vs10/Qt-4.8.1-VS10x64/bin/qmake.exe -v
QMake version 2.01a
Using Qt version 4.8.1 in B:/lib/vs10/Qt-4.8.1-VS10x64/lib

qmake -query QT_INSTALL_PREFIX also returns the correct path. Note that I can't use environment variables because we need different Qt versions for different projects.

What am I missing?

Community
  • 1
  • 1
Andreas Haferburg
  • 5,189
  • 3
  • 37
  • 63

2 Answers2

1

You should set CMAKE_PREFIX_PATH to B:/lib/vs10/Qt-4.8.1-VS10x64/bin instead of setting QT_QMAKE_EXECUTABLE. It will help cmake to find all qt executables.

Pavel Strakhov
  • 39,123
  • 5
  • 88
  • 127
1

The problem was that they decided to make QT_BINARY_DIR a CACHE INTERNAL variable, which wasn't reset properly after changing qt.conf and deleting the QT_* variables in CMake. QT_BINARY_DIR is only reset if the path of the qmake.exe changes. After clearing the cache it worked.

The lessons I draw from this: Don't use CACHE INTERNAL, just FORCE and mark_as_advanced.

Andreas Haferburg
  • 5,189
  • 3
  • 37
  • 63