Skip to content

Commit

Permalink
Add manual CMAKE_C_BYTE_ORDER set for old CMake
Browse files Browse the repository at this point in the history
  • Loading branch information
widgetii authored and azat committed Sep 26, 2022
1 parent ceb6bcd commit 211c665
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -972,6 +972,15 @@ set(SRC_EXTRA
sha1.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
-D${CMAKE_C_BYTE_ORDER}=1)
add_definitions(-DHAVE_CONFIG_H)
Expand Down

0 comments on commit 211c665

Please sign in to comment.