How to stop CMake from linking against libstdc++

前端 未结 2 1939
余生分开走
余生分开走 2021-02-05 19:37

I have a very simple CMakeLists.txt for a C++ project, which builds a shared library:

add_library(foo SHARED
    ${HDR_PUBLIC}
    ${SOURCES})

2条回答
  •  礼貌的吻别
    2021-02-05 20:06

    set(CMAKE_CXX_IMPLICIT_LINK_LIBRARIES "")
    set(CMAKE_CXX_IMPLICIT_LINK_DIRECTORIES "")
    set_target_properties(yourtarget PROPERTIES LINKER_LANGUAGE C)
    

    Source: http://cmake.3232098.n2.nabble.com/setting-LINKER-LANGUAGE-still-adds-lstdc-td7581940.html

提交回复
热议问题