[CMake] view execute_process command

James Bigler jamesbigler at gmail.com
Wed Nov 5 15:06:42 EST 2008


On Fri, Oct 31, 2008 at 4:15 AM, Mike Arthur <mike at mikearthur.co.uk> wrote:
> On Thursday 30 October 2008 20:41:36 James Bigler wrote:
>> Is it possible to view the actual command run by an execute_process
>> command?  I'm trying to debug a command that isn't getting the right set of
>> quotes or something, and I want to see the command as cmake would execute
>> them.
> It would be good to know this but I tend to just copy the command itself into
> a MESSAGE(FATAL_ERROR) and read the output.
> --
> Cheers,
> Mike Arthur
> http://mikearthur.co.uk/

The problem I was having was whether an argument with spaces was
getting passed in as one or two arguments.  Something like that would
be hard to detect printing it with message().

I actually ended up writing a helper executable that printed out all
the arguments and using that in place of cmake when invoking.

#include <stdio.h>

int main(int argc, char* argv[], char* env[])
{
  int i;
  for(i = 0; i < argc; ++i)
    printf("arg[%d] = %s\n", i, argv[i]);
#if 0
  for (i=0; env[i]; ++i)
    printf("env[%d] = %s\n", i, env[i]);
#endif

  return 0;
}

James


More information about the CMake mailing list