Commit a0dae601 authored by Tom Finegan's avatar Tom Finegan

Expand cmake inline detection.

Check for __inline in addition to inline. The latter version is
preferred.

BUG=https://bugs.chromium.org/p/aomedia/issues/detail?id=76

Change-Id: I473f29374315c904ddd4f058313b50e8883f1b03
parent 44f7c836
......@@ -105,11 +105,8 @@ else ()
endif ()
# Test compiler support.
aom_check_source_compiles("inline_check" "static inline void function(void) {}"
HAVE_INLINE)
if (HAVE_INLINE EQUAL 1)
set(INLINE "inline")
endif ()
aom_get_inline("INLINE")
# TODO(tomfinegan): aom_ports_check is legacy; HAVE_AOM_PORTS is not used
# anywhere in the aom sources. To be removed after parity with the legacy
# build system stops being important.
......
......@@ -103,3 +103,23 @@ function(aom_check_source_compiles test_name test_source result_var)
set(${result_var} 0 PARENT_SCOPE)
endif ()
endfunction ()
# When inline support is detected for the current compiler the supported
# inlining keyword is written to $result in caller scope.
function (aom_get_inline result)
aom_check_source_compiles("inline_check_1"
"static inline void function(void) {}"
HAVE_INLINE_1)
if (HAVE_INLINE_1 EQUAL 1)
set(${result} "inline" PARENT_SCOPE)
return()
endif ()
# Check __inline.
aom_check_source_compiles("inline_check_2"
"static __inline void function(void) {}"
HAVE_INLINE_2)
if (HAVE_INLINE_2 EQUAL 1)
set(${result} "__inline" PARENT_SCOPE)
endif ()
endfunction ()
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment