cmake_minimum_required(VERSION 3.0)
project(DarkRP2D_TEST_CLIENT)
set (CMAKE_CXX_STANDARD 11)
include(ExternalProject)

if(NOT CMAKE_BUILD_TYPE) 
    set(CMAKE_BUILD_TYPE RELEASE)
	add_definitions(-DNDEBUG)
endif(NOT CMAKE_BUILD_TYPE)

MESSAGE( STATUS "PROJECT_SOURCE_DIR: " ${PROJECT_SOURCE_DIR} )
MESSAGE( STATUS "DarkRP2D_TEST_CLIENT_SOURCE_DIR: " ${DarkRP2D_TEST_CLIENT_SOURCE_DIR} )

set(DarkRP2D_EXTERNAL_DIR ${DarkRP2D_TEST_CLIENT_SOURCE_DIR}/../external)
set(SDL2_net_DIR ${DarkRP2D_EXTERNAL_DIR}/SDL2_net-2.0.1)
set(SDL2_DIR ${DarkRP2D_EXTERNAL_DIR}/SDL2-2.0.8)

#Libs

find_package(SDL2 REQUIRED CONFIG)
include_directories(${SDL2_INCLUDE_DIRS})

find_package(SDL2_net REQUIRED CONFIG)
include_directories(${SDL2_NET_INCLUDE_DIRS})

MESSAGE( STATUS "SDL2 Lib: " ${SDL2_LIBRARIES}  )
MESSAGE( STATUS "SDL2_NET Lib: " ${SDL2_NET_LIBRARIES}  )

file(GLOB_RECURSE DarkRP2D_TEST_CLIENT_SOURCE_FILES ${DarkRP2D_TEST_CLIENT_SOURCE_DIR}/src/*.cpp)

add_executable(DarkRP2DTestClient ${DarkRP2D_TEST_CLIENT_SOURCE_FILES})

target_link_libraries(DarkRP2DTestClient   ${SDL2_LIBRARIES} 
                                        ${SDL2_NET_LIBRARIES} )

add_custom_target(CopyBinaries
	COMMAND ${CMAKE_COMMAND} -E copy ${SDL2_DLL} ${CMAKE_BINARY_DIR}
    COMMAND ${CMAKE_COMMAND} -E copy ${SDL2_NET_DLL} ${CMAKE_BINARY_DIR}
)

add_dependencies(DarkRP2DTestClient CopyBinaries)