理解“链接到目录的请求"警告 [英] Understanding "requests linking to directory" cmake warning
问题描述
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.
E.g.
WARNING: Target "gadgetron_moco" requests linking to directory "/usr/lib". Targets may link only to libraries. CMake is dropping the item.
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()
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?
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.
You set a variable ARMADILLO_LIBRARY
, which is intended to contain a library, but you assign /usr/lib
directory to that variable.
这篇关于理解“链接到目录的请求"警告的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!