title: cmake not finding gl.h on OS X
body: <p>I am on OS X 10.10 and trying to build a C 'project' with GLUT and OpenGL.
  I reduced it to a minimal example showcasing my problem. I have the following <code>CMakeLists.txt</code>:</p>
  
  <pre><code>cmake_minimum_required(VERSION 2.8)
  FIND_PACKAGE(OpenGL REQUIRED)
  FIND_PACKAGE(GLUT REQUIRED)
  
  if(OpenGL_FOUND) # never true, but printed as true
      link_directories(${OpenGL_LIBRARY_DIRS})
      include_directories(${OpenGL_INCLUDE_DIR})
  endif(OpenGL_FOUND)
  
  if(GLUT_FOUND)
      link_directories(${GLUT_LIBRARY_DIR})
      include_directories(${GLUT_INCLUDE_DIR})
  endif(GLUT_FOUND)
  
  # print all vars because wtf
  get_cmake_property(_v VARIABLES)
  foreach(_v ${_v})
     message(STATUS "${_v}=${${_v}}")
  endforeach()
  
  
  add_executable(main main.c)
  
  target_link_libraries(main ${GLUT_LIBRARY} ${OPENGL_LIBRARY})
  </code></pre>
  
  <p>The <code>main.c</code> is just a dummy including two headers:</p>
  
  <pre><code>#include &lt;gl.h&gt;
  #include &lt;glut.h&gt;
  int main()
  {    
     return 0;
  }
  </code></pre>
  
  <p>Now, <code>cmake .</code> runs fine and for debugging purposes prints all variables. I took the code from somewhere, I do not know enough about cmake to know whether it's doing what I think it is. Anyway, running <code>make</code> returns</p>
  
  <pre><code>main.c:1:10: fatal error: 'gl.h' file not found
  #include &lt;gl.h&gt;
           ^
  1 error generated.
  </code></pre>
  
  <p>The header <code>gl.h</code> is actually present in <code>/System/Library/Frameworks/OpenGL.framework/Headers</code> and as such should be found by cmake, especially since <code>glut.h</code> is in the same structure (simply replace OpenGL with GLUT) and is found just fine. Also, what is confusing to me is that the block in <code>if(GLUT_FOUND)...</code> is never executed (try to put a <code>message</code> statement into it), but among the printed variables it says <code>OPENGL_FOUND=TRUE</code>. But removing the if-condition does not change anything.</p>
  
  <p>The actual question: What the hell is going on? Why does a) cmake not find the header unless specifically included, b) the if-block not execute although <code>OPENGL_FOUND</code> prints as TRUE, c) no such problems occur with <code>glut.h</code>? Spent hours on this and can't fathom why.</p>