title: cmake execute_process COMMAND
body: <p>CMakeList.txt:</p>
  
  <pre><code>set(MAKE_CMD "${CMAKE_CURRENT_SOURCE_DIR}/makeHeaders.sh ${CMAKE_CURRENT_SOURCE_DIR} ${INC_DIR}")
  MESSAGE("COMMAND: ${MAKE_CMD}")
  execute_process(COMMAND "${MAKE_CMD}"   
     RESULT_VARIABLE CMD_ERROR
     OUTPUT_FILE CMD_OUTPUT)
  MESSAGE( STATUS "CMD_ERROR:" ${CMD_ERROR})
  MESSAGE( STATUS "CMD_OUTPUT:" ${CMD_OUTPUT})
  </code></pre>
  
  <p>cmake .. OUTPUT:</p>
  
  <pre><code>COMMAND: /home/src/makeHeaders.sh /home/src /home/include
  -- CMD_ERROR:No such file or directory
  -- CMD_OUTPUT:
  </code></pre>
  
  <p>If I copy the COMMAND that cmake prints out above, paste it on the command line, it works fine</p>
  
  <p>Here makeHeaders.sh</p>
  
  <pre><code>#!/bin/bash
  echo In makeHeaders.sh
  echo first: $1
  echo second $2
  echo Making fxsizec.h
  echo grep VERSION $1/config/6/cfs.c | grep '^#define' | grep -v 'PGM_V' &gt; $2/fxsizec.h  
  echo Making fxsizeo.h
  echo grep VERSION $1/opaid/WRS.c | grep '^#define' | grep -v 'PGM_V' |awk '{print $$1 " OA"$$2 " "$$3}' &gt; $2/fxsizeo.h
  
  grep VERSION $1/config/6/cfs.c | grep '^#define' | grep -v 'PGM_V' &gt; $2/fxsizec.h  
  grep VERSION $1/opaid/WRS.c | grep '^#define' | grep -v 'PGM_V' |awk '{print $$1 " OA"$$2 " "$$3}' &gt; $2/fxsizeo.h
  </code></pre>