mirror of
https://github.com/neovim/neovim
synced 2025-07-15 16:51:49 +00:00
build: various cmake fixes
- silence false warnings on MSVC - merge `clang-tidy` cmake target into `lintc` and remove the corresponding make target - use cmake's built-in endianness detection
This commit is contained in:
@ -4,6 +4,7 @@ include(CheckFunctionExists)
|
||||
include(CheckIncludeFiles)
|
||||
include(CheckCSourceRuns)
|
||||
include(CheckCSourceCompiles)
|
||||
include(TestBigEndian)
|
||||
|
||||
check_c_source_compiles("
|
||||
#include <execinfo.h>
|
||||
@ -130,31 +131,8 @@ endif()
|
||||
if("${HAVE_BE64TOH_MACROS}" OR "${HAVE_BE64TOH_FUNC}")
|
||||
set(HAVE_BE64TOH 1)
|
||||
endif()
|
||||
if (NOT "${HAVE_BE64TOH}")
|
||||
if (NOT "${CMAKE_CROSSCOMPILING}")
|
||||
# It is safe to make ORDER_BIG_ENDIAN not defined if
|
||||
# - HAVE_BE64TOH is true. In this case be64toh will be used unconditionally in
|
||||
# any case and ORDER_BIG_ENDIAN will not be examined.
|
||||
# - CMAKE_CROSSCOMPILING *and* HAVE_BE64TOH are both false. In this case
|
||||
# be64toh function which uses cycle and arithmetic operations is used which
|
||||
# will work regardless of endianness. Function is sub-optimal though.
|
||||
check_c_source_runs("
|
||||
${SI}
|
||||
${MS}
|
||||
char *s = (char *) &i;
|
||||
return (
|
||||
s[0] == 0x01
|
||||
&& s[1] == 0x02
|
||||
&& s[2] == 0x03
|
||||
&& s[3] == 0x04
|
||||
&& s[4] == 0x05
|
||||
&& s[5] == 0x06
|
||||
&& s[6] == 0x07
|
||||
&& s[7] == 0x08) ? 0 : 1;
|
||||
${ME}"
|
||||
ORDER_BIG_ENDIAN)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
test_big_endian(ORDER_BIG_ENDIAN)
|
||||
|
||||
configure_file (
|
||||
"${PROJECT_SOURCE_DIR}/cmake.config/config.h.in"
|
||||
|
Reference in New Issue
Block a user