本文介绍了如何阻止CMake与libstdc ++链接的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
对于C ++项目,我有一个非常简单的CMakeLists.txt,该项目构建了一个共享库:
I have a very simple CMakeLists.txt for a C++ project, which builds a shared library:
add_library(foo SHARED
${HDR_PUBLIC}
${SOURCES})
链接库时,CMake自动使用-lstdc ++.如何阻止它执行此操作?
When linking the library, CMake automatically uses -lstdc++. How can I stop it from doing this?
推荐答案
set(CMAKE_CXX_IMPLICIT_LINK_LIBRARIES "")
set(CMAKE_CXX_IMPLICIT_LINK_DIRECTORIES "")
set_target_properties(yourtarget PROPERTIES LINKER_LANGUAGE C)
来源: http://cmake.3232098.n2.nabble.com/setting-LINKER-LANGUAGE-still-adds-lstdc-td7581940.html
这篇关于如何阻止CMake与libstdc ++链接的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!