Add manual CMAKE_C_BYTE_ORDER set for old CMake

This commit is contained in:
Dmitry Ilyin 2022-09-26 11:54:14 +03:00 committed by Azat Khuzhin
parent ceb6bcd68a
commit 211c6653ae

View File

@ -972,6 +972,15 @@ set(SRC_EXTRA
sha1.c sha1.c
evrpc.c) evrpc.c)
if("${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION}" LESS 3.20)
include(TestBigEndian)
TEST_BIG_ENDIAN(IS_BIG_ENDIAN)
if(IS_BIG_ENDIAN)
set(CMAKE_C_BYTE_ORDER BIG_ENDIAN)
else()
set(CMAKE_C_BYTE_ORDER LITTLE_ENDIAN)
endif()
endif()
set_source_files_properties(sha1.c PROPERTIES COMPILE_FLAGS set_source_files_properties(sha1.c PROPERTIES COMPILE_FLAGS
-D${CMAKE_C_BYTE_ORDER}=1) -D${CMAKE_C_BYTE_ORDER}=1)
add_definitions(-DHAVE_CONFIG_H) add_definitions(-DHAVE_CONFIG_H)