Thanks; that confirmed my suspicion that it wasn’t linking to gcov in the tests. The current workaround is placing:
set(CMAKE_REQUIRED_LIBRARIES gcov)
right before the check_fortran_compiler_flag()
calls for --coverage
and -fprofile-arcs
then call unset(CMAKE_REQUIRED_LIBRARIES)
.
This seems like good variable hygiene; my project typically uses target_link_libraries()
and I otherwise don’t use CMAKE_REQUIRED_LIBRARIES
. Is this liable to break anything else?
FWIW, diggging down to Internal/CheckSourceCompiles.cmake
let me see what was going on. Setting CMAKE_REQUIRED_LIBRARIES
seemed like the least worst option.