From 93689f40ddad1f4597611c7c40ee8a33a0ba671c Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Fri, 30 Dec 2022 00:39:23 -0500 Subject: [PATCH] fix compiler flags issue on Ubuntu18.04 --- unittest/CMakeLists.txt | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/unittest/CMakeLists.txt b/unittest/CMakeLists.txt index 9819a53e10..45501d92ae 100644 --- a/unittest/CMakeLists.txt +++ b/unittest/CMakeLists.txt @@ -34,6 +34,14 @@ foreach(_FLAG ${CMAKE_TUNE_FLAGS}) add_compile_options(${_FLAG}) endforeach() +# must repeat handling coverage for older CMake +if((CMAKE_CXX_COMPILER_ID STREQUAL "GNU") AND ENABLE_COVERAGE) + if(CMAKE_VERSION VERSION_LESS 3.13) + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} --coverage") + else() + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_${CMAKE_BUILD_TYPE}_FLAGS} --coverage") + endif() +endif() ######################################## # General tests using the LAMMPS executable itself