<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
</head>
<body text="#000000" bgcolor="#FFFFFF">
Hi Petr, Marc,<br>
<br>
I guess I could generate a linker warning, it's indeed not-so-nice,
but might do the trick ...<br>
<br>
It seems aliases are only possible on global imported targets. Mine
aren't (which is by default I guess). It's probably not a great idea
to make them global ...<br>
<br>
Thanks for the suggestions!<br>
Bram<br>
<br>
<div class="moz-cite-prefix">On 7/2/2018 10:20, Marc CHEVRIER wrote:<br>
</div>
<blockquote type="cite"
cite="mid:CAHKTGrcDYuVcfbjUMNvGKS6HLgF3F3JRR0yvvS_XN+PQZnqW4w@mail.gmail.com">
<div dir="ltr">FYI: Starting with CMake 3.11, it is now possible
to define an alias of an imported target.</div>
<br>
<div class="gmail_quote">
<div dir="ltr">Le lun. 2 juil. 2018 à 09:27, Petr Kmoch <<a
href="mailto:petr.kmoch@gmail.com" moz-do-not-send="true">petr.kmoch@gmail.com</a>>
a écrit :<br>
</div>
<blockquote class="gmail_quote" style="margin:0 0 0
.8ex;border-left:1px #ccc solid;padding-left:1ex">
<div dir="ltr">
<div>Hi Bram.</div>
<div><br>
</div>
<div>Wild idea: could you also define a non-namespaced
target `foo` and craft it such that linking against it
generates a linker warning? Something like "Warning:
symbol `Using_just_foo_is_deprecated_use_Foo_foo_instead`
defined twice, ignoring weak definition."</div>
</div>
<div dir="ltr"><br>
<div>Petr<br>
</div>
</div>
<div class="gmail_extra"><br>
<div class="gmail_quote">On 2 July 2018 at 00:11, Bram de
Greve <span dir="ltr"><<a
href="mailto:bram@cocamware.com" target="_blank"
moz-do-not-send="true">bram@cocamware.com</a>></span>
wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0
.8ex;border-left:1px #ccc solid;padding-left:1ex">That
is unfortunate ... do you know any not-so-nice ways?<br>
<br>
So, what would you recommend here?<br>
<br>
I'm deprecating the old ways to use the Foo package
(using Foo_LIBRARIES and Foo_INCLUDE_DIRS. You know, the
cmake 2.x way of things). I can do that nicely with
variable watches.<br>
<br>
But what about the target names? If I want to guarantee
a seamless transition period, I should opt to keep using
the "foo" target names. But then there's no way to
"upgrade" to "Foo::foo" targets without breakage, since
there's no deprecation strategy. And I can't use target
aliases, since that is not allowed on imported targets.<br>
<br>
To answer my own question, I think the best thing is to
move to the "Foo::foo" targets right now. There's at
least one downstream package that will be hurt by this,
but the damage is less than waiting for everyone to have
moved to the "foo" target first.<br>
<br>
Best,<br>
<br>
Bram.
<div class="m_-3835466313619459630HOEnZb">
<div class="m_-3835466313619459630h5"><br>
<br>
<br>
On 6/29/2018 20:22, Robert Maynard wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0
.8ex;border-left:1px #ccc solid;padding-left:1ex">
I am not aware of a nice way to setup CMake to
error out if a user<br>
links to `foo` instead of `Foo::foo`.<br>
On Fri, Jun 29, 2018 at 2:05 AM Bram de Greve <<a
href="mailto:bram@cocamware.com" target="_blank"
moz-do-not-send="true">bram@cocamware.com</a>>
wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0
0 .8ex;border-left:1px #ccc
solid;padding-left:1ex">
Hi all,<br>
<br>
Consider this situation. I'm building a Foo
packaged, to be used by a<br>
Bar project.<br>
<br>
Foo used to export its target as simply foo.<br>
Now it exports its target as Foo::foo.<br>
<br>
Bar contains this:<br>
add_library(bar ...)<br>
target_link_libraries(bar foo)<br>
<br>
This of course must now be:<br>
add_library(bar ...)<br>
target_link_libraries(bar Foo::foo)<br>
<br>
But if bar still links to the foo instead of
Foo::foo, then CMake<br>
doesn't really complain. foo doesn't exist, but
configures and<br>
generates just fine. Of course, you'll face
strange build errors, from<br>
which it isn't immediately apparent what's
causing this ...<br>
<br>
How can I make sure CMake will complain loudly
when bar still links to foo?<br>
<br>
Thanks,<br>
Bram.<br>
<br>
--<br>
<br>
Powered by <a href="http://www.kitware.com"
rel="noreferrer" target="_blank"
moz-do-not-send="true">www.kitware.com</a><br>
<br>
Please keep messages on-topic and check the
CMake FAQ at: <a
href="http://www.cmake.org/Wiki/CMake_FAQ"
rel="noreferrer" target="_blank"
moz-do-not-send="true">http://www.cmake.org/Wiki/CMake_FAQ</a><br>
<br>
Kitware offers various services to support the
CMake community. For more information on each
offering, please visit:<br>
<br>
CMake Support: <a
href="http://cmake.org/cmake/help/support.html"
rel="noreferrer" target="_blank"
moz-do-not-send="true">http://cmake.org/cmake/help/support.html</a><br>
CMake Consulting: <a
href="http://cmake.org/cmake/help/consulting.html"
rel="noreferrer" target="_blank"
moz-do-not-send="true">http://cmake.org/cmake/help/consulting.html</a><br>
CMake Training Courses: <a
href="http://cmake.org/cmake/help/training.html"
rel="noreferrer" target="_blank"
moz-do-not-send="true">http://cmake.org/cmake/help/training.html</a><br>
<br>
Visit other Kitware open-source projects at <a
href="http://www.kitware.com/opensource/opensource.html"
rel="noreferrer" target="_blank"
moz-do-not-send="true">http://www.kitware.com/opensource/opensource.html</a><br>
<br>
Follow this link to subscribe/unsubscribe:<br>
<a
href="https://cmake.org/mailman/listinfo/cmake"
rel="noreferrer" target="_blank"
moz-do-not-send="true">https://cmake.org/mailman/listinfo/cmake</a><br>
</blockquote>
</blockquote>
<br>
-- <br>
<br>
Powered by <a href="http://www.kitware.com"
rel="noreferrer" target="_blank"
moz-do-not-send="true">www.kitware.com</a><br>
<br>
Please keep messages on-topic and check the CMake
FAQ at: <a
href="http://www.cmake.org/Wiki/CMake_FAQ"
rel="noreferrer" target="_blank"
moz-do-not-send="true">http://www.cmake.org/Wiki/CMake_FAQ</a><br>
<br>
Kitware offers various services to support the CMake
community. For more information on each offering,
please visit:<br>
<br>
CMake Support: <a
href="http://cmake.org/cmake/help/support.html"
rel="noreferrer" target="_blank"
moz-do-not-send="true">http://cmake.org/cmake/help/support.html</a><br>
CMake Consulting: <a
href="http://cmake.org/cmake/help/consulting.html"
rel="noreferrer" target="_blank"
moz-do-not-send="true">http://cmake.org/cmake/help/consulting.html</a><br>
CMake Training Courses: <a
href="http://cmake.org/cmake/help/training.html"
rel="noreferrer" target="_blank"
moz-do-not-send="true">http://cmake.org/cmake/help/training.html</a><br>
<br>
Visit other Kitware open-source projects at <a
href="http://www.kitware.com/opensource/opensource.html"
rel="noreferrer" target="_blank"
moz-do-not-send="true">http://www.kitware.com/opensource/opensource.html</a><br>
<br>
Follow this link to subscribe/unsubscribe:<br>
<a href="https://cmake.org/mailman/listinfo/cmake"
rel="noreferrer" target="_blank"
moz-do-not-send="true">https://cmake.org/mailman/listinfo/cmake</a><br>
</div>
</div>
</blockquote>
</div>
<br>
</div>
-- <br>
<br>
Powered by <a href="http://www.kitware.com" rel="noreferrer"
target="_blank" moz-do-not-send="true">www.kitware.com</a><br>
<br>
Please keep messages on-topic and check the CMake FAQ at: <a
href="http://www.cmake.org/Wiki/CMake_FAQ" rel="noreferrer"
target="_blank" moz-do-not-send="true">http://www.cmake.org/Wiki/CMake_FAQ</a><br>
<br>
Kitware offers various services to support the CMake
community. For more information on each offering, please
visit:<br>
<br>
CMake Support: <a
href="http://cmake.org/cmake/help/support.html"
rel="noreferrer" target="_blank" moz-do-not-send="true">http://cmake.org/cmake/help/support.html</a><br>
CMake Consulting: <a
href="http://cmake.org/cmake/help/consulting.html"
rel="noreferrer" target="_blank" moz-do-not-send="true">http://cmake.org/cmake/help/consulting.html</a><br>
CMake Training Courses: <a
href="http://cmake.org/cmake/help/training.html"
rel="noreferrer" target="_blank" moz-do-not-send="true">http://cmake.org/cmake/help/training.html</a><br>
<br>
Visit other Kitware open-source projects at <a
href="http://www.kitware.com/opensource/opensource.html"
rel="noreferrer" target="_blank" moz-do-not-send="true">http://www.kitware.com/opensource/opensource.html</a><br>
<br>
Follow this link to subscribe/unsubscribe:<br>
<a href="https://cmake.org/mailman/listinfo/cmake"
rel="noreferrer" target="_blank" moz-do-not-send="true">https://cmake.org/mailman/listinfo/cmake</a><br>
</blockquote>
</div>
</blockquote>
<br>
</body>
</html>