2

使用 FindQt.cmake 查找 QT 库:

FIND_PACKAGE(Qt4 COMPONENTS QtCore QtGui QtOpenGL )

但是,我总是收到此警告:

The ASM compiler identification is GNU

CMake Warning at ../cmake-2.8/Modules/FindQt4.cmake:601 (MESSAGE):
  /Qt4.8.0/bin/qmake reported
  QT_INSTALL_LIBS as "/Qt4.8.0/lib"
  but QtCore could not be found there.  Qt is NOT installed correctly for the
  target build environment.

我确定有 QtCore 库:/Qt4.8.0/lib

ls -all libQtCore*

-rw-r--r-- 1 root root     950 Nov 30 13:08 libQtCore.la
-rw-r--r-- 1 root root     942 Nov 30 13:07 libQtCore.prl
lrwxrwxrwx 1 root root      18 Nov 30 13:07 libQtCore.so -> libQtCore.so.4.8.0
lrwxrwxrwx 1 root root      18 Nov 30 13:08 libQtCore.so.4 -> libQtCore.so.4.8.0
lrwxrwxrwx 1 root root      18 Nov 30 13:08 libQtCore.so.4.8 -> libQtCore.so.4.8.0
-rwxr-xr-x 1 root root 2697932 Nov 30 13:08 libQtCore.so.4.8.0

如何检查为什么在该目录中找不到 QtCore 的警告?

4

1 回答 1

1

FindQt4.cmake查看分发中的模块代码,CMake我找到了解决此问题的方法。我已经设置QT_QTCORE_LIBRARY_RELEASE了除了QT_QMAKE_EXECUTABLE变量。cmake我通过以下方式将它们放入我的工具链中:

# Qt4 related stuff required here due to FindQt4.cmake issues
set(QT_QMAKE_EXECUTABLE $ENV{QT_DIR}/bin/qmake)
set(QT_QTCORE_LIBRARY_RELEASE $ENV{QT_DIR}/lib/libQtCore.so)

我使用QT_DIR环境变量来简化不同 Qt4 构建之间的切换。

于 2013-03-14T18:07:35.050 回答