[CMake] how to define current working directory of command line tool
Andreas Pakulat
apaku at gmx.de
Mon Oct 11 04:36:39 EDT 2010
On 11.10.10 10:07:58, Jochen Wilhelmy wrote:
> Hi!
> >>>>Is it possible to define the current working directory of a command line
> >>>>tool
> >>>>that is built with cmake? since the build is usually out-of-source I have
> >>>>to set the current working directory in the ide, e.g visual studio or
> >>>>xcode. more convenient would be to set it in cmake.
> >>>>
> >>>Do you mean in add_custom_command()/add_custom_target() ?
> >>>Both have an optional WORKING_DIRECTORY argument.
> >>>
> >>no, i mean add_executable. when I build and start the directory I'd like to set the
> >>working directory that the executable is started in.
> >>
> >>-Jochen
> >I think that you have a misconception with respect to the concept of "working directory".
> >
> >In a Unix-style environment, the "working directory" is determined by the "shell" command line interpreter. The actual value is determined only at execution-time. It is not something "built-in" to the executable.
> No, I mean this very unix-style working directory. Of course this is
> only a debug setting, i.e. it does not influence the
> build result. But if I write a command line tool, e.g. a copy, then
> I have some test files to copy and need some arguments
> for the copy tool to tell it which files to copy. Therefore it is
> possible to set the working directory and command line
> arguments in an ide (visual studio or xcode). For xcode there is
> even the effect that after cmake runs the current
> setting is lost which is not the case for visual studio since these
> settings are stored in a separate file.
CMake is not concerned with running your apps, its only concerned with
building the code (or rather generating something which can build the
code). So no, there's no way of setting a working-dir for the targets
you build.
Andreas
--
Day of inquiry. You will be subpoenaed.
More information about the CMake
mailing list