aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJon Turney <jon.turney@dronecode.org.uk>2020-02-08 18:47:30 +0000
committerJon Turney <jon.turney@dronecode.org.uk>2020-02-12 13:33:05 +0000
commitcfe31d2e9d5a250c4c0314441e9eb21e8ab34935 (patch)
treed70bcd2285711283e1abdf02e5e9d2ebd4f05e8d
parentc5a32c2afe843798d714fc9087bf55ad996b4052 (diff)
downloadmeson-cfe31d2e9d5a250c4c0314441e9eb21e8ab34935.zip
meson-cfe31d2e9d5a250c4c0314441e9eb21e8ab34935.tar.gz
meson-cfe31d2e9d5a250c4c0314441e9eb21e8ab34935.tar.bz2
Add a test that using an unavailable native compiler errors
Add a test that trying to use a native compiler in a target after it's been tentatively added with add_languages() without native: but isn't actually available gives an error.
-rw-r--r--test cases/failing/100 no native compiler/main.c3
-rw-r--r--test cases/failing/100 no native compiler/meson.build12
2 files changed, 15 insertions, 0 deletions
diff --git a/test cases/failing/100 no native compiler/main.c b/test cases/failing/100 no native compiler/main.c
new file mode 100644
index 0000000..9b6bdc2
--- /dev/null
+++ b/test cases/failing/100 no native compiler/main.c
@@ -0,0 +1,3 @@
+int main(void) {
+ return 0;
+}
diff --git a/test cases/failing/100 no native compiler/meson.build b/test cases/failing/100 no native compiler/meson.build
new file mode 100644
index 0000000..f0126ac
--- /dev/null
+++ b/test cases/failing/100 no native compiler/meson.build
@@ -0,0 +1,12 @@
+project('no native compiler')
+
+if not meson.is_cross_build()
+ error('MESON_SKIP_TEST test only applicable when cross building.')
+endif
+
+if add_languages('c', required: false, native: true)
+ error('MESON_SKIP_TEST test only applicable when native compiler not available.')
+endif
+
+add_languages('c')
+executable('main', 'main.c', native: true)