1

I already compiled Open Scene Graph 3.2 against Qt4. I managed it through an initial cache setting the following variables:

set(ENV{QTDIR} "path/to/qt4" CACHE PATH "") set(Qt_FIND_VERSION "4.8.5" CACHE PATH "")

But when I try to change this to qt5 it doesn't work. Qt5 is not found. Any hints what settings should be used when copiling Open Scene Graph 3.2 with Qt5 and Qt5 should be found (most parts) automatically with the find script of CMake?

Beachwalker
  • 7,685
  • 6
  • 52
  • 94

2 Answers2

3

Just set these variables to feed the cache:

set(DESIRED_QT_VERSION "5" CACHE STRING "")
set(CMAKE_PREFIX_PATH "C:/Qt/5.1.1/msvc2012_64_opengl" CACHE PATH "")
Beachwalker
  • 7,685
  • 6
  • 52
  • 94
  • Everything seems to be fine and the compilation will succeed with Qt5, but the example osgViewerQt doesn't work with the Qt5 example (breaks for multi-threaded rendering, works with --SingleThreaded switch) – Beachwalker Dec 09 '13 at 16:56
2

With Qt 5 new CMake macros have been defined. The method to find and use Qt in a CMake project has been deeply updated. A good starting point is the doc about CMake usage (https://qt-project.org/doc/qt-5.1/qtdoc/cmake-manual.html).

In general, the easiest way to help CMake finding Qt is to add the Qt bin folder to your path variable (the folder containing qmake binary). If you can't/don't want to do so, I suggest you to use CMAKE_PREFIX_PATH variable.

Antwane
  • 20,760
  • 7
  • 51
  • 84
  • thanx, but osg didn't find the right version. it seems open scene graph tries to find qt4 – Beachwalker Dec 02 '13 at 20:29
  • I don't know well OSG, but I saw in the 3.3.0 dev release the CMakeLists and it appears that you can compile against Qt5 with this version. The @Beachwalker's answer seems useful. – Antwane Dec 03 '13 at 15:30