Skip to content

Commit

Permalink
fix cmake configure with xcode 14 for ios
Browse files Browse the repository at this point in the history
  • Loading branch information
DoDoENT committed Aug 22, 2022
1 parent 26caa92 commit 8d2556e
Showing 1 changed file with 19 additions and 10 deletions.
29 changes: 19 additions & 10 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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()
Expand Down

0 comments on commit 8d2556e

Please sign in to comment.