# ============================================================================== # Platform Detection # ============================================================================== # This module detects the current platform and compiler, setting IS_* variables # that can be used throughout the build system for conditional logic. # # Compiler flags set: # IS_CLANG_OR_GCC - TRUE if using Clang or GCC compiler # IS_MSVC - TRUE if using Microsoft Visual C++ compiler # # Platform flags set: # IS_WINDOWS - TRUE if building for Windows # IS_LINUX - TRUE if building for Linux # IS_MACOS - TRUE if building for macOS # IS_IOS - TRUE if building for iOS # ============================================================================== # ------------------------------------------------------------------------------ # Compiler Detection # ------------------------------------------------------------------------------ set(IS_CLANG_OR_GCC FALSE) set(IS_MSVC FALSE) if(MSVC) set(IS_MSVC TRUE) elseif(CMAKE_CXX_COMPILER_ID MATCHES "Clang|GNU") set(IS_CLANG_OR_GCC TRUE) endif() # ------------------------------------------------------------------------------ # Platform Detection # ------------------------------------------------------------------------------ set(IS_WINDOWS FALSE) set(IS_LINUX FALSE) set(IS_MACOS FALSE) set(IS_IOS FALSE) if(ANDROID) message(FATAL_ERROR "Android is not supported by xone_macos!") elseif(APPLE) if(IOS) message(STATUS "Platform: iOS") set(IS_IOS TRUE) else() message(STATUS "Platform: macOS") set(IS_MACOS TRUE) endif() elseif(WIN32) message(FATAL_ERROR "xone_macos only builds on macOS!") elseif(UNIX) message(FATAL_ERROR "xone_macos only builds on macOS!") else() message(FATAL_ERROR "Unknown platform!") endif()