title: CMAKE add_custom_command: How to use my raw commands
body: <p>I am trying to add some custom build commands to my <strong>vc2010</strong> project by using <strong>ADD_CUSTOM_COMMAND</strong>. But:</p>
  
  <p><strong>[1]</strong> I just find that CMAKE will automatically insert much more code than I hvae expected. </p>
  
  <p>For example, I want the command exactly to be:</p>
  
  <pre><code>"c:\Some Folder\MyTool.exe" -arg0 -arg1
  </code></pre>
  
  <p>The corresponding code in CMakeLists.txt is like:</p>
  
  <pre><code>add_custom_command( OUTPUT ${outfile}
                    COMMAND "c:\Some Folder\MyTool.exe" ARGS "-arg0 -arg1"
                    # COMMAND "\"c:\Some Folder\MyTool.exe\"" will FAIL to be parsed!
                    MAIN_DEPENDENCY ${infile}
                    VERBATIM)
  </code></pre>
  
  <p>but actually I got:</p>
  
  <pre><code>setlocal
  c:\Some Folder\MyTool.exe "-arg0 -arg1"
  if %errorlevel% neq 0 goto :cmEnd
  :cmEnd
  endlocal &amp; call :cmErrorLevel %errorlevel% &amp; goto :cmDone
  :cmErrorLevel
  exit /b %1
  :cmDone
  if %errorlevel% neq 0 goto :VCEnd
  </code></pre>
  
  <p>This is not what I want.  I have also tried the string: <code>COMMAND "\"${MYTOOL_PATH}\" -arg0 -arg1"</code>, but CMake just failed to parse it because there is a quote in front of the string.
  So it's bad I can't quote the command string because the path <em><code>c:\Some Folder\MyTool.exe</code></em> contains spaces.</p>
  
  <p><strong>[2]</strong> I also notice CMake will automatically expand my dependency pathes. </p>
  
  <p>If I add to the command <code>DEPENS "$(PATH_MACRO)"</code>, I will eventually get the dependency path automatically expanded by CMake: <code>C:\MySolutionDir\$(PATH_MACRO)</code>; But I only want <code>$(PATH_MACRO)</code>, because I will make sure visual studio understands what <code>$(PATH_MACRO)</code>  refers to.</p>
  
  <p><em><strong>So here is my question</em></strong>:</p>
  
  <p>How can CMake only accept my raw inputs, without auto expanding the path or inserting code I don't expect? I will make sure my inputs will be valid for visual studio. Thanks!</p>
  
  <p>PS. My CMake version: 2.8.10.2. VS version: visual studio 2010 Ultimate</p>