[CMake] Setting properties on all targets in one line

Eric Noulard eric.noulard at gmail.com
Fri Jun 1 14:14:15 EDT 2007


2007/6/1, Brandon Van Every <bvanevery at gmail.com>:
> On 5/31/07, Eric Noulard <eric.noulard at gmail.com> wrote:
> > 2007/5/31, Clinton Chau <clinton at clearcanvas.ca>:
> > > Alex, thanks for replying. It's not ideal for us to use EXECUTABLE_ AND LIBRARY_OUTPUT_PATH, just because we want to preserve the conventional directory structure of outputs from a Visual Studio project. It also won't work for us because we'd like to keep debug and release versions of the binaries simultaneously (though in different output directories).
> >
> > I think that if you want something specific for ALL your target
> > you may try to define YOUR own
> >
> > MYPROJECT_ADD_LIBRARY
> > MYPROJECT_ADD_EXECUTABLE
> >
> > macros
> > which wraps the genuine:
> > ADD_LIBRARY
> > ADD_EXECUTABLE
> >
> > while systematically adding your extra:
> > SET_TARGET_PROPERTIES(<TARGET> PROPERTIES PREFIX "Win64/")
> >
> > then you should use your specific macros.
> >
> > Not that fun but it seems doable, but does it fits your needs?
>
> This adds very little over using a SET_TARGET_PROPERTIES everywhere
> that it is needed.  What are you trying to save, a few lines of
> typing?  It's far more clear to just use the straight CMake API,

I was just trying to help and suggest a solution to Clinton's issue.
The main advantage I see when using you own CMake MACRO is:
that when you want to change your specific behavior
you just have to do it in a "single" place

> especially when you have debugging / maintenance questions for the
> mailing list.  Otherwise, you'll have to turn all your macros and
> wrappers back into straight CMake code before you can ask anyone
> anything.

I disagree here.
I personnally like the CMake MACRO very much because
its a good way to "extend or customize", 'strait' CMake code.
Nevertheless you are right when the bug is in the MACRO
you need help from the MACRO writer or you need to dive
in the MACRO.

>
> I don't think the PREFIX was intended to specify directories, though.
> I thought it was for library names.  I'd worry about mysterious things
> breaking, unless Bill blesses it.

I am not a CMake designer expert, so that I did not comment on this
and you may be damn right for this potentially awkward PREFIX usage.


-- 
Erk


More information about the CMake mailing list