Skip to content

Commit 4f8945e

Browse files
committed
compilers: Add test for correct forwarding of flags to MSVC's Clang linkers
1 parent 1574668 commit 4f8945e

File tree

1 file changed

+20
-0
lines changed

1 file changed

+20
-0
lines changed

test cases/common/180 has link arg/meson.build

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,3 +45,23 @@ endif
4545

4646
assert(cc.has_multi_link_arguments(is_arg), 'Arg that should have worked does not work.')
4747
assert(cc.has_multi_link_arguments([useless, is_arg]), 'Arg that should have worked does not work.')
48+
49+
# These are Visual Studio only flags
50+
# Testing has_argument_syntax is incorrect as it skips Microsoft Clang
51+
if cc.get_define('_MSC_FULL_VER') != ''
52+
if cc.get_linker_id() == 'link'
53+
is_only = '/OPT:REF'
54+
is_shared = '/GUARD:CF'
55+
else # ld-link
56+
is_only = '--color-diagnostics'
57+
is_shared = '-guard:cf'
58+
endif
59+
60+
# requires -Wl,xxx as it goes through the compiler
61+
if cc.get_argument_syntax() != 'msvc'
62+
is_only = '-Wl,@0@'.format(is_only)
63+
is_shared = '-Wl,@0@'.format(is_shared)
64+
endif
65+
66+
assert(cc.has_multi_link_arguments([is_only, is_shared]), 'Arg that should have worked does not work.')
67+
endif

0 commit comments

Comments
 (0)