cmake icon indicating copy to clipboard operation
cmake copied to clipboard

Shouldn't boost headers be marked as system in CMake config?

Open ixSci opened this issue 3 years ago • 2 comments

Right now every boost target provides its headers by setting the following property: INTERFACE_INCLUDE_DIRECTORIES. And there is another property: INTERFACE_SYSTEM_INCLUDE_DIRECTORIES which, I think, should be used as well. I don't know if that should be default or not but I believe it should at least be supported so users can opt-in on boost library being treated as system.

ixSci avatar Apr 11 '22 07:04 ixSci

Please don’t do this. System headers are treated as immutable by compilers and are exempt from dependency/mtime checks. That means an update of your Boost header won’t trigger an automatic rebuild in all cases and you’ll spend a few hours or days tracking down why your build fails even though all the files are checked out correctly.

kkaefer avatar Mar 24 '23 09:03 kkaefer

Compilers do not care about the timestamps. For other tool (like ninja) I don't believe it analyzes whether one passes -I/path/to/headers or -isystem /path/to/headers...

jzakrzewski avatar Apr 03 '23 10:04 jzakrzewski

Marking boosts header as system will allow users to increase the compiler warning level for their projects code and not get flood with warnings cause by boost system headers. This would be very useful.

tastyherring avatar Jul 14 '24 07:07 tastyherring

IMPORTED targets always use SYSTEM for their includes by default, even for the INTERFACE_INCLUDE_DIRECTORIES property.

See https://cmake.org/cmake/help/latest/prop_tgt/NO_SYSTEM_FROM_IMPORTED.html

pdimov avatar Jul 14 '24 08:07 pdimov

IMPORTED targets always use SYSTEM for their includes by default, even for the INTERFACE_INCLUDE_DIRECTORIES property.

See https://cmake.org/cmake/help/latest/prop_tgt/NO_SYSTEM_FROM_IMPORTED.html

Very good find, thank you! So this issue makes no sense and should be closed, then. Nice of CMake to have this information buried somewhere you can't easily find but what can you do.

ixSci avatar Jul 15 '24 06:07 ixSci