cmake: linking against STATIC IMPORTED library fails

前端 未结 1 599
生来不讨喜
生来不讨喜 2020-12-07 03:40

I have a vendor provided static library.

I have added it as a STATIC IMPORTED library target, and set properties on the target:

add_libr         


        
相关标签:
1条回答
  • 2020-12-07 03:58

    I suspect that you ran into a visibility problem with the IMPORTED library target. According to the documentation:

    An IMPORTED library target references a library file located outside the
    project. ... The target name has scope in the directory in which it is
    created and below, but the GLOBAL option extends visibility.
    

    That's why the correct library path is used for the inner trading_demo target, but not for the outer order_example target. To fix the problem, adding the GLOBAL option should be sufficient:

    add_library(lime_api STATIC IMPORTED GLOBAL)
    
    0 讨论(0)
提交回复
热议问题