[CMake] how to deprecate a target?

Robert Maynard robert.maynard at kitware.com
Fri Jun 29 14:22:04 EDT 2018


I am not aware of a nice way to setup CMake to error out if a user
links to `foo` instead of `Foo::foo`.
On Fri, Jun 29, 2018 at 2:05 AM Bram de Greve <bram at cocamware.com> wrote:
>
> 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.
>
> --
>
> Powered by www.kitware.com
>
> Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ
>
> Kitware offers various services to support the CMake community. For more information on each offering, please visit:
>
> CMake Support: http://cmake.org/cmake/help/support.html
> CMake Consulting: http://cmake.org/cmake/help/consulting.html
> CMake Training Courses: http://cmake.org/cmake/help/training.html
>
> Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html
>
> Follow this link to subscribe/unsubscribe:
> https://cmake.org/mailman/listinfo/cmake


More information about the CMake mailing list