Skip to content
This repository has been archived by the owner on Dec 26, 2023. It is now read-only.

Consider using INTERFACE_SYSTEM_INCLUDE_DIRECTORIES #167

Open
sebrockm opened this issue Feb 7, 2023 · 0 comments
Open

Consider using INTERFACE_SYSTEM_INCLUDE_DIRECTORIES #167

sebrockm opened this issue Feb 7, 2023 · 0 comments

Comments

@sebrockm
Copy link

sebrockm commented Feb 7, 2023

In CMake, when declaring the include directories, consider adding the SYSTEM keyword.
This will make CMake create compile commands like this

/usr/bin/clang++ ... -isystem [...]/robin-hood-hashing/src/include  -isystem /usr/local/include ...

instead of this

/usr/bin/clang++  -I[...]/robin-hood-hashing/src/include -isystem /usr/local/include

The effect is that the compiler is not supposed to issue warnings from these files, just like it doesn't for system libraries, hence the name. See also the CMake docs on this topic.

Background

This library has an awesome amount of warnings enabled. For the users of this library that means that they can usually also have a pretty high warning level enabled and treat warnings as errors. However, once in a while there is a warning generated in the robin_hood.h header. The most recent example was caused by a compiler update and also affected us. Of course, it is great that it was fixed so quickly. But still, if it didn't have effected us in the first place, that would have been even better. As a temporary solution I added the SYSTEM keyword to robin hood's CMakeLists.txt locally and it worked as expected.

Possible downsides

If users are not receiving any warnings anymore from your header, they won't report them either. If this is an issue, maybe SYSTEM could be enabled optionally by a CMake variable?

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant