title: Using SDL2 with SDL2_image on OSX 10.11 (CMake 3.3 within CLion 1.1)
body: <p>I'm following a couple of tutorials from reddit.com/r/limeoats to learn some game development in c++. I'm not experienced with CMake or CLion and have managed to google my way this far.</p>
  
  <p>I had everything working up until I updated OSX to El Capitan (10.11). It seems that I can no longer use <code>#include "SDL2/SDL.h"</code> but instead need to use <code>#include "SDL.h"</code> Then it can find the SDL headers. The problem comes in when I also use <code>#include "SDL_image.h"</code> I get the following compiler error:</p>
  
  <pre><code>/Library/Frameworks/SDL2_image.framework/Headers/SDL_image.h:27:10:
  fatal error: 'SDL2/SDL.h' file not found
  #include &lt;SDL2/SDL.h&gt;
           ^
  </code></pre>
  
  <p>Looking into the header file in my Frameworks folder, it has <code>#include &lt;SDL2/SDL.h&gt;</code> but CMake is providing it as SDL.h for some reason after upgrading OSX to 10.11.</p>
  
  <p>How do I get the SDL extensions to play nice with the updated header path? Or how do I get CMake to give me the old SDL2/SDL.h header path back?</p>
  
  <p>Below is my CMakeLists.txt and I got the <a href="https://github.com/brendanwhitfield/collector/blob/master/cmake/FindSDL2.cmake#L50" rel="noreferrer">FindSDL2.cmake</a> (note the comment on line 50) and FindSDL2_image.cmake from <a href="https://github.com/brendanwhitfield/collector/tree/master/cmake" rel="noreferrer">here</a>.</p>
  
  <pre><code>cmake_minimum_required(VERSION 3.3)
  project(Cavestory)
  
  set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${PROJECT_SOURCE_DIR}/cmake")
  
  set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11")
  set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${PROJECT_SOURCE_DIR}/bin)
  
  include_directories(${PROJECT_SOURCE_DIR}/source/headers)
  
  find_package(SDL2 REQUIRED)
  find_package(SDL2_image REQUIRED &gt;=2.0.0)
  
  include_directories(${SDL2_INCLUDE_DIR})
  include_directories(${SDL2_IMAGE_INCLUDE_DIR})
  
  file(GLOB SOURCE_FILES "source/src/*.cpp")
  
  add_executable(Cavestory ${SOURCE_FILES})
  
  # One thread said this is all I should need to link SDL2
  # but cannot get this to work at all
  #target_link_libraries(Cavestory SDL2 SDL2_image)
  
  #add_custom_command(TARGET Cavestory POST_BUILD
  #        COMMAND ${CMAKE_COMMAND} -E copy_directory
  #        ${CMAKE_SOURCE_DIR}/content $&lt;TARGET_FILE_DIR:Cavestory&gt;)
  </code></pre>
  
  <p>And my directory structure (if it helps)...</p>
  
  <pre><code>/Cavestory (root)
      CMakeLists.txt
      /bin
      /cmake
          FindSDL2.cmake
          FindSDL2_image.cmake
      /content
          /sprites
              **images**
      /docs
      /source
          /headers
             **header files**
          /src
             **code files**
  </code></pre>