From 7d5c8eb943f92a94b420568778d61e0bd6f7df43 Mon Sep 17 00:00:00 2001 From: claude-bot Date: Mon, 13 Jul 2026 12:40:01 +0000 Subject: Import xiph/opus @ 034c1b61a250457649d788bbf983b3f0fb63f02e Snapshot for re3/reVC vendoring, per @lzcnt. Source: https://github.com/xiph/opus (034c1b61a250457649d788bbf983b3f0fb63f02e). --- cmake/CFeatureCheck.cmake | 39 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 39 insertions(+) create mode 100644 cmake/CFeatureCheck.cmake (limited to 'cmake/CFeatureCheck.cmake') diff --git a/cmake/CFeatureCheck.cmake b/cmake/CFeatureCheck.cmake new file mode 100644 index 0000000..08828f5 --- /dev/null +++ b/cmake/CFeatureCheck.cmake @@ -0,0 +1,39 @@ +# - Compile and run code to check for C features +# +# This functions compiles a source file under the `cmake` folder +# and adds the corresponding `HAVE_[FILENAME]` flag to the CMake +# environment +# +# c_feature_check( []) +# +# - Example +# +# include(CFeatureCheck) +# c_feature_check(VLA) + +if(__c_feature_check) + return() +endif() +set(__c_feature_check INCLUDED) + +function(c_feature_check FILE) + string(TOLOWER ${FILE} FILE) + string(TOUPPER ${FILE} VAR) + string(TOUPPER "${VAR}_SUPPORTED" FEATURE) + if (DEFINED ${VAR}_SUPPORTED) + set(${VAR}_SUPPORTED 1 PARENT_SCOPE) + return() + endif() + + if (NOT DEFINED COMPILE_${FEATURE}) + message(STATUS "Performing Test ${FEATURE}") + try_compile(COMPILE_${FEATURE} ${PROJECT_BINARY_DIR} ${PROJECT_SOURCE_DIR}/cmake/${FILE}.c) + endif() + + if(COMPILE_${FEATURE}) + message(STATUS "Performing Test ${FEATURE} -- success") + set(${VAR}_SUPPORTED 1 PARENT_SCOPE) + else() + message(STATUS "Performing Test ${FEATURE} -- failed to compile") + endif() +endfunction() -- cgit v1.2.3