[CMake] Disable dependency on a specific shared library

Kiril Vidimče kiril at inkbit.xyz
Fri Apr 20 22:21:54 EDT 2018


I have a shared library that always rebuilds to pick up some build-specific
information (including a build time stamp).

I would like to make all targets that depend on this library not to relink
against it every time that library rebuilds.

I am aware of the existence of LINK_DEPENDS_NO_SHARED
<https://cmake.org/cmake/help/latest/prop_tgt/LINK_DEPENDS_NO_SHARED.html>
but it appears that using this property will disable the dependency on ALL
shared library for that target. I only want to disable the dependency on
the "special" library that gets rebuilt every single time. Furthermore, as
far as I can tell, even though LINK_DEPENDS_NO_SHARED prevents relinking of
the immediate target that depends on the always-rebuilding-library, targets
one level above in the dependency chain are still relinking all of the time.

To be clear, here is the dependency chain:

AlwaysRebuildingLibrary (ARL) -> PublicLibraryThatPublishesInfoFromARL ->
Libraries/Binaries

Is there a way to do this without resorting to crazy hacks?

Thanks!
Kiril
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://cmake.org/pipermail/cmake/attachments/20180420/317a38ea/attachment.html>


More information about the CMake mailing list