[CMake] how to deprecate a target?

Bram de Greve bram at cocamware.com
Thu Jun 28 14:01:45 EDT 2018


Hi all,

Consider this situation.  I'm building a Foo packaged, to be used by a 
Bar project.

Foo used to export its target as simply foo.
Now it exports its target as Foo::foo.

Bar contains this:
add_library(bar ...)
target_link_libraries(bar foo)

This of course must now be:
add_library(bar ...)
target_link_libraries(bar Foo::foo)

But if bar still links to the foo instead of Foo::foo, then CMake 
doesn't really complain.  foo doesn't exist, but configures and 
generates just fine.  Of course, you'll face strange build errors, from 
which it isn't immediately apparent what's causing this ...

How can I make sure CMake will complain loudly when bar still links to foo?

Thanks,
Bram.



More information about the CMake mailing list