[CMake] Setting properties on all targets in one line

Brandon Van Every bvanevery at gmail.com
Fri Jun 1 13:47:38 EDT 2007


On 5/31/07, Eric Noulard <eric.noulard at gmail.com> wrote:
> 2007/5/31, Clinton Chau <clinton at clearcanvas.ca>:
> > > > But I can't figure out a way of applying this prefix to all targets.
> > >
> > > You can also set EXECUTABLE_OUTPUT_PATH , which applies to all
> > > executables "below" this point. Does this help ?
> >
> > 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,
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 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.

Can't recall an expected subdirectory mechanism.  Guess I'd have to RTFM.


Cheers,
Brandon Van Every


More information about the CMake mailing list