diff --git a/AWSCRTAndroidTestRunner/app/src/main/cpp/CMakeLists.txt b/AWSCRTAndroidTestRunner/app/src/main/cpp/CMakeLists.txt index 63b82ecf9..9a91baba4 100644 --- a/AWSCRTAndroidTestRunner/app/src/main/cpp/CMakeLists.txt +++ b/AWSCRTAndroidTestRunner/app/src/main/cpp/CMakeLists.txt @@ -3,7 +3,7 @@ # Sets the minimum version of CMake required to build the native library. -cmake_minimum_required(VERSION 3.13) +cmake_minimum_required(VERSION 3.9) # AWS lib set(path_to_common "${CMAKE_CURRENT_LIST_DIR}/../../../../..") diff --git a/CMakeLists.txt b/CMakeLists.txt index cbdca2e05..cb3f28504 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -8,6 +8,10 @@ project(aws-c-common LANGUAGES C VERSION 0.1.0) message(STATUS "CMake ${CMAKE_VERSION}") +if (POLICY CMP0077) + cmake_policy(SET CMP0077 OLD) # Enable options to get their values from normal variables +endif() + list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake") include(AwsCFlags) include(AwsCheckHeaders) diff --git a/cmake/AwsTestHarness.cmake b/cmake/AwsTestHarness.cmake index 69129a3d8..a63ad61a7 100644 --- a/cmake/AwsTestHarness.cmake +++ b/cmake/AwsTestHarness.cmake @@ -39,6 +39,16 @@ function(generate_test_driver driver_exe_name) add_executable(${driver_exe_name} ${CMAKE_CURRENT_BINARY_DIR}/test_runner.c ${TESTS}) aws_set_common_properties(${driver_exe_name} NO_WEXTRA NO_PEDANTIC) + # Some versions of CMake (3.9-3.11) generate a test_runner.c file with + # a strncpy() call that triggers the "stringop-overflow" warning in GCC 8.1+ + # This warning doesn't exist until GCC 7 though, so test for it before disabling. + if (NOT MSVC) + check_c_compiler_flag(-Wno-stringop-overflow HAS_WNO_STRINGOP_OVERFLOW) + if (HAS_WNO_STRINGOP_OVERFLOW) + SET_SOURCE_FILES_PROPERTIES(test_runner.c PROPERTIES COMPILE_FLAGS -Wno-stringop-overflow) + endif() + endif() + aws_add_sanitizers(${driver_exe_name} ${${PROJECT_NAME}_SANITIZERS}) target_link_libraries(${driver_exe_name} PRIVATE ${PROJECT_NAME})