title: Broken CMake and GCC under OS X
body: <p>When running <code>configure</code> in <code>cmake-gui</code> on my OS&nbsp;X platform, I get the following error occurring:</p>
  
  <pre><code>The C compiler identification is GNU
  The CXX compiler identification is GNU
  Checking whether C compiler has -isysroot
  Checking whether C compiler has -isysroot - yes
  Checking whether C compiler supports OSX deployment target flag
  Checking whether C compiler supports OSX deployment target flag - yes
  Check for working C compiler: /usr/bin/gcc-4.0
  Check for working C compiler: /usr/bin/gcc-4.0 -- broken
  CMake Error at /Applications/CMake 2.8-2.app/Contents/share/cmake-2.8/Modules/CMakeTestCCompiler.cmake:52 (MESSAGE):
    The C compiler "/usr/bin/gcc-4.0" is not able to compile a simple test
    program.
  
    It fails with the following output:
  
     Change Dir: /Users/bill/Desktop/cmake_test/build/CMakeFiles/CMakeTmp
  
    Run Build Command:/opt/local/bin/gmake "cmTryCompileExec/fast"
  
    /opt/local/bin/gmake -f CMakeFiles/cmTryCompileExec.dir/build.make
    CMakeFiles/cmTryCompileExec.dir/build
  
    gmake[1]: Entering directory
    `/Users/bill/Desktop/cmake_test/build/CMakeFiles/CMakeTmp'
  
    "/Applications/CMake 2.8-2.app/Contents/bin/cmake" -E cmake_progress_report
    /Users/bill/Desktop/cmake_test/build/CMakeFiles/CMakeTmp/CMakeFiles 1
  
    Building C object CMakeFiles/cmTryCompileExec.dir/testCCompiler.c.o
  
    /usr/bin/gcc-4.0 -isysroot -o
    CMakeFiles/cmTryCompileExec.dir/testCCompiler.c.o -c
    /Users/bill/Desktop/cmake_test/build/CMakeFiles/CMakeTmp/testCCompiler.c
  
    i686-apple-darwin10-gcc-4.0.1:
    CMakeFiles/cmTryCompileExec.dir/testCCompiler.c.o: No such file or
    directory
  
      &lt;snip&gt;
  </code></pre>
  
  <p>From looking at forums, etc. on the Internet, I have established that this could be to do with my PATH variable. Here is my PATH variable for analysis:</p>
  
  <pre><code>! echo $PATH
  /Library/Frameworks/Python.framework/Versions/Current/bin:/Library/Frameworks/Python.framework/Versions/2.7/bin:/sw/bin:/sw/sbin:/Applications/MATLAB_R2012a.app/bin:/opt/local/bin:/opt/local/sbin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/usr/texbin:/usr/X11/bin:/usr/X11R6/bin
  </code></pre>
  
  <p>This path variable has recently changed when I configured Python, and I think that the GCC problems must have sprung up at the same sort of time. What could be wrong with my system installation for this to be occurring?</p>
  
  <hr>
  
  <p>Some more details. The build program specified by <code>CMAKE_MAKE_PROGRAM</code> is <code>/opt/local/bin/gmake</code>.</p>
  
  <p>I have also discovered that these errors are only thrown when running <code>Configure</code> in <code>cmake-gui</code>. On the command line (running <code>cmake ..</code> from a build folder), the configuration completes fine:</p>
  
  <pre><code>! cmake ..
  -- The C compiler identification is GNU 4.0.1
  -- The CXX compiler identification is GNU 4.2.1
  -- Checking whether C compiler has -isysroot
  -- Checking whether C compiler has -isysroot - yes
  -- Checking whether C compiler supports OSX deployment target flag
  -- Checking whether C compiler supports OSX deployment target flag - yes
  -- Check for working C compiler: /usr/bin/gcc-4.0
  -- Check for working C compiler: /usr/bin/gcc-4.0 -- works
  -- Detecting C compiler ABI info
  -- Detecting C compiler ABI info - done
  -- Checking whether CXX compiler has -isysroot
  -- Checking whether CXX compiler has -isysroot - yes
  -- Checking whether CXX compiler supports OSX deployment target flag
  -- Checking whether CXX compiler supports OSX deployment target flag - yes
  -- Check for working CXX compiler: /usr/bin/c++
  -- Check for working CXX compiler: /usr/bin/c++ -- works
  -- Detecting CXX compiler ABI info
  -- Detecting CXX compiler ABI info - done
  -- Configuring done
  -- Generating done
  </code></pre>
  
  <p>However, compilation is not always successful when using some libraries - see for example <a href="https://stackoverflow.com/questions/16449887/boost-problems-when-compiling-point-cloud-library">this question I have asked here</a>. I therefore think something might still be going wrong in the <code>cmake</code> process.</p>