0

I would like to install QGLViewer as an external from source code in a cmake build environment. This is what I have tried so far:

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 works just fine.

However, when running make, I get a bunch of compilation errors. make is finding the headers installed in my system instead of the ones of the build project directory:

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

NaN

4

1 回答 1

0

解决方案是指定在文件 QGLViewer/QGLViewer.pro 上执行 qmake,而不是位于根文件夹 libQGLViewer-2.5.2/ 中的默认 .pro 文件

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
                   )
于 2014-05-05T14:01:19.977 回答