System Includes

If you have ever asked yourself how to avoid warnings in your c++ projects that are caused by 3rd-party projects like boost “system includes” are the answer. All you need to to is replace the -I flag with -isystem. Of course the CMake offers the same functionality you can use the SYSTEM parameter in functions like target_include_directories or include_directories.

Example:

plain g++: g++ -isystem /path/to/boost -o example example.cpp
CMake: target_include_directories(example SYSTEM /path/to/boost)

Leave a Reply

Your email address will not be published. Required fields are marked *