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)
>
I did not find an actual solution for the problem as stated, but am posting my own workaround for future reference.
I realized that the foo dependency was being emitted in the export; it just didn't have a path with it. And since I still haven't figured out how to get cmake to export the path along with it, I reverted my export command to that shown in the question above (without foo).
Then I went back to the original place where foo was being imported and removed the add_library and set_property, replacing them with this:
set(foo /path/to/foo.a)
Then changed the target_link_libraries to:
target_link_libraries(thislib ${foo})
In other words, rather than making it a real "imported library", it's just a raw library path. This does get correctly written into the export file and allows projectB to link.