title: How to execute custom command in CMake with "unpolluted" environment?
body: <p>Problem:
  I have an <code>add_custom_command</code> which calls an external tool that does a build of some external lib via <code>gmake</code>. The gmake output is logged into a log file.</p>
  
  <p>CMake uses Unix Makefiles as a generator target and it sets <code>$(VERBOSE).SILENT</code>.
  This option somehow gets inherited by gmake (probably via <code>MAKEFLAGS</code>) called from the tool which was executed in the top level make file generated from <code>add_custom_command</code>. As a result, the log file doesn't contain any useful info.</p>
  
  <p>This is not ideal - used CMake generator and its internal options are inadvertently leaked into my external tool. Is there some way to prevent this?</p>
  
  <p>Here is the code in CMakeLists to better illustrate the problem:</p>
  
  <pre><code>...
  add_custom_command(OUTPUT "&lt;some target name&gt;"
                     COMMAND ${BUILDTOOL_COMMAND} # i.e. buildtool &lt;buildtool args&gt;
                     VERBATIM)
  ...
  </code></pre>
  
  <p>For which CMake generates <code>build.make</code> file with the following:</p>
  
  <pre><code>...
  # Suppress display of executed commands.
  $(VERBOSE).SILENT:
  
  ...
  
  &lt;some target name&gt;: 
      buildtool &lt;buildtool args&gt;
  ...
  </code></pre>