title: cmake and external library
body: <p>I try to use cmake with an external library but  i can't. I use minGW and g++ compiler.
  My project is organised as follow:
  project/</p>
  
  <ul>
  <li>CMakeLists.txt</li>
  <li>src
  <ul>
  <li>main.cpp</li>
  </ul></li>
  <li>lib
  <ul>
  <li>win
  <ul>
  <li>x86
  <ul>
  <li>SDL2-2.0.3 (contains SDL2.dll, SDL2.lib, SDL2main.lib and SDL2test.lib</li>
  </ul></li>
  </ul></li>
  </ul></li>
  <li>include
  <ul>
  <li>SDL2 (contains all header) </li>
  </ul></li>
  <li>bin</li>
  </ul>
  
  <p>The cmake generator works `cmake -G"Eclipse CDT4 - Unix Makefiles"</p>
  
  <p>My cmake file:
  `</p>
  
  <pre><code>    #
      # File generated by CMakeBuilder
  #
  #
  cmake_minimum_required(VERSION 2.6)
  PROJECT ( project CXX )
  
  
  ################ INCLUDE Libs ####################
  
  SET (CMAKE_INCLUDE_PATH "${PROJECT_SOURCE_DIR}/include/")
  SET (CMAKE_LINKER_PATH "${PROJECT_SOURCE_DIR}/lib/win/x86/SDL2-2.0.3/")
  
  message(STATUS "INCLUDE_PATH: ${CMAKE_INCLUDE_PATH}" )
  message(STATUS "LINKER_PATH: ${CMAKE_LINKER_PATH}" )
  
  INCLUDE_DIRECTORIES(${CMAKE_INCLUDE_PATH})
  LINK_DIRECTORIES(${CMAKE_LINKER_PATH})
  
  set (CMAKE_CXX_FLAGS "-lSDL2main -lSDL2 -lmingw32 ")
  
  #Generate file source
  
  file( GLOB_RECURSE  source_files  src/*)
  
  ADD_EXECUTABLE(project ${source_files})
  set(EXECUTABLE_OUTPUT_PATH bin/${CMAKE_BUILD_TYPE})
  </code></pre>
  
  <p>But when i launch make, i obtain this error:</p>
  
  <p>`</p>
  
  <pre><code>CMakeFiles/project.dir/objects.a(main.cpp.obj):main.cpp:(.text+0x0): multiple
       definition of main
          C:/Users/Gege/workspaces/workspaceCPP/project/lib/win/x86/SDL2-2.0.3/SDL2m
          ain.lib(./Release/SDL_windows_main.obj):(.text[_main]+0x0): first defined here
          Warning: corrupt .drectve at end of def file
          C:/Users/Gege/workspaces/workspaceCPP/project/lib/win/x86/SDL2-2.0.3/SDL2m
          ain.lib(./Release/SDL_windows_main.obj):(.text[_main]+0x12): undefined reference
       to SDL_main'
          c:/mingw/bin/../lib/gcc/mingw32/4.8.1/../../../../mingw32/bin/ld.exe:               C:/Users/Gege/workspaces/workspaceCPP/project/lib/win/x86/SDL2-    2.0.3/SDL2main.lib(./
          Release/SDL_windows_main.obj): bad reloc address 0x8 in section .text[_WinMain@
          16]'
          collect2.exe: error: ld returned 1 exit status
          CMakeFiles/project.dir/build.make:87: recipe for target 'bin/project.exe'
          failed
          make[2]: *** [bin/project.exe] Error 1
          CMakeFiles/Makefile2:60: recipe for target 'CMakeFiles/project.dir/all'           faile
          d
          make[1]: *** [CMakeFiles/arduinoGeo.dir/all] Error 2
          Makefile:75: recipe for target 'all' failed
          make: *** [all] Error 2
  </code></pre>
  
  <p>`
  Actually i don't want to put my lib in minGW folder to keep the build easy for the others.</p>
  
  <p>Thanks for you help</p>