2012-11-23 61 views
1

以我的CMakeLists.txt,我有線33:CMake的2.8.10.1治療調試/優化爲相對目錄

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中有錯誤?

回答

3

${QT_LIBRARIES}庫的列表,而不是10庫路徑。它被設計用於target_link_libraries()。替換爲您的生產線33:

targe_link_libraries(yourTargetName ${QT_LIBRARIES}) 

注意,使用的link_directories()不鼓勵支持完整路徑在target_link_libraries()反正。