arsdever/qspdlog

BUILD_COVERAGE doesn't work out-of-the box on Ubuntu 22.10 with gcc 12.2.0

Overflwn opened this issue · 2 comments

I'm running Ubuntu 22.10 with qt6-base and libspdlog-dev installed, running cmake .. -DBUILD_TESTING=ON -DBUILD_COVERAGE=ON runs fine, but running make afterwards (gcc version 12.2.0 (Ubuntu 12.2.0-3ubuntu1) ) returns

[  0%] Built target qspdlog_interface
[  5%] Automatic MOC and UIC for target qspdlog_lib
[  5%] Built target qspdlog_lib_autogen
[ 11%] Automatic RCC for qspdlog_resources.qrc
[ 16%] Building CXX object src/CMakeFiles/qspdlog_lib.dir/qspdlog_lib_autogen/mocs_compilation.cpp.o
c++: error: unrecognized command-line option ‘-fprofile-instr-generate’; did you mean ‘-fprofile-generate’?
c++: error: unrecognized command-line option ‘-fcoverage-mapping’
make[2]: *** [src/CMakeFiles/qspdlog_lib.dir/build.make:88: src/CMakeFiles/qspdlog_lib.dir/qspdlog_lib_autogen/mocs_compilation.cpp.o] Fehler 1
make[1]: *** [CMakeFiles/Makefile2:182: src/CMakeFiles/qspdlog_lib.dir/all] Fehler 2
make: *** [Makefile:101: all] Fehler 2

Originally posted by @Overflwn in #32 (comment)

I haven't built it with gcc. Actually, I'm not sure if I will consider supporting gcc. Probably will update the readme to let the devs know that they should use clang (at least until I consider adapting to gcc).

You're right. Using clang works just fine. I think gcc supports code coverage flags too, they're just called differently.