[CMake] Copy target from different configurations

Brad King brad.king at kitware.com
Sat May 30 08:04:18 EDT 2009


Jacob Repp wrote:
> I found that the VS7 local generator doesn't honor the
> *_OUTPUT_DIRECTORY properties so here's a modification that I added to
> our local version:

I think your patch just updates the "intermediate files" output
location, which includes all the object files.

CMake 2.6.4 does honor the setting:

   add_executable(foo foo.c)
   set_property(TARGET foo PROPERTY RUNTIME_OUTPUT_DIRECTORY
                ${CMAKE_CURRENT_BINARY_DIR}/bin)

After build, I get .../bin/debug/foo.exe, not .../debug/foo.exe
as if the property were not set.  Computation of these output
paths goes through a central place that is shared by all the
generators.  It is well tested and known to work.

Perhaps you are expecting it to not add the "debug" part?
We have to add this to keep different configurations from
clobbering each other.  The property is meant to change
the base directory away from the default where the target
is added.  It is useful to put all targets in one output
folder (per-config) even if their source CMakeLists.txt
files are in different directories.

We could create a RUNTIME_OUTPUT_DIRECTORY_<CONFIG> property
to allow per-configuration output directory customizaiton.
Is that what you want?

-Brad


More information about the CMake mailing list