-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Support relative includes through the parent directory
- Loading branch information
Showing
10 changed files
with
36 additions
and
14 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,17 @@ | ||
#ifndef FOO_H | ||
#define FOO_H | ||
|
||
// normal relative include to file in same directory | ||
#include "bar.h" | ||
// Enter parent directory and descend again into current directory | ||
#include "../dir/bar.h" | ||
// Relative include to a file in another directory | ||
#include "../dir2/baz.h" | ||
// Example for complex relative path | ||
#include "../../sub/dir2/../dir/bar.h" | ||
|
||
inline int doFoo() { | ||
return doBar() + 13; | ||
return doBar() + doBaz(); | ||
} | ||
|
||
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
#ifndef BAZ_H | ||
#define BAZ_H | ||
|
||
inline int doBaz() { | ||
return 1; | ||
} | ||
|
||
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,8 @@ | ||
// relative includes to headers from dependencies | ||
#include "normal_include.h" | ||
#include "some/sub/dir/foo.h" | ||
#include "some/sub/dir/../dir2/baz.h" | ||
|
||
int main() { | ||
return useNormalInclude() + doBar(); | ||
return useNormalInclude() + doBar() + doBaz(); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,10 @@ | ||
// relatively including header from own target | ||
#include "system_include.h" | ||
#include "some/sub/dir/foo.h" | ||
#include "some/sub/dir/../dir2/baz.h" | ||
// include from virtually prefixed path | ||
#include <sub/dir/bar.h> | ||
|
||
int main() { | ||
return useSystemInclude() + doBar(); | ||
return useSystemInclude() + doBar() + doBaz(); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,10 @@ | ||
// relatively including header from own target | ||
#include "virtual_prefix.h" | ||
#include "some/sub/dir/bar.h" | ||
#include "some/sub/dir/../dir2/baz.h" | ||
// include from virtually prefixed path | ||
#include "custom/prefix/some/sub/dir/foo.h" | ||
|
||
int main() { | ||
return useVirtualPrefix() + doBar(); | ||
return useVirtualPrefix() + doBar() + doBaz(); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,10 @@ | ||
// relatively including header from own target | ||
#include "some/virtual_strip.h" | ||
#include "some/sub/dir/bar.h" | ||
#include "some/sub/dir/../dir2/baz.h" | ||
// include from virtually stripped path | ||
#include "sub/dir/foo.h" | ||
|
||
int main() { | ||
return useVirtualStrip() + doBar(); | ||
return useVirtualStrip() + doBar() + doBaz(); | ||
} |