diff --git a/CMakeLists.txt b/CMakeLists.txt index 1a0b2012e..64f9664bd 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -419,8 +419,12 @@ else() endif() if(SIZE_T EQUAL UNSIGNED_LONG) - check_c_source_compiles("int main(int argc, char **argv) { unsigned long a = argc; return __builtin_ctzl(a); }" - HAVE_BUILTIN_CTZL) + if ( XCODE ) + set( HAVE_BUILTIN_CTZL ON ) + else() + check_c_source_compiles("int main(int argc, char **argv) { unsigned long a = argc; return __builtin_ctzl(a); }" + HAVE_BUILTIN_CTZL) + endif() endif() if(MSVC) check_include_files("intrin.h" HAVE_INTRIN_H) @@ -468,14 +472,19 @@ if(FORCE_INLINE) list(INSERT INLINE_OPTIONS 0 "__inline__ __attribute__((always_inline))") endif() endif() -foreach(inline ${INLINE_OPTIONS}) - check_c_source_compiles("${inline} static int foo(void) { return 0; } int main(void) { return foo(); }" - INLINE_WORKS) - if(INLINE_WORKS) - set(INLINE ${inline}) - break() - endif() -endforeach() +if ( NOT XCODE ) + foreach(inline ${INLINE_OPTIONS}) + check_c_source_compiles("${inline} static int foo(void) { return 0; } int main(void) { return foo(); }" + INLINE_WORKS) + if(INLINE_WORKS) + set(INLINE ${inline}) + break() + endif() + endforeach() +else() + set( INLINE_WORKS ON ) + set( INLINE "inline" ) +endif() if(NOT INLINE_WORKS) message(FATAL_ERROR "Could not determine how to inline functions.") endif()