diff options
Diffstat (limited to 'cmake')
-rw-r--r-- | cmake/checks.cmake | 44 |
1 files changed, 23 insertions, 21 deletions
diff --git a/cmake/checks.cmake b/cmake/checks.cmake index d42f336..f9f0399 100644 --- a/cmake/checks.cmake +++ b/cmake/checks.cmake @@ -61,31 +61,33 @@ string(COMPARE NOTEQUAL "${SIZEOF_ETHHDR}" "" HAVE_ETHHDR) set(CMAKE_REQUIRED_INCLUDES "sys/types.h") -check_c_source_compiles(" -#include <endian.h> - -int main() { - return 0; -} -" HAVE_ENDIAN_H) - -if(HAVE_ENDIAN_H) - check_symbol_exists("be32toh" "endian.h" HAVE_LINUX_ENDIAN) - -else(HAVE_ENDIAN_H) +if(NOT DARWIN) check_c_source_compiles(" - #include <sys/types.h> - #include <sys/endian.h> + #include <endian.h> int main() { return 0; } - " HAVE_SYS_ENDIAN_H) + " HAVE_ENDIAN_H) + + if(HAVE_ENDIAN_H) + check_symbol_exists("be32toh" "endian.h" HAVE_LINUX_ENDIAN) + + else(HAVE_ENDIAN_H) + check_c_source_compiles(" + #include <sys/types.h> + #include <sys/endian.h> - if(HAVE_SYS_ENDIAN_H) - check_symbol_exists("be32toh" "sys/types.h;sys/endian.h" HAVE_LINUX_ENDIAN) + int main() { + return 0; + } + " HAVE_SYS_ENDIAN_H) - else(HAVE_SYS_ENDIAN_H) - message(FATAL_ERROR "Neither <endian.h> nor <sys/endian.h> found") - endif(HAVE_SYS_ENDIAN_H) -endif(HAVE_ENDIAN_H) + if(HAVE_SYS_ENDIAN_H) + check_symbol_exists("be32toh" "sys/types.h;sys/endian.h" HAVE_LINUX_ENDIAN) + + else(HAVE_SYS_ENDIAN_H) + message(FATAL_ERROR "Neither <endian.h> nor <sys/endian.h> found") + endif(HAVE_SYS_ENDIAN_H) + endif(HAVE_ENDIAN_H) +endif(NOT DARWIN) |