title: How to get CMake to use the default compiler on system PATH?
body: <p><a href="https://stackoverflow.com/questions/16074537/how-to-get-cmake-to-use-default-compiler-on-system-path">There</a> is the same question and the answer.
  The problem is that the answer seems to be wrong (actually is not the answer to the asked question). Can I re-ask the question?
  The problem:</p>
  <pre><code>$ echo $PATH
  /usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games
  $ whereis gcc
  cc: /usr/bin/gcc /usr/lib/gcc /usr/local/bin/gcc /usr/libexec/gcc
  $ which gcc
  /usr/local/bin/gcc
  $ /usr/bin/gcc -v
  gcc version 4.1.2
  $ /usr/local/bin/gcc -v
  gcc version 4.8.4
  $ gcc -v
  gcc version 4.8.4
  $ cmake .
  -- The C compiler identification is GNU 4.1.2
  ...
  ...
  </code></pre>
  <p>The local GCC version if 4.8.4 and the system's default version is '4.1.2'. All other tool-chains respects the PATH environment variable and use the local (newer) GCC version. All except of CMAKE.
  Setting CC is not a good idea, because there might be other binary tools which could also be used.
  Setting CMAKE_PROGRAM_PATH and CMAKE_PREFIX_PATH in the beginning of the script doesn't help with detection of the compilers.
  <BR>Is there any way to force CMAKE to respect the PATH variable?</p>