Is there a concept like include directory aliases?
c++, cmake, cross-platform, include, project
Solution
No; the nearest approach is a collection of `-I` options on the command line.
Further, if you use SFML, the recommended notation is `#include "SFML/System.hpp"`; that's what you should write in your code. Then you fix the compilation environment so that `-Idependencies/sfml/include` is included in the compilation, or you use symlinks (if they're portable enough) to manufacture sub-directories like `SFML` in the main directory that contains your project's headers.
When software packages like SFML are installed, the headers will be placed into a directory — normally `/usr/local/include` by default, and usually in a sub-directory under there. That is, there would be a directory `/usr/local/include/SFML` which would contain the SFML headers. The chances are the same is true of other software packages. You should install these headers in some location under your build area so that the headers can be found as normal — you'll simply specify the base `include` directory under which the headers are found. (Note: when you install the Bullet Physics library, the headers are placed into a directory `.../include/bullet` with various sub-directories underneath that, so it too follows this convention.)
Doing otherwise means fighting the system, and when you fight the system, you end up losing. It is harder work than simply going with the flow.
Problem
In a cross-platform project I make use of many third party libraries. I finally decided to include their source into my repository, to not need to download them again on every platform. This is is allowed by the licences. To include headers from those libraries, I need to specify their file paths. Some libraries have them in `name/include/name/file.h` but generally, every library comes with a different directory structure. I would like to include the headers in my code always in the form `#include "name/file.h"` where name is the name of the library. But I neither want to modify the directory structure of the libraries nor copy all headers into include directory of my desired structure. Is there a way to define something like include directory aliases? For example, Bullet Physics has its headers in `bullet/src`, Sqlite has its headers directly in `sqlite` and SFML has them in `sfml/include/SFML`. I would like to specify something like this: ``` #alias "dependencies/bullet/src" "bullet" #alias "dependencies/sqlite" "sqlite" #alias "dependencies/sfml/include/SFML" "sfml" ``` So that `#include "sfml/System.hpp"` becomes equivalend to `#include "dependencies/sfml/include/SFML/System.hpp"`. The technique doesn't have to be in preprocessor stage. It could also be a CMake flag to generate projects in the right way, for example. However, I think compilers must be aware of this technique somehow, to make this possible.