On 10.03.2018 23:01, Alan W. Irwin wrote:
Anyhow, your thoughts would be appreciated for reasonable best
practice limits on how far (if any) beyond the common code case you
would go to convert an old project to use
ALIAS libraries and modules in the build tree that have to be
implemented in any case for CMake code that is common to
both the build tree and install tree.
I agree with your assessments.
Assuming a project that is highly structured through directory scopes I
might consider the following.
Any target is defined in exactly one directory scope.
Any command that extends the definition of a target has to use the
original target name and should be in the same directory scope.
In all other directory scopes I'd consider consistent use of a target's
While it is less likely for a seasoned developer to trip over the
interpretation ambiguity in link libraries (due to familiarity and the
fact that they probably already tripped over this and know the symptoms)
it might still be beneficial for new / casual contributors which as
likely consumers might also already be familiar with the aliases.
One minor additional benefit might be that you are also not allowed to
modify the original target through an alias.
As such this would prevent you (assuming you stick to the namespaced
names) from modifying targets from within foreign scopes which I think
is a good thing to enforce.
Beyond that consumers might be looking at your code base for examples on
how to use the libraries in their own code where consistency might be
It might also help (slightly) if you ever decided to split off parts of
your project into new projects (which then would become consumers of the
Powered by www.kitware.com
Please keep messages on-topic and check the CMake FAQ at:
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
Follow this link to subscribe/unsubscribe: