title: How add OpenGL & GLUT for CLion on Windows?
body: <p>I have installed OpenGL and Glut but when I'm trying to run it - get this error. Have I installed something wrong? Or should I edit CMake file?</p>
  <h2>CMakeLists.txt:</h2>
  <pre><code>project(LW1)
  
  set(CMAKE_CXX_STANDARD 17)
  
  include_directories(OpenGL)
  include_directories(OpenGL/include) # OpenGL/include has to contain the required OpenGL's .h files
  include_directories(OpenGL/lib) # OpenGL/lib has to contain the required OpenGL's .lib files
  
  
  
  add_custom_target(glutdlllib
          COMMAND ${CMAKE_COMMAND} -E copy LW1/OpenGL/dll/glut32.dll ${CMAKE_BINARY_DIR}
          )
  
  set(OpenGlLibs glaux glu32 glui32 glut32 opengl32 )
  
  
  #These 3 lines are just linking and making executables
  
  add_executable(LW1 main.cpp)
  
  target_link_libraries(LW1 ${OpenGlLibs})
  
  add_dependencies(LW1 glutdlllib)
  
  target_link_libraries(LW1 -lOpenGL32 -lfreeGLUT)
  </code></pre>
  <h2>main.cpp :</h2>
  <pre><code>#include &lt;windows.h&gt;
  #include &lt;GL/gl.h&gt;
  #include &lt;GL/glu.h&gt;
  #include &lt;GL/glaux.h&gt;
  #include &lt;glut.h&gt;
  
  void resize(int width, int height)
  {
  }
  void display(void) {
      glColor3d(1,1,0);
      glutSolidSphere(1.0, 25, 25);
      glFlush();
  }
  void init(void) {
      glEnable(GL_COLOR_MATERIAL);
      glEnable(GL_LIGHTING);
      glEnable(GL_LIGHT0);
      glEnable(GL_DEPTH_TEST);
      glClearColor(0.0, 0.0, 0.0, 0.0);
      glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
      glMatrixMode(GL_PROJECTION);;
      glLoadIdentity();
      glOrtho(-5.0, 5.0, -5.0, 5.0, 2.0, 12.0);
      gluLookAt(0,0,5, 0,1,0, 0,1,0);
      glMatrixMode(GL_MODELVIEW);
  }
  int main(int argc, char ** argv) {
      glutInitDisplayMode(GLUT_SINGLE | GLUT_RGB | GLUT_DEPTH);
      glutInitWindowPosition(50, 10);
      glutInitWindowSize(400, 400);
      glutCreateWindow(&quot;Hello&quot;);
      glutReshapeFunc(resize);
      init();
      glutDisplayFunc(display);
      glutMainLoop();
      return 0;
  }
  </code></pre>
  <h2>Error:</h2>
  <pre><code>&quot;C:\Program Files\JetBrains\CLion 2020.2.1\bin\cmake\win\bin\cmake.exe&quot; --build C:\Users\Anichaaaaaa\CLionProjects\LW1\cmake-build-debug --target LW1 -- -j 6
  Error copying file &quot;LW1/OpenGL/dll/glut32.dll&quot; to &quot;C:/Users/Anichaaaaaa/CLionProjects/LW1/cmake-build-debug&quot;.
  mingw32-make.exe[3]: *** [CMakeFiles\glutdlllib.dir\build.make:76: CMakeFiles/glutdlllib] Error 1
  mingw32-make.exe[2]: *** [CMakeFiles\Makefile2:96: CMakeFiles/glutdlllib.dir/all] Error 2
  mingw32-make.exe[1]: *** [CMakeFiles\Makefile2:130: CMakeFiles/LW1.dir/rule] Error 2
  mingw32-make.exe: *** [Makefile:150: LW1] Error 2
  </code></pre>