Skip to content

Commit ede906c

Browse files
authored
[CMake][MSVC] Wrap more Linker flags for ICX (#16284)
This is a continuation of #15756 unfortunately I missed some flags in that patch because icx does not warn about options starting with `/O` or `/D` (they are understood as optimization and macro defining flags). I documented the approach of finding these unwrapped flags as a GH gist here: https://gist.github.com/Maetveis/00567488f0d6ff74095d91ed306fafc5
1 parent 5e10744 commit ede906c

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

sycl/CMakeLists.txt

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ if(MSVC)
5353
# Add PDB debug information
5454
list(APPEND CMAKE_MODULE_PATH "${LLVM_CMAKE_DIR}")
5555
include(CheckLinkerFlag)
56-
check_linker_flag(CXX "/DEBUG" LINKER_SUPPORTS_DEBUG)
56+
check_linker_flag(CXX "LINKER:/DEBUG" LINKER_SUPPORTS_DEBUG)
5757
if(LINKER_SUPPORTS_DEBUG)
5858
# sccache is not compatible with /Zi flag
5959
if (CMAKE_CXX_COMPILER_LAUNCHER STREQUAL "sccache")
@@ -72,12 +72,12 @@ if(MSVC)
7272
else()
7373
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /Zi")
7474
endif()
75-
add_link_options("/DEBUG")
75+
add_link_options("LINKER:/DEBUG")
7676

7777
# Enable unreferenced removal and ICF in Release mode.
78-
check_linker_flag(CXX "/OPT:REF /OPT:ICF" LINKER_SUPPORTS_OPTS)
78+
check_linker_flag(CXX "LINKER:/OPT:REF LINKER:/OPT:ICF" LINKER_SUPPORTS_OPTS)
7979
if (LINKER_SUPPORTS_OPTS AND uppercase_CMAKE_BUILD_TYPE STREQUAL "RELEASE")
80-
add_link_options("/OPT:REF" "/OPT:ICF")
80+
add_link_options("LINKER:/OPT:REF" "LINKER:/OPT:ICF")
8181
endif()
8282
endif()
8383
endif()

0 commit comments

Comments
 (0)