[CMake] FindQt4

Clinton Stimpson clinton at elemtech.com
Thu Oct 6 15:39:27 EDT 2011


On Friday, September 30, 2011 03:54:26 pm MM wrote:
> hi,
> 
> I generated a msvc10 solution with cmake 2.8.5.
> 
> I use the following in the project's CMakeLists.txt
> FIND_PACKAGE(Qt4 4.5.3 COMPONENTS QtCore QtGui QtOpenGL REQUIRED)
> IF(QT4_FOUND)
>   INCLUDE(${QT_USE_FILE})
>   TARGET_LINK_LIBRARIES(nhui ${QT_LIBRARIES})
> ELSE()
>   MESSAGE(FATAL_ERROR "Qt>=4.5.3 not found")
> ENDIF()
> 
> opening the solution in vs2010 and linking against qwtplot3d required
> adding these 2 libs on winxp32bit
> OpenGL32.Lib et GlU32.Lib
> 
> I would have thought QtOpenGL4.lib required these above 2 libs and so
> FindQt4 would have added them automatically?
> 

QtOpenGL4.dll needs those libraries, but that doesn't necessarily mean users 
of that library need to link with opengl32.lib and glu32.lib also.

If your code needs to link with opengl32.lib, then you can use
find_package(OpenGL) and target_link_libraries().

-- 
Clinton Stimpson
Elemental Technologies, Inc
Computational Simulation Software, LLC
www.csimsoft.com


More information about the CMake mailing list