title: How to get CMake find freeglut on windows?
body: <p>I am working on Windows and I would like to create an OS independent project in CMake. I also would like to use OpenGL with freeglut.</p>
  
  <p>My <em>CMakeLists.txt</em> so far looks like this:</p>
  
  <pre><code>project (visualizer)
  
  set(GLUT_INCLUDE_DIR "C:/Program Files (x86)/freeglut/include")
  set(OPENGL_LIBRARY_DIR "C:/Program Files (x86)/freeglut/lib")
  
  # GLUT
  find_package(GLUT REQUIRED)
  include_directories(${GLUT_INCLUDE_DIR})
  if(NOT GLUT_FOUND)
      message(ERROR "GLUT not found!")
  endif(NOT GLUT_FOUND)
  
  # OpenGL
  find_package(OpenGL REQUIRED)
  include_directories(${OpenGL_INCLUDE_DIRS})
  if(NOT OPENGL_FOUND)
      message(ERROR "OPENGL not found!")
  endif(NOT OPENGL_FOUND)
  
  add_executable(visu visualizer.cpp)
  target_link_libraries(visu ${OPENGL_LIBRARIES} ${GLUT_LIBRARY})
  </code></pre>
  
  <p>I have to explicitly define the paths for <code>GLUT_INCLUDE_DIR</code> and <code>OPENGL_LIBRARY_DIR</code>, otherwise cmake will give me this error:</p>
  
  <blockquote>
    <p>CMake Error at C:/Program
    Files/CMake/share/cmake-3.14/Modules/FindPackageHandleStandardArgs.cmake:137
    (message):   Could NOT find GLUT (missing: GLUT_INCLUDE_DIR)</p>
  </blockquote>
  
  <p>As far as I know this should be handled by <code>findglut.cmake</code>. I mean, I do not have the expertise to find out where it would search for the lib, but I think this part of the <code>findglut.cmake</code> supposed to do it:</p>
  
  <pre><code>if (WIN32)
    find_path( GLUT_INCLUDE_DIR NAMES GL/glut.h
      PATHS  ${GLUT_ROOT_PATH}/include )
    find_library( GLUT_glut_LIBRARY_RELEASE NAMES glut glut32 freeglut
      PATHS
      ${OPENGL_LIBRARY_DIR}
      ${GLUT_ROOT_PATH}/Release
      )
    find_library( GLUT_glut_LIBRARY_DEBUG NAMES freeglutd
      PATHS
      ${OPENGL_LIBRARY_DIR}
      ${GLUT_ROOT_PATH}/Debug
      )
    mark_as_advanced(GLUT_glut_LIBRARY_RELEASE GLUT_glut_LIBRARY_DEBUG)
    select_library_configurations(GLUT_glut)
  else ()
  </code></pre>
  
  <p><strong>My actual question is:</strong> Where should I put the freeglut files so CMake will find them without any additional effort?</p>