From 2a957ab650f5d29374f6f406a6a843ebca4b50ba Mon Sep 17 00:00:00 2001 From: Denis Arnst Date: Tue, 20 Feb 2024 21:20:15 +0100 Subject: [PATCH] Add VACopy check... --- CMakeLists.txt | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) diff --git a/CMakeLists.txt b/CMakeLists.txt index 24c5c81..1c68a5b 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -56,6 +56,40 @@ configure_file( @ONLY ) +# ------------------------------------------------------------------------------ +# VA Copy check for asprintf +# ------------------------------------------------------------------------------ + +# Check for va_copy +include(CheckCSourceCompiles) + +check_c_source_compiles(" +#include +int main() { + va_list x, y; + va_copy(x, y); + return 0; +} +" HAVE_VA_COPY) + +if(HAVE_VA_COPY) + add_definitions(-DHAVE_VA_COPY=1) +endif() + +# Check for __va_copy +check_c_source_compiles(" +#include +int main() { + va_list x, y; + __va_copy(x, y); + return 0; +} +" HAVE___VA_COPY) + +if(HAVE___VA_COPY) + add_definitions(-DHAVE___VA_COPY=1) +endif() + # ------------------------------------------------------------------------------ # Clang format # ------------------------------------------------------------------------------