使用 Cmake's ExternalProject_Add安装 QGLViewer



我想在cmake构建环境中安装QGLViewer作为外部源代码。这是我到目前为止所尝试的:

set(QGLViewer_VERSION 2.5.2)
set(QGLViewer_URL_REMOTE "http://www.libqglviewer.com/src/libQGLViewer-${QGLViewer_VERSION}.tar.gz")
ExternalProject_Add(QGLViewer
                    PREFIX ${CMAKE_CURRENT_BINARY_DIR}/external/qglviewer
                    URL ${QGLViewer_URL_REMOTE}
                    BUILD_IN_SOURCE 1
                    CONFIGURE_COMMAND qmake PREFIX="${CMAKE_CURRENT_BINARY_DIR}/external/qglviewer" QGLVIEWER_STATIC=yes
                    BUILD_COMMAND make
                   )

cmake工作得很好。

然而,当运行make时,我得到了一堆编译错误。Make正在查找安装在我的系统中的头文件,而不是构建项目目录中的头文件:

make[4]: warning: jobserver unavailable: using -j1.  Add `+' to parent make rule.
Project MESSAGE: Warning: unknown QT: widgets
In file included from /usr/include/QGLViewer/manipulatedFrame.h:26:0,
                 from /usr/include/QGLViewer/manipulatedCameraFrame.h:26,
                 from /usr/include/QGLViewer/camera.h:26,
                 from /usr/include/QGLViewer/qglviewer.h:26,
                 from animation.h:23,
                 from animation.cpp:23:
/usr/include/QGLViewer/frame.h:139:3: error: ‘signals’ does not name a type
/usr/include/QGLViewer/frame.h:404:10: error: expected ‘:’ before ‘slots’
/usr/include/QGLViewer/frame.h:404:10: error: ‘slots’ does not name a type

解决方案是指定对文件QGLViewer/QGLViewer执行qmake。libQGLViewer-2.5.2/

ExternalProject_Add(QGLViewer
                    PREFIX ${CMAKE_CURRENT_BINARY_DIR}/external/qglviewer
                    URL ${QGLViewer_URL_REMOTE}
                    DOWNLOAD_DIR ${QGLViewer_DSTDIR}
                    BUILD_IN_SOURCE 1
                    CONFIGURE_COMMAND qmake QGLViewer/QGLViewer.pro QGLVIEWER_STATIC=yes PREFIX=${CMAKE_CURRENT_BINARY_DIR}/external/qglviewer
                    BUILD_COMMAND make
                   )

相关内容

  • 没有找到相关文章

最新更新