Is there such a concept as turning on directory aliases?

In a cross-platform project, I use many third-party libraries. Finally, I decided to include their source in my repository so as not to download them again on each platform. This is permitted by licenses.

To include headers from these libraries, I need to specify their file paths. Some libraries have them in name/include/name/file.h, but, as a rule, each library has a different directory structure.

I would like to include headers in my code always in the form #include "name/file.h"where name is the name of the library. But I do not want to change the directory structure of the libraries and not copy all the headers into the 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 it sfml/include/SFML. I would like to point out something like this:

#alias "dependencies/bullet/src" "bullet"
#alias "dependencies/sqlite" "sqlite"
#alias "dependencies/sfml/include/SFML" "sfml"

So, #include "sfml/System.hpp"it becomes equivalent #include "dependencies/sfml/include/SFML/System.hpp".

The technique should not be at the preprocessor stage. For example, it could be a CMake flag for creating projects, for example. However, I think that compilers must somehow be aware of this technique in order to make this possible.

+3
source share
2 answers

No; the closest approach is a set of options -Ion the command line.

, SFML, #include "SFML/System.hpp"; . , -Idependencies/sfml/include , ( ) , SFML , .

, SFML, - /usr/local/include . , /usr/local/include/SFML, SFML. , . - , - include, . (: Bullet Physics library .../include/bullet , .)

, , . , .

+5

- "".

:

  • Symlinks - "myincludes", , .
  • -I .
  • ( #include " ", )
  • .
  • , .

" ". -, / , , , , , , , .

+4

All Articles