本文介绍了CMake错误:TARGETS没有为共享库目标指定LIBRARY DESTINATION的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
当使用CMake构建一个开源项目时(在我的例子中是柠檬图库),当我试图通过 -DBUILD_SHARED_LIBS = 1 :
When building an opensource project with CMake (in my case, it was the lemon graph library), I got this error when I tried to build shared libaries via
-DBUILD_SHARED_LIBS=1
:
TARGETS given no LIBRARY DESTINATION for shared library target
这个错误来自哪里,如何解决?
Where does this error come from and how do I fix it?
推荐答案
我收到此错误,因为项目有一个需要修复的CMakeLists.txt文件。对cmake INSTALL命令的调用具有ARCHIVE参数,但没有LIBRARY参数。在我的例子中,我想要的库放在'lib',所以改变这个:
I got this error because the project had a CMakeLists.txt file that needed fixing. A call to the cmake INSTALL command had an ARCHIVE parameter, but no LIBRARY parameter. In my case, I wanted the libraries placed in 'lib', so changing this:
INSTALL(
TARGETS lemon
ARCHIVE DESTINATION lib
COMPONENT library
)
INSTALL(
TARGETS lemon
ARCHIVE DESTINATION lib
LIBRARY DESTINATION lib
COMPONENT library
)
修复了我的问题。
这篇关于CMake错误:TARGETS没有为共享库目标指定LIBRARY DESTINATION的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!