cmake_minimum_required(VERSION 3.18)
if(${CMAKE_VERSION} VERSION_LESS 3.18)
cmake_policy(VERSION ${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION})
else()
cmake_policy(VERSION 3.18)
endif()

list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake/platforms-toolchain/")

# ------ CROSS-COMPILE CONFIG ------
if(UNIX AND NOT ANDROID AND NOT APPLE AND NOT LINUX)
message(STATUS "Ready for Unix, BSDs...")
set(UNIX TRUE)
include(unix-toolchain)
if(unix-toolchain)
return()
endif()
set(unix-toolchain ON)
elseif(APPLE AND NOT LINUX)
set(APPLE TRUE)
message(STATUS "Ready for Apple Silicon.")
set(MACOSX TRUE)
include(macos-toolchain)
if(macos-toolchain)
  return()
endif()
set(macos-toolchain ON)
elseif(LINUX AND NOT APPLE)
set(LINUX TRUE)
message(STATUS "Ready for LINUX.")
set(LINUX TRUE)
include(linux-toolchain)
if(linux-toolchain)
  return()
endif()
set(linux-toolchain ON)
elseif(WIN32)
set(WINDOWS TRUE)
message(STATUS "Ready for Windows.")
include(windows-toolchain)
if(windows-toolchain)
  return()
endif()
set(windows-toolchain ON)
elseif(ANDROID)
message(STATUS "Ready for Android.")
set(ANDROID TRUE)
include(android-toolchain)
if(android-toolchain)
  return()
endif()
set(android-toolchain ON)
elseif(IOS)
    message(STATUS "Ready for iOS.")
include(ios-toolchain)
if(ios-toolchain)
  return()
endif()
set(ios-toolchain ON)
set(IOS TRUE)
endif()
