[vtk-developers] VTK and determining the Qt version.

Andrew Maclean andrew.amaclean at gmail.com
Mon Oct 14 00:27:55 EDT 2013


This has arisen because I was looking at the Qt examples in VTK in the
folder Examples/GUI/Qt and thinking about issues that might arise when
building them as standalone examples.

If they are built within VTK, then a similar approach can be used to that
used when the VTK Qt tests are built,namely by adding the following code
like this in their respective CMakeLists.txt files:

--------------------------------------------------------------------------
if(VTK_QT_VERSION VERSION_GREATER "4")
# Do something specific for Qt5
else()
# Do something specific for Qt4
endif()
--------------------------------------------------------------------------

Now the problem is that VTK_QT_VERSION is not a global configuration
setting. So we don't know what version of Qt was used when VTK was built.
This means that when building examples we have no way (as far as I can see)
of determining what version of Qt was used.

My initial thinking is that we need to have a global configuration option
in VTKConfig.cmake, like this:
SET(VTK_QT_VERSION "5") or SET(VTK_QT_VERSION "4") depending upon the Qt
version.

Then in your CMake code have:
if(VTK_QT_VERSION VERSION_GREATER "4")
# Do something specific for Qt5
else()
# Do something specific for Qt4
endif()

I think this would work, but has anyone else a better idea or solution?

In case you think it is a trivial problem, at present I can't build the
Wiki Examples because they assume Qt4 is used.


Thanks
   Andrew


-- 
___________________________________________
Andrew J. P. Maclean

___________________________________________
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/vtk-developers/attachments/20131014/fe540d39/attachment.html>


More information about the vtk-developers mailing list