[CMake] Recommandations for public custom macro/functions installation

Craig Scott craig.scott at crascit.com
Tue Apr 17 08:07:59 EDT 2018


On Tue, Apr 17, 2018 at 9:48 PM, David Demelier <markand at malikania.fr>
wrote:

> On Tue, 2018-04-17 at 12:25 +0200, Johannes Zarl-Zierl wrote:
> > Just replying to this topic of your message: you may want to
> > reconsider. The
> > cmake gui allows you to group options automatically by prefix. This
> > de-clutters
> > the options considerably.
>
> I didn't know that! Nice catch. I'll reconsider using prefix then. I've
> usually named my options WITH_FOO, do you recommend to use
> PROJECT_WITH_FOO or WITH_PROJECT_FOO then?
>


Definitely go with PROJECT_WITH_FOO. Only the letters up to the first
underscore are used for the grouping in cmake-gui. For larger hierarchical
projects, this grouping feature is pretty important if you want any chance
of keeping the variables manageable in the GUI. The project-specific prefix
is also good protection against name clashes with other parts of the build
(always consider the possibility that your project may one day be used as
part of some larger parent project, pulled in by add_subdirectory()).

-- 
Craig Scott
Melbourne, Australia
https://crascit.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://cmake.org/pipermail/cmake/attachments/20180417/405d6cb0/attachment.html>


More information about the CMake mailing list