Skip to content

Commit 1f3fab0

Browse files
authored
Merge pull request #78930 from compnerd/this-is-your-last-warning
Runtimes: treat linker warnings as errors
2 parents 0944fa4 + bf00d8d commit 1f3fab0

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

Runtimes/Core/CMakeLists.txt

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -144,6 +144,15 @@ add_compile_options(
144144
$<$<COMPILE_LANGUAGE:CXX>:-fno-exceptions>
145145
$<$<COMPILE_LANGUAGE:CXX>:-funwind-tables>)
146146

147+
# LNK4049: symbol 'symbol' defined in 'filename.obj' is imported
148+
# LNK4286: symbol 'symbol' defined in 'filename_1.obj' is imported by 'filename_2.obj'
149+
# LNK4217: symbol 'symbol' defined in 'filename_1.obj' is imported by 'filename_2.obj' in function 'function'
150+
#
151+
# We cannot selectively filter the linker warnings as we do not use the MSVC
152+
# frontned and `clang-cl` (and `clang`) currently do not support `/WX:nnnn`. As
153+
# a compromise, treat all linker warnings as errors.
154+
add_link_options($<$<PLATFORM_ID:Windows>:LINKER:/WX>)
155+
147156
add_compile_options(
148157
"$<$<COMPILE_LANGUAGE:Swift>:SHELL:-library-level api>"
149158
"$<$<COMPILE_LANGUAGE:Swift>:SHELL:-runtime-compatibility-version none>"

0 commit comments

Comments
 (0)