summaryrefslogtreecommitdiffstats
path: root/cmake/CompilerFlags.cmake
diff options
context:
space:
mode:
authorJay Kwak <82421531+jkwak-work@users.noreply.github.com>2025-04-19 03:26:12 -0700
committerGitHub <noreply@github.com>2025-04-19 03:26:12 -0700
commit136c989a261e036e98b45e69cf9288d750780062 (patch)
treee282c0d608d4d5477ff38db6518e70f5f25f0121 /cmake/CompilerFlags.cmake
parent591affaf733ec82d7b38a7bf9c4d2f49a69a2c66 (diff)
Fix compiler warning on Windows about -build-id (#6857)
This PR fixes the compiler warning like following, lld-link: warning: ignoring unknown argument '--no-undefined' lld-link: warning: ignoring unknown argument '--build-id', did you mean '-build-id' chatGPT said that those options are for ELF and not for Windows: These warnings happen because the Clang toolchain on Windows is invoking lld-link, which is the LLVM linker frontend for link.exe compatibility (i.e., it acts like the MSVC linker). The arguments --no-undefined and --build-id are ELF-specific flags, which are valid when targeting Linux, but not valid in the PE/COFF (Windows) environment. Here's a breakdown: ⚠️ Warning messages explained: lld-link: warning: ignoring unknown argument '--no-undefined' → This is a Linux/ELF flag. On Windows, this has no effect and is unknown. lld-link: warning: ignoring unknown argument '--build-id', did you mean '-build-id' → Again, --build-id is for ELF binaries to include a unique build ID. Not valid for Windows targets.
Diffstat (limited to 'cmake/CompilerFlags.cmake')
-rw-r--r--cmake/CompilerFlags.cmake4
1 files changed, 2 insertions, 2 deletions
diff --git a/cmake/CompilerFlags.cmake b/cmake/CompilerFlags.cmake
index 32d43d360..24a2c574f 100644
--- a/cmake/CompilerFlags.cmake
+++ b/cmake/CompilerFlags.cmake
@@ -152,8 +152,8 @@ function(set_default_compile_options target)
add_supported_cxx_flags(${target} PRIVATE ${warning_flags})
- if(CMAKE_CXX_COMPILER_ID MATCHES "GNU|Clang")
- # valid linker options only for GNU/Clang
+ if(NOT WIN32)
+ # these options are for ELF specific and not for Windows
add_supported_cxx_linker_flags(
${target}
PRIVATE