[CMake] Redundant linking when modifying shared libraries

Itay Chamiel itay.chamiel at orcam.com
Thu Feb 14 12:11:13 EST 2019


On Thu, Feb 14, 2019 at 12:39 PM Craig Scott <craig.scott at crascit.com> wrote:
> I think you might be looking for the LINK_DEPENDS_NO_SHARED target property (or more likely its associated CMAKE_LINK_DEPENDS_NO_SHARED variable).

After my previous response I experimented a little more, and I got it
to work. My mistake was that I needed to add the configuration line to
the executable target, not the lib. So in my example, add the
following line to the Demo/CMakeLists.txt file:

set_target_properties(helloDemo PROPERTIES LINK_DEPENDS_NO_SHARED true)

..and it works like a charm. I wonder why this isn't the default
behavior; can you think of any scenario where this would produce
invalid results?

Thanks for your help!

itay


More information about the CMake mailing list