This repository has been archived on 2023-06-25. You can view files and clone it, but cannot push or open issues or pull requests.
mine-sweep-SDL2/cmake/utility.cmake

37 lines
1.2 KiB
CMake
Raw Normal View History

2023-06-24 18:38:24 +08:00
function(IsMSVCBackend RETURN_VALUE)
if (CMAKE_CXX_COMPILER_ID MATCHES "MSVC" OR
(CMAKE_CXX_COMPILER_ID MATCHES "Clang" AND
CMAKE_CXX_COMPILER_FRONTEND_VARIANT MATCHES "MSVC"))
set(${RETURN_VALUE} 1 PARENT_SCOPE)
else()
set(${RETURN_VALUE} 0 PARENT_SCOPE)
endif()
endfunction()
function(IsMinGWBackend RETURN_VALUE)
if (CMAKE_CXX_COMPILER_ID MATCHES "GNU" OR
(CMAKE_CXX_COMPILER_ID MATCHES "Clang" AND
CMAKE_CXX_COMPILER_FRONTEND_VARIANT MATCHES "GNU" AND WIN32)) # use MINGW
set(${RETURN_VALUE} 1 PARENT_SCOPE)
else()
set(${RETURN_VALUE} 0 PARENT_SCOPE)
endif()
endfunction()
function(IsGNUBackend RETURN_VALUE)
if (CMAKE_CXX_COMPILER_ID MATCHES "GNU" OR
(CMAKE_CXX_COMPILER_ID MATCHES "Clang" AND
CMAKE_CXX_COMPILER_FRONTEND_VARIANT MATCHES "GNU" AND (UNIX OR APPLE))) # use GNU G++
set(${RETURN_VALUE} 1 PARENT_SCOPE)
else()
set(${RETURN_VALUE} 0 PARENT_SCOPE)
endif()
endfunction()
function(IsX64Compiler RETURN_VALUE)
if (CMAKE_SIZEOF_VOID_P EQUAL 8)
set(${RETURN_VALUE} 1 PARENT_SCOPE)
else()
set(${RETURN_VALUE} 0 PARENT_SCOPE)
endif()
endfunction()