Linking static libraries with c++/cmake

前端 未结 1 1504
佛祖请我去吃肉
佛祖请我去吃肉 2021-01-26 04:48

I try to link libraries in my program using firebreath framework.

So I add this code in projectDef.cmake.

include_directories(/usr/include/giblib)
includ         


        
1条回答
  •  鱼传尺愫
    2021-01-26 05:19

    I think you are misunderstanding the creation of a static library. A static library is a collection of object files, it does not have any init/deinit code to pull in additional libraries like a shared library or an executable can.

    If you create a libraryA that uses code from libraryB and libraryC when you build applicationX that uses libraryA you must manually pull in both libraryB and libraryC. With shared libraries this is not necessary.

    If you investigate pkg-config you can see the property Libs.private that specifies these additional private or internal libraries that a static link would require.

    0 讨论(0)
提交回复
热议问题