CMake无法解析运行时目录路径

运行cmake CMakeLists.txt后

我收到以下警告

CMake Warning at src/CMakeLists.txt:32 (add_executable):
  Cannot generate a safe runtime search path for target MMPEditor because
  files in some directories may conflict with libraries in implicit
  directories:

runtime library [libQt5Widgets.so.5] in /usr/lib/x86_64-linux-gnu may be hidden by files in:
  /home/ch/Qt/5.2.1/gcc_64/lib
runtime library [libQt5Core.so.5] in /usr/lib/x86_64-linux-gnu may be hidden by files in:
  /home/ch/Qt/5.2.1/gcc_64/lib
runtime library [libQt5Gui.so.5] in /usr/lib/x86_64-linux-gnu may be hidden by files in:
  /home/ch/Qt/5.2.1/gcc_64/lib
runtime library [libQt5OpenGL.so.5] in /usr/lib/x86_64-linux-gnu may be hidden by files in:
  /home/ch/Qt/5.2.1/gcc_64/lib

其中一些库可能无法正确找到.

一个文件被另一个文件隐藏是什么意思?如何让CMake确定哪个文件是要链接到的文件夹?

您的系统库与本地自定义生成Qt库冲突.这是一个警告,但由于这个原因,您可能无法在应用程序中获得预期的结果.你需要告诉CMake它应该在你的CMakeModule中搜索库时排除系统路径.从 this documentation

If NO_DEFAULT_PATH is specified, then no additional paths are added to
the search.

同样在同一文档中,还提到了另一个标志NO_CMAKE_SYSTEM_PATH,它只包含特定于平台的默认路径.

相关文章
相关标签/搜索