moved BUILD_TESTS check outside of root cmake check to allow building tests in submodules (#777)

added check for GNUC >= 11 for -Wstringop-overread ignore pragma since it isn't introduced until gcc/g++-11

Co-authored-by: Josh <joshua.martens@magna.com>
This commit is contained in:
jmartens-42 2023-10-26 14:07:23 -04:00 committed by GitHub
parent 85f2e09ef7
commit 13759c1cbb
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 10 additions and 9 deletions

View File

@ -73,9 +73,10 @@ if(${CMAKE_PROJECT_NAME} STREQUAL ${PROJECT_NAME})
"${PROJECT_BINARY_DIR}/${PROJECT_NAME}ConfigVersion.cmake"
DESTINATION ${CMAKE_INSTALL_DATAROOTDIR}/${PROJECT_NAME}/cmake)
install(DIRECTORY ${PROJECT_SOURCE_DIR}/include/etl DESTINATION include)
if (BUILD_TESTS)
enable_testing()
add_subdirectory(test)
endif()
endif()
if (BUILD_TESTS)
enable_testing()
add_subdirectory(test)
endif()

View File

@ -33,11 +33,11 @@ SOFTWARE.
* This file is intended to evaluated multiple times by design.
*/
#if defined(__GNUC__) && !defined(__clang__) && !defined(__llvm__)
#pragma GCC diagnostic push
#if defined(__GNUC__) && (__GNUC__ >= 11) && !defined(__clang__) && !defined(__llvm__)
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wstringop-overread"
#endif
#if defined(__clang__) || defined(__llvm__)
#pragma clang diagnostic push
#endif
#pragma clang diagnostic push
#endif