diff options
author | Sybren A. Stüvel <sybren@stuvel.eu> | 2015-02-16 10:22:26 +0300 |
---|---|---|
committer | Sybren A. Stüvel <sybren@stuvel.eu> | 2015-02-16 11:27:50 +0300 |
commit | 9a10b208bacd4258e528532d400b25aeb33591d9 (patch) | |
tree | 0f6d65d397404b2fd0a20d14f56556a7b7c49ac0 /CMakeLists.txt | |
parent | 58652301dee685f67edf03c2bfcfbafe15a7cb6e (diff) |
Ensure CMake finds SDL 2.0
CMake 2.8 doesn't search /usr/include/SDL2, which is the include directory
for SDL 2.x on Ubuntu Linux (and possibly others). This results in SDL 1.2
headers being found when WITH_SDL_DYNLOAD=OFF, and our shipped SDL 2.0
headers when WITH_SDL_DYNLOAD=ON. This patch ensures that in both
cases the correct SDL headers are used.
Reviewers: sergey, campbellbarton
Projects: #bf_blender
Differential Revision: https://developer.blender.org/D1112
Diffstat (limited to 'CMakeLists.txt')
-rw-r--r-- | CMakeLists.txt | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt index 29f8c815cf0..561d7f18ff5 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -838,17 +838,21 @@ if(UNIX AND NOT APPLE) if(WITH_SDL) if(WITH_SDL_DYNLOAD) - set(SDLMAIN_LIBRARY) set(SDL_INCLUDE_DIR "${CMAKE_CURRENT_SOURCE_DIR}/extern/sdlew/include/SDL2") set(SDL_LIBRARY) - set(SDL_LIBRARY_TEMP) else() - find_package_wrapper(SDL) + find_package_wrapper(SDL2) + if(SDL2_FOUND) + # Use same names for both versions of SDL until we move to 2.x. + set(SDL_INCLUDE_DIR "${SDL2_INCLUDE_DIR}") + set(SDL_LIBRARY "${SDL2_LIBRARY}") + set(SDL_FOUND "${SDL2_FOUND}") + else() + find_package_wrapper(SDL) + endif() mark_as_advanced( - SDLMAIN_LIBRARY SDL_INCLUDE_DIR SDL_LIBRARY - SDL_LIBRARY_TEMP ) # unset(SDLMAIN_LIBRARY CACHE) if(NOT SDL_FOUND) |