title: CLion cmake glew error?
body: <p>I ma trying to setup glew for clion but for some reason everything I have tried after researching the subject seems to not work and produce errors. I have downloaded the source files from their main website <a href="http://glew.sourceforge.net/" rel="nofollow noreferrer">http://glew.sourceforge.net/</a> and are located within my clion project under directory <code>Externals</code>. Note: there is for some reason nothing under the lib folder under glew. my assumption build be that cmake builds it then links it which would be fine but I am very new to cmake and have no idea if this is the case. </p>
  
  <p>CMake compile errors</p>
  
  <pre><code>C:\Users\Matt\AppData\Local\JetBrains\Toolbox\apps\CLion\ch-0\171.4073.41\bin\cmake\bin\cmake.exe -DCMAKE_BUILD_TYPE=Debug -G "CodeBlocks - MinGW Makefiles" C:\Users\Matt\CLionProjects\SkyGames
  -- Could NOT find Vulkan (missing:  VULKAN_INCLUDE_DIR) 
  -- Using Win32 for window creation
  -- Could NOT find GLEW (missing:  GLEW_INCLUDE_DIR GLEW_LIBRARY) 
  -- Configuring done
  CMake Error:
    Error evaluating generator expression:
  
      $&lt;TARGET_PDB_FILE:glew&gt;
  
    TARGET_PDB_FILE is not supported by the target linker.
  
  
  -- Generating done
  -- Build files have been written to: C:/Users/Matt/CLionProjects/SkyGames/cmake-build-debug
  </code></pre>
  
  <p>CMakeList for project</p>
  
  <pre><code>cmake_minimum_required(VERSION 3.7)
  project(SkyGames)
  
  set(CMAKE_CXX_STANDARD 14)
  
  add_executable(SkyGames ${SOURCE_FILES})
  
  set(GLFW_BUILD_DOCS OFF CACHE BOOL "" FORCE)
  set(GLFW_BUILD_TESTS OFF CACHE BOOL "" FORCE)
  set(GLFW_BUILD_EXAMPLES OFF CACHE BOOL "" FORCE)
  
  add_subdirectory(${PROJECT_SOURCE_DIR}/Externals/GLFW3)
  
  ###########################
  # GLFW
  ###########################
  
  target_link_libraries(SkyGames glfw)
  include_directories(SkyGames ${GLFW_INCLUDE_DIR})
  
  ###########################
  # GLEW
  ###########################
  
  add_subdirectory(${PROJECT_SOURCE_DIR}/Externals/glew2s/build/cmake)
  
  find_package(glew REQUIRED)
  if (GLEW_FOUND)
      include_directories(SkyGames ${GLEW_INCLUDE_DIR})
  endif()
  
  ##########################
  # OPENGL
  ##########################
  
  find_package(OpenGL REQUIRED)
  target_link_libraries(SkyGames ${OPENGL_gl_LIBRARY} ${OPENGL_glu_LIBRARY})
  
  include_directories(SkyGames ${OPENGL_INCLUDE_DIR})
  </code></pre>
  
  <p><strong><em>Update:</em></strong></p>
  
  <p>It appears that the new version of the CMakeLists.txt works fine except when you build the program it errors saying permission denied. it is further highlighted below.</p>
  
  <p>new GLEW portion of CmakeList.txt</p>
  
  <pre><code>###########################
  # GLEW
  ###########################
  set(CMAKE_PREFIX_PATH ${PROJECT_SOURCE_DIR}/Externals/glew2s/build/cmake)
  set(GLEW_INCLUDE_DIR ${PROJECT_SOURCE_DIR}/Externals/glew2s/include)
  set(GLEW_LIBRARY ${PROJECT_SOURCE_DIR}/Externals/glew2s/lib)
  find_package(GLEW REQUIRED)
  include_directories(${PROJECT_SOURCE_DIR}/Externals/glew2s/include)
  
  ##########################
  # OPENGL
  ##########################
  
  find_package(OpenGL REQUIRED)
  target_link_libraries(SkyGames GLEW::GLEW ${OPENGL_LIBRARY} ${OPENGL_gl_LIBRARY} ${OPENGL_glu_LIBRARY})
  </code></pre>
  
  <p>Build Message</p>
  
  <pre><code>C:\Users\Matt\AppData\Local\JetBrains\Toolbox\apps\CLion\ch-0\171.4073.41\bin\cmake\bin\cmake.exe --build C:\Users\Matt\CLionProjects\SkyGames\cmake-build-debug --target SkyGames -- -j 8
  [ 71%] Built target glfw
  [ 76%] Linking CXX executable SkyGames.exe
  c:/mingw/bin/../lib/gcc/mingw32/5.3.0/../../../../mingw32/bin/ld.exe: cannot find ../Externals/glew2s/lib: Permission denied
  collect2.exe: error: ld returned 1 exit status
  mingw32-make.exe[3]: *** [SkyGames.exe] Error 1
  CMakeFiles\SkyGames.dir\build.make:206: recipe for target 'SkyGames.exe' failed
  mingw32-make.exe[2]: *** [CMakeFiles/SkyGames.dir/all] Error 2
  mingw32-make.exe[1]: *** [CMakeFiles/SkyGames.dir/rule] Error 2
  CMakeFiles\Makefile2:66: recipe for target 'CMakeFiles/SkyGames.dir/all' failed
  mingw32-make.exe: *** [SkyGames] Error 2
  CMakeFiles\Makefile2:78: recipe for target 'CMakeFiles/SkyGames.dir/rule' failed
  Makefile:161: recipe for target 'SkyGames' failed
  </code></pre>