在我的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中有错误?
答案 0 :(得分:3)
${QT_LIBRARIES}
是库的列表,不是库路径。它旨在用于target_link_libraries()
。将您的第33行替换为:
targe_link_libraries(yourTargetName ${QT_LIBRARIES})
请注意,不建议使用link_directories()
以支持target_link_libraries()
中的完整路径。