forked from mesonbuild/meson
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Removed include_directories absolute path validation
The 'Tried to form an absolute path to a dir in the source tree' check is a blunt instrument in that it's too simplistic to correctly identify problematic, non-project-relative absolute path use without preventing perfectly good and safe absolute include path use that makes for very clean, maintainable/refactorable build files. Guesing at potential problems and imposing a particular style on meson users, particularly when those problems don't exist in practice, seems like something best avoided. The true arbiter of a problem path is ultimately whether a path actually exists/works; if they work, don't add unnecessary obstacles for the user; if they don't work, the problem and solution should be pretty clear to the user. Discussion on this issue - mesonbuild#12244 mesonbuild#12281
- Loading branch information
Showing
6 changed files
with
27 additions
and
93 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,32 +1,4 @@ | ||
project('include dir test', 'c') | ||
|
||
inc = include_directories('include') | ||
subdir('src') | ||
|
||
errormsg = '''Tried to form an absolute path to a dir in the source tree. | ||
You should not do that but use relative paths instead, for | ||
directories that are part of your project. | ||
To get include path to any directory relative to the current dir do | ||
incdir = include_directories(dirname) | ||
After this incdir will contain both the current source dir as well as the | ||
corresponding build dir. It can then be used in any subdirectory and | ||
Meson will take care of all the busywork to make paths work. | ||
Dirname can even be '.' to mark the current directory. Though you should | ||
remember that the current source and build directories are always | ||
put in the include directories by default so you only need to do | ||
include_directories('.') if you intend to use the result in a | ||
different subdirectory. | ||
Note that this error message can also be triggered by | ||
external dependencies being installed within your source | ||
tree - it's not recommended to do this. | ||
''' | ||
testcase expect_error(errormsg) | ||
include_directories(meson.current_source_dir() / 'include') | ||
endtestcase | ||
# Test for issue #12217 | ||
include_directories(meson.current_source_dir() + 'xyz') | ||
subdir('src') |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.