prboom2/cmake/CheckBigEndian.cmake
raw| 1 | # Sets `outvar` to 1 if the target architecture uses big endian, 0 otherwise. |
| 2 | # TestBigEndian was deprecated in 3.20. |
| 3 | function(check_big_endian outvar) |
| 4 | if(CMAKE_VERSION VERSION_LESS 3.20) |
| 5 | include(TestBigEndian) |
| 6 | test_big_endian(_is_big_endian) |
| 7 | else() |
| 8 | if(CMAKE_C_BYTE_ORDER STREQUAL "BIG_ENDIAN") |
| 9 | set(_is_big_endian 1) |
| 10 | else() |
| 11 | set(_is_big_endian 0) |
| 12 | endif() |
| 13 | endif() |
| 14 | set("${outvar}" |
| 15 | "${_is_big_endian}" |
| 16 | PARENT_SCOPE) |
| 17 | endfunction() |