I have two separate projects, each builds a shared lib that links with a common static lib. In each of the shared libs' CMakeLists.txt I'll have:
add_dependencies(my_shared1 my_common_lib)
and
add_dependencies(my_shared2 my_common_lib)
The static lib has its own sources and resides in its own folder. What is the best way to define the common static cmake script?
add_dependenciesbe replaced withtarget_link_libraries? (That would mean, that youmy_shared1library not only depends onmy_common_libone, but is linked with it). - Tsyvarevtarget_link_libraries, then the answer is here: stackoverflow.com/questions/50292879/… (in short: uselink_libraries). - Tsyvarevtarget_link_librariesimplies target-level dependencies. That is, building ofmy_shared1library starts only aftermy_common_liblibrary will be built. - Tsyvarev