Exporting an imported library

后端 未结 3 869
野的像风
野的像风 2021-02-07 21:31

I have projectA, into which I\'m importing a library with:

add_library(foo STATIC IMPORTED)
set_property(TARGET foo PROPERTY IMPORTED_LOCATION /path/to/foo.a)
         


        
3条回答
  •  别跟我提以往
    2021-02-07 22:05

    You need to

    1. Export foo from where it is built (to, say, foolibs.cmake)
    2. Instead of using /path/to/thislib.cmake directly (the export file generated by export(TARGETS thislib... create another one, thislib-and-deps.cmake which includes both:

      include(<...>/foolibs.cmake)
      include(${CMAKE_CURRENT_LIST_DIR}/thislib.cmake)
      

提交回复
热议问题