1

在我的 CMakeLists.txt 中,我有第 33 行:

link_directories (${QT_LIBRARIES})

其中${QT_LIBRARIES}扩展为:

optimized;C:/QtSDK/Desktop/Qt/4.8.1/msvc2010/lib/QtOpenGL4.lib;debug;C:/QtSDK/Desktop/Qt/4.8.1/msvc2010/lib/QtOpenGLd4.lib

更新到 CMake 2.8.10.1 后,我收到以下警告:

CMake Warning (dev) at CMakeLists.txt:33 (link_directories):
  This command specifies the relative path

    optimized

  as a link directory.

  Policy CMP0015 is not set: link_directories() treats paths relative to the
  source dir.  Run "cmake --help-policy CMP0015" for policy details.  Use the
  cmake_policy command to set the policy and suppress this warning.
This warning is for project developers.  Use -Wno-dev to suppress it.

但是,如您所见,${QT_LIBRARIES} 包含相对路径。在我看来,CMP0015 政策与此无关。

是我的错误还是CMake中的错误?

4

1 回答 1

4

${QT_LIBRARIES}库列表,而不是库路径。它被设计用于target_link_libraries(). 将第 33 行替换为:

targe_link_libraries(yourTargetName ${QT_LIBRARIES})

请注意,无论如何link_directories()都不鼓励使用 of 以支持完整路径。target_link_libraries()

于 2012-11-23T11:29:30.130 回答