title: CMake linker not working correctly
body: <p>I am trying to build my project using CMake but I am having error linking required libraries. I have this CMakeLists.txt in the root folder of my project:</p>
  
  <pre><code>cmake_minimum_required(VERSION 2.6)
  project(test)
  add_subdirectory(src)
  </code></pre>
  
  <p>And in my src folder, alongside my source files I have this CMakeLists.txt:</p>
  
  <pre><code>set (CMAKE_CXX_FLAGS "Wall -std=c++11" )
  set (CMAKE_EXE_LINKER_FLAGS "-lSDL2 -lGL" )
  file (GLOB SRCS *.cpp *.h )
  add_executable(engine ${SRCS} )
  </code></pre>
  
  <p>I then go into the build folder and do <code>cmake ..</code> and it runs without any errors. When I do <code>make</code>, the compilation runs without any errors as well, but when it gets to the linking part, I get these errors:</p>
  
  <pre><code>CMakeFiles/test.dir/Application.cpp.o: In function `Application::onExecute()':
  Application.cpp:(.text+0x41): undefined reference to `SDL_GetTicks'
  Application.cpp:(.text+0x4e): undefined reference to `SDL_GetTicks'
  Application.cpp:(.text+0xd7): undefined reference to `SDL_PollEvent'
  CMakeFiles/test.dir/Application.cpp.o: In function `Application::render()':
  Application.cpp:(.text+0x17b): undefined reference to `glClearColor'
  Application.cpp:(.text+0x185): undefined reference to `glClear'
  Application.cpp:(.text+0x194): undefined reference to `SDL_GL_SwapWindow'
  CMakeFiles/test.dir/Application.cpp.o: In function `Application::cleanUp()':
  Application.cpp:(.text+0x1b2): undefined reference to `SDL_GL_DeleteContext'
  Application.cpp:(.text+0x1c1): undefined reference to `SDL_DestroyWindow'
  Application.cpp:(.text+0x1c6): undefined reference to `SDL_Quit'
  CMakeFiles/test.dir/Application.cpp.o: In function `Application::initialize()':
  Application.cpp:(.text+0x1de): undefined reference to `SDL_Init'
  Application.cpp:(.text+0x1ea): undefined reference to `SDL_GetError'
  Application.cpp:(.text+0x22b): undefined reference to `SDL_CreateWindow'
  Application.cpp:(.text+0x243): undefined reference to `SDL_GetError'
  Application.cpp:(.text+0x25a): undefined reference to `SDL_Quit'
  Application.cpp:(.text+0x270): undefined reference to `SDL_GL_SetAttribute'
  Application.cpp:(.text+0x27f): undefined reference to `SDL_GL_SetAttribute'
  Application.cpp:(.text+0x28e): undefined reference to `SDL_GL_SetAttribute'
  Application.cpp:(.text+0x29d): undefined reference to `SDL_GL_CreateContext'
  Application.cpp:(.text+0x2af): undefined reference to `glGetString'
  collect2: error: ld returned 1 exit status
  make[2]: *** [src/test] Error 1
  make[1]: *** [src/CMakeFiles/test.dir/all] Error 2
  make: *** [all] Error 2
  </code></pre>
  
  <p>I have the correct includes in my header files and I was able to compile and run using only make so I think the linker flags I tell CMake aren't being passed to the compiler. How can I fix this?</p>