Skip to content

Commit dde91fa

Browse files
committed
Wrap linker flags on Windows for IntelLLLVM
The Intel C++ compiler requires linker flags to be wrapped, because CMake passes them through the compiler driver. Prefix linker options with `LINKER:`. CMake will transorm it to the appropriate flag for the compiler driver: (Nothing for MSVC or clang-cl, and /Qoption,link for icx), so this will work for other compilers and for earlier CMake versions too. Signed-off-by: Gergely Meszaros <[email protected]>
1 parent 537d545 commit dde91fa

File tree

4 files changed

+9
-9
lines changed

4 files changed

+9
-9
lines changed

cmake/helpers.cmake

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -106,17 +106,17 @@ function(add_ur_target_link_options name)
106106
endif()
107107
elseif(MSVC)
108108
target_link_options(${name} PRIVATE
109-
/DYNAMICBASE
110-
/HIGHENTROPYVA
111-
/NXCOMPAT
109+
LINKER:/DYNAMICBASE
110+
LINKER:/HIGHENTROPYVA
111+
LINKER:/NXCOMPAT
112112
)
113113
endif()
114114
endfunction()
115115

116116
function(add_ur_target_exec_options name)
117117
if(MSVC)
118118
target_link_options(${name} PRIVATE
119-
/ALLOWISOLATION
119+
LINKER:/ALLOWISOLATION
120120
)
121121
endif()
122122
endfunction()
@@ -134,7 +134,7 @@ function(add_ur_library name)
134134
add_ur_target_link_options(${name})
135135
if(MSVC)
136136
target_link_options(${name} PRIVATE
137-
$<$<STREQUAL:$<TARGET_LINKER_FILE_NAME:${name}>,link.exe>:/DEPENDENTLOADFLAG:0x2000>
137+
$<$<STREQUAL:$<TARGET_LINKER_FILE_NAME:${name}>,link.exe>:LINKER:/DEPENDENTLOADFLAG:0x2000>
138138
)
139139
endif()
140140
endfunction()

source/adapters/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ function(add_ur_adapter name)
1313

1414
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/../adapter.def.in ${ADAPTER_VERSION_SCRIPT} @ONLY)
1515
set_target_properties(${name} PROPERTIES
16-
LINK_FLAGS "/DEF:${ADAPTER_VERSION_SCRIPT}"
16+
LINK_OPTIONS "LINKER:/DEF:${ADAPTER_VERSION_SCRIPT}"
1717
)
1818
elseif(APPLE)
1919
target_compile_options(${name} PRIVATE "-fvisibility=hidden")

source/adapters/level_zero/CMakeLists.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ if(UR_BUILD_ADAPTER_L0)
8585

8686
if (WIN32)
8787
# 0x800: Search for the DLL only in the System32 folder
88-
target_link_options(ur_adapter_level_zero PRIVATE /DEPENDENTLOADFLAG:0x800)
88+
target_link_options(ur_adapter_level_zero PRIVATE LINKER:/DEPENDENTLOADFLAG:0x800)
8989
endif()
9090

9191
target_link_libraries(ur_adapter_level_zero PRIVATE
@@ -178,7 +178,7 @@ if(UR_BUILD_ADAPTER_L0_V2)
178178

179179
if (WIN32)
180180
# 0x800: Search for the DLL only in the System32 folder
181-
target_link_options(ur_adapter_level_zero_v2 PUBLIC /DEPENDENTLOADFLAG:0x800)
181+
target_link_options(ur_adapter_level_zero_v2 PUBLIC LINKER:/DEPENDENTLOADFLAG:0x800)
182182
endif()
183183

184184
target_link_libraries(ur_adapter_level_zero_v2 PRIVATE

source/loader/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ if (MSVC)
2828
set(LOADER_VERSION_SCRIPT ${CMAKE_CURRENT_BINARY_DIR}/ur_loader.def)
2929
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/loader.def.in ${LOADER_VERSION_SCRIPT} @ONLY)
3030
set_target_properties(ur_loader PROPERTIES
31-
LINK_FLAGS "/DEF:${LOADER_VERSION_SCRIPT}"
31+
LINK_OPTIONS "LINKER:/DEF:${LOADER_VERSION_SCRIPT}"
3232
)
3333
elseif(CMAKE_SYSTEM_NAME STREQUAL "Linux")
3434
set(TARGET_LIBNAME libur_loader_${PROJECT_VERSION_MAJOR}.${PROJECT_VERSION_MINOR})

0 commit comments

Comments
 (0)