使用 cmake 构建的 QGLViewer simpleViewer 示例不是 运行

QGLViewer simpleViewer example built with cmake not running

我正在尝试熟悉 QGLViewer (http://libqglviewer.com/),所以我安装了它(在 Ubuntu 14.04 上)并且我正在尝试 运行 simpleViewer(这是一个提供的例子)。现在,可以使用 qmake 构建代码,但我想用 cmake 编译代码,所以我写了以下 CMakeLists.txt:

cmake_minimum_required(VERSION 2.6)
PROJECT(simple_viewer)

SET(CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/cmake_modules)

FIND_PACKAGE(OpenGL REQUIRED)
INCLUDE_DIRECTORIES(${OPENGL_INCLUDE})

FIND_PACKAGE(QGLViewer REQUIRED)
INCLUDE_DIRECTORIES(${QGLVIEWER_INCLUDE_DIR})

FIND_PACKAGE(Qt4 REQUIRED)
INCLUDE(${QT_USE_FILE})
INCLUDE_DIRECTORIES(${QT_INCLUDES})

ADD_EXECUTABLE(${PROJECT_NAME} main.cpp simpleViewer.cpp)
TARGET_LINK_LIBRARIES(${PROJECT_NAME} ${QT_LIBRARIES} ${OPENGL_LIBRARIES} ${QGLVIEWER_LIBRARY})

我能够构建项目,但是当我启动可执行文件时,出现以下错误:

 dede@dede-P35V2:~/src/simple_viewer/build$ ./simple_viewer 
 *** Error in `./simple_viewer': realloc(): invalid pointer: 0x00007f64d34df840 *** Aborted

如果有人能向我解释这是怎么回事,我会很高兴!

谢谢!

这样工作的:

cmake_minimum_required(VERSION 2.6)
PROJECT(simple_viewer)

SET(CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/cmake_modules)

FIND_PACKAGE(OpenGL REQUIRED)
INCLUDE_DIRECTORIES(${OPENGL_INCLUDE})

FIND_PACKAGE(QGLViewer REQUIRED)
INCLUDE_DIRECTORIES(${QGLVIEWER_INCLUDE_DIR})

FIND_PACKAGE(Qt4 REQUIRED)
INCLUDE(${QT_USE_FILE})
INCLUDE_DIRECTORIES(${QT_INCLUDES})

ADD_EXECUTABLE(${PROJECT_NAME} main.cpp simpleViewer.cpp)

TARGET_LINK_LIBRARIES(${PROJECT_NAME}
  ${QGLVIEWER_LIBRARY} 
  ${QT_QTXML_LIBRARY} 
  ${QT_QTOPENGL_LIBRARY} 
  ${QT_QTGUI_LIBRARY} 
  ${QT_QTCORE_LIBRARY} 
  ${OPENGL_gl_LIBRARY} 
  ${OPENGL_glu_LIBRARY}
)