cmake不使用QtOpenGL链接libGLU [英] cmake doesn't link libGLU using QtOpenGL

查看:267
本文介绍了cmake不使用QtOpenGL链接libGLU的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试编译使用QtOpenGL的软件,但由于没有-lGLU,所以出现了链接错误. 使用cmake. 在我看来,CMakeLists.txt文件中唯一相关的行是find_package(Qt4 REQUIRED)

I'm trying to compile a software that uses QtOpenGL, but I got a link error because -lGLU is not present. cmake is used. The only relevant line in CMakeLists.txt files seems to me find_package(Qt4 REQUIRED)

系统为Linux 64位,Debian不稳定,qt版本4.7.3,cmake版本2.8

The system is Linux 64bit, Debian unstable, qt version 4.7.3, cmake version 2.8

推荐答案

GLU既不是OpenGL的一部分,也不是Qt的一部分.您必须手动将其添加为附加依赖项; CMake FindOpenGL模块还搜索GLU

GLU is neither part of OpenGL nor Qt. You must add it as an additional dependency manually; the CMake FindOpenGL module also searches for GLU

% cmake --help-module FindOpenGL
cmake version 2.8.1
  FindOpenGL
       Try to find OpenGL

       Once done this will define


         OPENGL_FOUND        - system has OpenGL
         OPENGL_XMESA_FOUND  - system has XMESA
         OPENGL_GLU_FOUND    - system has GLU
         OPENGL_INCLUDE_DIR  - the GL include directory
         OPENGL_LIBRARIES    - Link these to use OpenGL and GLU


       If you want to use just GL you can use these values

         OPENGL_gl_LIBRARY   - Path to OpenGL Library
         OPENGL_glu_LIBRARY  - Path to GLU Library


       On OSX default to using the framework version of opengl

人们会 必须更改OPENGL_glu_LIBRARY的缓存值,并 OPENGL_gl_LIBRARY在OSX上将OpenGL与X11一起使用

People will have to change the cache values of OPENGL_glu_LIBRARY and OPENGL_gl_LIBRARY to use OpenGL with X11 on OSX

       Defined in: /usr/share/cmake/Modules/FindOpenGL.cmake

这篇关于cmake不使用QtOpenGL链接libGLU的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆