CMakeLists.txt 1.5 KB

1234567891011121314151617181920212223242526272829303132333435
  1. option(SDL2_DISABLE_SDL2MAIN "" ON)
  2. option(SDL2_DISABLE_INSTALL "" ON)
  3. option(SDL2_DISABLE_UNINSTALL "" ON)
  4. option(SDL_SHARED "Build a shared version of the library" OFF)
  5. option(SDL_SHARED_ENABLED_BY_DEFAULT "" OFF)
  6. option(SDL_STATIC "Build a static version of the library" ON)
  7. option(SDL_STATIC_ENABLED_BY_DEFAULT "" ON)
  8. option(SDL_TEST "Build the SDL2_test library" OFF)
  9. option(SDL_TEST_ENABLED_BY_DEFAULT "" OFF)
  10. # SDL fails to clean up old headers after version upgrades, so do that manually
  11. set(EXPECTED_SDL_REVISION "SDL-release-2.30.6-0")
  12. if (EXISTS "${CMAKE_CURRENT_BINARY_DIR}/SDL/include/SDL2/SDL_revision.h")
  13. file(READ "${CMAKE_CURRENT_BINARY_DIR}/SDL/include/SDL2/SDL_revision.h" ACTUAL_SDL_REVISION)
  14. if (NOT "${ACTUAL_SDL_REVISION}" MATCHES "${EXPECTED_SDL_REVISION}")
  15. message(STATUS "Found unexpected SDL2/SDL_revision.h, removing generated includes.")
  16. file(REMOVE_RECURSE "${CMAKE_CURRENT_BINARY_DIR}/SDL/include/")
  17. endif()
  18. endif()
  19. if (EXISTS "${CMAKE_CURRENT_BINARY_DIR}/SDL/include/SDL_revision.h")
  20. file(READ "${CMAKE_CURRENT_BINARY_DIR}/SDL/include/SDL_revision.h" ACTUAL_SDL_REVISION)
  21. if (NOT "${ACTUAL_SDL_REVISION}" MATCHES "${EXPECTED_SDL_REVISION}")
  22. message(STATUS "Found unexpected SDL_revision.h, removing generated includes.")
  23. file(REMOVE_RECURSE "${CMAKE_CURRENT_BINARY_DIR}/SDL/include/")
  24. endif()
  25. endif()
  26. add_subdirectory(SDL)
  27. if (TARGET SDL2)
  28. dolphin_disable_warnings(SDL2)
  29. endif()
  30. if (TARGET SDL2-static)
  31. dolphin_disable_warnings(SDL2-static)
  32. endif()