[CMake] Does the echo command use the system shell?
Andreas Pakulat
apaku at gmx.de
Thu Jul 29 04:30:07 EDT 2010
On 29.07.10 09:15:51, Michael Wild wrote:
> On 29. Jul, 2010, at 8:51 , Andreas Pakulat wrote:
> > On 29.07.10 08:37:36, Michael Wild wrote:
> >>
> >> On 29. Jul, 2010, at 6:37 , Óscar Fuentes wrote:
> >>
> >>> Michael Wild <themiwi at gmail.com> writes:
> >>>
> >>> [snip]
> >>>
> >>>> Perhaps you need to tell us what it is that you are trying to achieve,
> >>>> because I suspect that you are over-thinking things and that there is
> >>>> a much simpler solution. E.g. what should buildobj.h contain
> >>>> (semantically, not the exact strings), and why is it only known at
> >>>> build time?
> >>>
> >>> I "solved" this specific instance with configure_file. It is not as
> >>> convenient as the original add_custom_command method but it works.
> >>>
> >>> What really concerns me is the general problem: a CMake command that
> >>> acts on a platform-dependent way when the existence of those "-E"
> >>> commands are motivated, precisely, for the cross-platform nature of
> >>> CMake. Maybe I should file a bug report and see how it fares.
> >>
> >> The problem is, CMake has to go through the system shell. Of course, CMake could write the command to a file and then invoke a custom interpreter from the system shell, but that would probably be very inefficient and would require CMake to implement a full shell language. And then CMake would be required to decide which semantics to implement (probably POSIX) and then Windows-only people would be angry...
> >
> > No it doesn't. CMake only needs to implement the commands it wants to
> > support. Thats actually what happens right now already (see cmake.cxx),
> > the commands for -E are all implemented in C++ code (including echo,
> > copy and others)
>
> But CMake only provides a useful, cross-platform, set of
> "shell-commands", but it is not a shell replacement. The cmake command is
> still invoked through the shell. With GNU Make, CMake could generate
> Makefile's that contain "SHELL=$(CMAKE_COMMAND)" instructions, but I
> don't think this is possible for Nmake, MSVC or Xcode.
Are you saying that the generated buildsystem files do something like:
$(SHELL) -c cmake -E ....
Instead of having just
cmake -E ...
I'd expect the latter to not go through a shell, but being run directly as
subprocess of the build tool.
Andreas
--
Don't feed the bats tonight.
More information about the CMake
mailing list