aboutsummaryrefslogtreecommitdiff
path: root/test cases
diff options
context:
space:
mode:
authorCharles Brunet <charles.brunet@optelgroup.com>2023-09-07 14:46:11 -0400
committerEli Schwartz <eschwartz93@gmail.com>2023-09-07 23:38:33 -0400
commit204fe3c5772f3f6ec9583fb9216412a4eb6018b9 (patch)
tree7a5d1ce1e839f0da2001b56442edf4a8d0ab03d3 /test cases
parent983562c66e9ee28ce4204d69811cd870e2e1960f (diff)
downloadmeson-204fe3c5772f3f6ec9583fb9216412a4eb6018b9.zip
meson-204fe3c5772f3f6ec9583fb9216412a4eb6018b9.tar.gz
meson-204fe3c5772f3f6ec9583fb9216412a4eb6018b9.tar.bz2
Fix include_directories test for relative path
- On Windows, it was not detected if include directory was an absolute path to source directory, because of the mis of path separators. - In the edgecase the include directory begins with the exact same string as the source directory, but is a different directory, it was falsely reported as an error. Fixes #12217.
Diffstat (limited to 'test cases')
-rw-r--r--test cases/common/18 includedir/meson.build28
-rw-r--r--test cases/common/18 includedirxyz/do_not_delete1
2 files changed, 29 insertions, 0 deletions
diff --git a/test cases/common/18 includedir/meson.build b/test cases/common/18 includedir/meson.build
index 17eec0e..3180587 100644
--- a/test cases/common/18 includedir/meson.build
+++ b/test cases/common/18 includedir/meson.build
@@ -2,3 +2,31 @@ 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')
diff --git a/test cases/common/18 includedirxyz/do_not_delete b/test cases/common/18 includedirxyz/do_not_delete
new file mode 100644
index 0000000..8bd0f88
--- /dev/null
+++ b/test cases/common/18 includedirxyz/do_not_delete
@@ -0,0 +1 @@
+This file is to ensure this directory exists