[CMake] Separate object directories on Linux?
Bill Hoffman
bill.hoffman at kitware.com
Wed Apr 2 13:20:18 EDT 2008
Bryan O'Sullivan wrote:
> On Windows and OS X, I notice that object files get put into a directory
> prefixed with the current build type, e.g. Debug or Release. This
> doesn't happen on Linux, so I can't have a single build tree with
> multiple builds side by side in it. Is there some reason for this? The
> variation in behaviour across platforms seems peculiar.
>
Basically, this is because on windows we use the default for the native
tool visual studio which supports configuration types. On makefile
builds we only support a single configuration per build tree as would be
expected in a most makefiles. I guess it is the price we pay for
generating to native build tools, there are sometimes inconsistencies.
It would be nice if at some point in the future we supported
configurations for makefiles, and flat builds for ide's, but this has
not yet been done.
However, there are some variables that can help with this.
CMAKE_CGG_INTDIR -> this will expand out at build time to the correct
directory for the build ( $(OutDir) with vside). It will be "." for
makefiles. This means you can always use it to run stuff.
bin/${CMAKE_CFG_INTDIR}/myprogram will work on unix and vside, and Xcode.
CMAKE_BUILD_TYPE is only used by makefile generators and is the specific
build for that tree.
CMAKE_CONFIGURATION_TYPES is set to the list of active configurations
(Debug, Release, etc). It is empty for makefile builds. So, you can
iterate over this and construct paths etc.
-Bill
More information about the CMake
mailing list