title: SDL project CMake build failure
body: <p>I try to set up an SDL project using CMake, but it seems like the executable isn't linked properly.</p>
  
  <p>This is the CMakeLists.txt I use</p>
  
  <pre><code>cmake_minimum_required(VERSION 3.0)
  project(MuspellsheimR)
  
  # includes cmake/FindSDL2.cmake
  set(CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/cmake/modules)
  
  # find SDL2
  find_package(SDL2 REQUIRED)
  include_directories(${SDL2_INCLUDE_DIR})
  
  set(SOURCE_FILES src/main.cpp)
  
  add_executable(MuspellsheimR ${SOURCE_FILES})
  target_link_libraries(MuspellsheimR ${SDL_LIBRARY})
  </code></pre>
  
  <p><code>src/main.cpp</code> looks like this:</p>
  
  <pre><code>#include &lt;iostream&gt;
  #include &lt;SDL.h&gt;
  
  int main(int, char**){
      if (SDL_Init(SDL_INIT_VIDEO) != 0){
          std::cout &lt;&lt; "SDL_Init Error: " &lt;&lt; SDL_GetError() &lt;&lt; std::endl;
          return 1;
      }
      SDL_Quit();
      return 0;
  }
  </code></pre>
  
  <p>Here is the log output.</p>
  
  <pre><code>[omtcyf0@localhost MuspellsheimR_Build]$ cmake -G "Unix Makefiles" ../MuspellsheimR
  -- The C compiler identification is GNU 5.1.1
  -- The CXX compiler identification is GNU 5.1.1
  -- Check for working C compiler: /usr/bin/cc
  -- Check for working C compiler: /usr/bin/cc -- works
  -- Detecting C compiler ABI info
  -- Detecting C compiler ABI info - done
  -- Detecting C compile features
  -- Detecting C compile features - done
  -- Check for working CXX compiler: /usr/bin/c++
  -- Check for working CXX compiler: /usr/bin/c++ -- works
  -- Detecting CXX compiler ABI info
  -- Detecting CXX compiler ABI info - done
  -- Detecting CXX compile features
  -- Detecting CXX compile features - done
  -- Looking for include file pthread.h
  -- Looking for include file pthread.h - found
  -- Looking for pthread_create
  -- Looking for pthread_create - not found
  -- Looking for pthread_create in pthreads
  -- Looking for pthread_create in pthreads - not found
  -- Looking for pthread_create in pthread
  -- Looking for pthread_create in pthread - found
  -- Found Threads: TRUE  
  -- Found SDL2: /usr/local/lib/libSDL2main.a;/usr/local/lib/libSDL2.so;-lpthread  
  -- Configuring done
  -- Generating done
  -- Build files have been written to: /home/omtcyf0/Desktop/MuspellsheimR_Build
  [omtcyf0@localhost MuspellsheimR_Build]$ 
  [omtcyf0@localhost MuspellsheimR_Build]$ ls
  CMakeCache.txt  CMakeFiles  cmake_install.cmake  Makefile
  [omtcyf0@localhost MuspellsheimR_Build]$ make
  Scanning dependencies of target MuspellsheimR
  [100%] Building CXX object CMakeFiles/MuspellsheimR.dir/src/main.cpp.o
  Linking CXX executable MuspellsheimR
  CMakeFiles/MuspellsheimR.dir/src/main.cpp.o: In function `main':
  main.cpp:(.text+0x25): undefined reference to `SDL_Init'
  main.cpp:(.text+0x3e): undefined reference to `SDL_SetVideoMode'
  main.cpp:(.text+0x51): undefined reference to `SDL_RWFromFile'
  main.cpp:(.text+0x5e): undefined reference to `SDL_LoadBMP_RW'
  main.cpp:(.text+0x7c): undefined reference to `SDL_UpperBlit'
  main.cpp:(.text+0x88): undefined reference to `SDL_Flip'
  main.cpp:(.text+0x92): undefined reference to `SDL_Delay'
  main.cpp:(.text+0x9e): undefined reference to `SDL_FreeSurface'
  main.cpp:(.text+0xa3): undefined reference to `SDL_Quit'
  collect2: error: ld returned 1 exit status
  CMakeFiles/MuspellsheimR.dir/build.make:85: recipe for target 'MuspellsheimR' failed
  make[2]: *** [MuspellsheimR] Error 1
  CMakeFiles/Makefile2:60: recipe for target 'CMakeFiles/MuspellsheimR.dir/all' failed
  make[1]: *** [CMakeFiles/MuspellsheimR.dir/all] Error 2
  Makefile:116: recipe for target 'all' failed
  make: *** [all] Error 2
  </code></pre>
  
  <p>What am I doing wrong?</p>