cmake_minimum_required(VERSION 3.5)
include(ExternalProject)

set(SDL2_CMAKE_OPTIONS
  -DCMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE}
  -DCMAKE_INSTALL_PREFIX=${ARTIFACT_DIRECTORY}
)

ExternalProject_Add(
  project_sdl2
  PREFIX sdl2
  HG_REPOSITORY http://hg.libsdl.org/SDL
  CMAKE_ARGS ${SDL2_CMAKE_OPTIONS}
  CONFIGURE_COMMAND ./configure --prefix ${ARTIFACT_DIRECTORY}
  SOURCE_DIR "${CMAKE_SOURCE_DIR}/external/SDL2-2.0.5"
  BUILD_COMMAND $(MAKE)
  BUILD_IN_SOURCE 1
  INSTALL_DIR ${ARTIFACT_DIRECTORY}
)
