cmake_minimum_required(VERSION 2.8.11)
project(SGEngine)

# Start with modern standard: C++14, or C++1y if using APPLE
# TODO Better check for C++14 compiler support, and fallback/failure.
if (APPLE)
  set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} --std=c++14")
else()
  set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} --std=c++1y")
endif()

# Automatically download/build External Dependencies
execute_process(
    WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
    COMMAND ./deps.sh
)

# Library Targets
add_subdirectory(External/googletest/googletest)

# Build Targets
add_subdirectory(SGEngine/Sources)
add_subdirectory(SGEngine/Test)

# Example Programs
add_subdirectory(Examples/HelloWorld)

cmake_minimum_required(VERSION 2.8.11)
project(SGEngine)

# Start with modern standard: C++14, or C++1y
include(CheckCXXCompilerFlag)
CHECK_CXX_COMPILER_FLAG("-std=c++14" COMPILER_SUPPORTS_CXX14)
CHECK_CXX_COMPILER_FLAG("-std=c++1y" COMPILER_SUPPORTS_CXX1Y)
if(COMPILER_SUPPORTS_CXX14)
  set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++14")
elseif(COMPILER_SUPPORTS_CXX1Y)
  set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++1y")
else()
  message(FATAL_ERROR "${CMAKE_CXX_COMPILER} has no C++14 support. Please use a different C++ compiler.")
endif()

# Automatically download/build External Dependencies
execute_process(
    WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
    COMMAND ./deps.sh
)

# Library Targets
add_subdirectory(External/googletest/googletest)

# Build Targets
add_subdirectory(SGEngine/Sources)
add_subdirectory(SGEngine/Test)

# Example Programs
add_subdirectory(Examples/HelloWorld)

Add better C++14 check and fail on no support
Add better C++14 check and fail on no support
