summaryrefslogtreecommitdiff
path: root/test cases
diff options
context:
space:
mode:
authorJussi Pakkanen <jpakkane@gmail.com>2024-04-05 00:08:09 +0300
committerGitHub <noreply@github.com>2024-04-05 00:08:09 +0300
commit30c38e2bd69b2bab74b6e76da1c626f3c9853613 (patch)
tree81951d3bfe27ef63432321fe8a038cb482b59e19 /test cases
parente00710a0a98e818418a62466284bdfc200142b0c (diff)
parentf3fad6cc5f948b0c7557bdce3959c71420183be9 (diff)
downloadmeson-30c38e2bd69b2bab74b6e76da1c626f3c9853613.tar.gz
Merge pull request #12144 from amyspark/fix-msvc-clangcl-linker-flag-detection
linkers: Fix detection of link arguments to Clang(-cl) + MSVC
Diffstat (limited to 'test cases')
-rw-r--r--test cases/common/180 has link arg/meson.build20
1 files changed, 20 insertions, 0 deletions
diff --git a/test cases/common/180 has link arg/meson.build b/test cases/common/180 has link arg/meson.build
index 6bfbd59e7..111b0b9ea 100644
--- a/test cases/common/180 has link arg/meson.build
+++ b/test cases/common/180 has link arg/meson.build
@@ -45,3 +45,23 @@ endif
assert(cc.has_multi_link_arguments(is_arg), 'Arg that should have worked does not work.')
assert(cc.has_multi_link_arguments([useless, is_arg]), 'Arg that should have worked does not work.')
+
+# These are Visual Studio only flags
+# Testing has_argument_syntax is incorrect as it skips Microsoft Clang
+if cc.get_define('_MSC_FULL_VER') != ''
+ if cc.get_linker_id() == 'link'
+ is_only = '/OPT:REF'
+ is_shared = '/GUARD:CF'
+ else # ld-link
+ is_only = '--color-diagnostics'
+ is_shared = '-guard:cf'
+ endif
+
+ # requires -Wl,xxx as it goes through the compiler
+ if cc.get_argument_syntax() != 'msvc'
+ is_only = '-Wl,@0@'.format(is_only)
+ is_shared = '-Wl,@0@'.format(is_shared)
+ endif
+
+ assert(cc.has_multi_link_arguments([is_only, is_shared]), 'Arg that should have worked does not work.')
+endif