了解“链接到目录的请求".cmake警告 [英] Understanding "requests linking to directory" cmake warning

查看:269
本文介绍了了解“链接到目录的请求".cmake警告的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在Ubuntu 16.04机器上编译大量代码(超过100,000行).在执行此过程的过程中,在cmake(v3.5.1)生成过程中(运行make之前),我生成了许多警告消息.

I am compiling an enormous code (100,000+ lines) on an Ubuntu 16.04 machine. In the process of doing so, during the cmake (v3.5.1) build process (before running make), I generate a raft of WARNINGS.

例如

WARNING: Target "gadgetron_moco" requests linking to directory "/usr/lib".  Targets may link only to libraries.  CMake is dropping the item.

很显然,我无法在此处重新发布代码,但是在源代码中,我找到了 moco/CMakeLists.txt .这是该文件中的代码片段:

Obviously, I can't repost the code here, but within the source code I found a moco/CMakeLists.txt. Here is a code fragment from that file:

if(CUDA_FOUND)
    add_library(gadgetron_moco SHARED
        cpuRegistrationAveragingGadget.h
        gadgetron_moco_export.h
        gpuRegistrationAveragingGadget.h
        gpuRegistrationScatteringGadget.h
        RegistrationAveragingGadget.h
        RegistrationScatteringGadget.h
        ${CPU_GADGETS}
        ${GPU_GADGETS}
      )

    set_target_properties(gadgetron_moco PROPERTIES VERSION ${GADGETRON_VERSION_STRING} SOVERSION ${GADGETRON_SOVERSION})

    target_link_libraries(gadgetron_moco
      gadgetron_gadgetbase
      gadgetron_toolbox_cpucore gadgetron_mricore ${CPU_LIBS} ${GPU_LIBS}
      ${Boost_LIBRARIES} ${ISMRMRD_LIBRARIES}
      optimized ${ACE_LIBRARIES} debug ${ACE_DEBUG_LIBRARY}
      )

    install (TARGETS gadgetron_moco DESTINATION lib COMPONENT main)
endif()

我用来调用cmake的命令:

The command that I used to call cmake:

cmake -DCMAKE_INSTALL_PREFIX=/opt/gadgetron/ \
    -DCMAKE_CXX_COMPILER=/usr/bin/g++-5 \
    -DCMAKE_C_COMPILER=/usr/bin/gcc-5 \
    -DBoost_INCLUDE_DIR=/usr/include/ \
    -DCUDA_TOOLKIT_ROOT_DIR=/usr/local/cuda-8.0/ \
    -DARMADILLO_LIBRARY=/usr/lib/ \
    -DARMADILLO_INCLUDE_DIR=/usr/include/ \
    -DMKLROOT_PATH=/opt/intel/ \
    -DZFP_INCLUDE_DIR=/opt/ZFP/inc \
    -DZFP_LIBRARY=/opt/ZFP/lib \
    -DCMAKE_PREFIX_PATH=/opt/ismrmrd/:/opt/siemens_to_ismrmrd:/usr/lib/ \
    -DCMAKE_VERBOSE_MAKEFILE:BOOL=ON ..

问题:警告到底在告诉我什么?我该如何调试它?

Question: What is the warning exactly telling me? How do I go about debugging it?

推荐答案

图书馆"是--file-!

警告与库"一词的含义有关:它是一个文件(/path/to/xxx.so /path/到/xxx.a 左右),而不是目录.

A "library" is a --file--!

The warning is about meaning of the word "library": it is a file (/path/to/xxx.so, /path/to/xxx.a or so), not a directory.

假设项目正确,则警告信号提示用户指定的设置不正确.

Assuming the project is correct, the warning signals about incorrect user-specified settings.

您设置了一个变量 ARMADILLO_LIBRARY ,该变量旨在包含一个,但是却分配了/usr/lib 目录到该变量.

You set a variable ARMADILLO_LIBRARY, which is intended to contain a library, but you assign /usr/lib directory to that variable.

这篇关于了解“链接到目录的请求".cmake警告的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆