diff --git a/CMakeLists.txt b/CMakeLists.txt index f28442595..263d34ebf 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -220,7 +220,9 @@ configure_file(${CONFIG_HEADER_TEMPLATE} if (NOT CMAKE_CROSSCOMPILING) include(CTest) - add_subdirectory(tests) + if (BUILD_TESTING) + add_subdirectory(tests) + endif() endif() include(CPackConfig) diff --git a/cmake/AwsFeatureTests.cmake b/cmake/AwsFeatureTests.cmake index 9d4915f31..9f34fa887 100644 --- a/cmake/AwsFeatureTests.cmake +++ b/cmake/AwsFeatureTests.cmake @@ -44,3 +44,8 @@ int main() { __asm__ __volatile__(\"\":\"=r\"(foo):\"r\"(bar):\"memory\"); }" AWS_HAVE_GCC_INLINE_ASM) +check_c_source_compiles(" +#include +int main() { + return 0; +}" AWS_HAS_EXECINFO) diff --git a/include/aws/testing/aws_test_harness.h b/include/aws/testing/aws_test_harness.h index 74e8bc62b..d829988ab 100644 --- a/include/aws/testing/aws_test_harness.h +++ b/include/aws/testing/aws_test_harness.h @@ -444,7 +444,7 @@ static LONG WINAPI s_test_print_stack_trace(struct _EXCEPTION_POINTERS *exceptio } return EXCEPTION_EXECUTE_HANDLER; } -#elif !defined __ANDROID__ +#elif AWS_HAS_EXECINFO # include # include @@ -474,7 +474,7 @@ static inline int s_aws_run_test_case(struct aws_test_harness *harness) { #ifdef _WIN32 SetUnhandledExceptionFilter(s_test_print_stack_trace); -#elif !defined __ANDROID__ +#elif AWS_HAS_EXECINFO struct sigaction sa; memset(&sa, 0, sizeof(struct sigaction)); sigemptyset(&sa.sa_mask);