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 # ------------------------------------------------------------------------------