Preprocessor configuration
The preprocessor plays a huge role in the process of building. Maybe this is a little surprising, given how simple and limited its functionality is. In following sections, we'll cover providing paths to included files and using the preprocessor definitions. We'll also explain how we can use CMake to configure included headers.
Providing paths to included files
The most basic feature of the preprocessor is the ability to include .h
/.hpp
header files with the #include
directive. It comes in two forms:
#include <path-spec>
: Angle-bracket form#include "path-spec"
: Quoted form
As we know, the preprocessor will replace these directives with the contents of the file specified in path-spec
. Finding these files may be an issue. Which directories do we search and in what order? Unfortunately, the C++ standard doesn't exactly specify that; we need to check the manual for the compiler we use.
Typically, the...