Catch2 icon indicating copy to clipboard operation
Catch2 copied to clipboard

Clang-tidy diagnostic-error on "catch2/catch_user_config.hpp"

Open GeorgeARM opened this issue 4 years ago • 2 comments

First of all this is not a bug per se. After updating to use v3.0.1 of Catch2 within a project I am hitting an issue around header discoverability with clang-tidy. While running clang-tidy and after having exposed the headers folder to it I get the following diagnostic error:

third_party/Catch2/src/catch2/internal/catch_test_macro_impl.hpp:11:10: error: 'catch2/catch_user_config.hpp' file not found [clang-diagnostic-error]

This mainly comes from the fact that this header is generated (.in file) during compilation. Cannot find an easy way to workaround it without having to build Catch2 and redirect to the generated file which is a bit inconvenient. Any thoughts on if something can be done?

GeorgeARM avatar Jul 13 '22 21:07 GeorgeARM

How are you running clang-tidy?

My understanding is that the recommended way to run it is to give it the compilation database as input, which should in turn contain the correct include paths to make the user config header visible.

horenmar avatar Jul 15 '22 08:07 horenmar

Hey @horenmar,

Yes, before updating to v3 I was able to run it without the need of the compilation database. To conclude, managed to do it by generating the compilation database without any issues hence I will close this issue.

GeorgeARM avatar Jul 15 '22 23:07 GeorgeARM