Skip to content

Commit 9258490

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 6a08787 commit 9258490

File tree

3 files changed

+7
-7
lines changed

3 files changed

+7
-7
lines changed

cmake/helpers.cmake

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -138,17 +138,17 @@ function(add_ur_target_link_options name)
138138
endif()
139139
elseif(MSVC)
140140
target_link_options(${name} PRIVATE
141-
/DYNAMICBASE
142-
/HIGHENTROPYVA
143-
/NXCOMPAT
141+
LINKER:/DYNAMICBASE
142+
LINKER:/HIGHENTROPYVA
143+
LINKER:/NXCOMPAT
144144
)
145145
endif()
146146
endfunction()
147147

148148
function(add_ur_target_exec_options name)
149149
if(MSVC)
150150
target_link_options(${name} PRIVATE
151-
/ALLOWISOLATION
151+
LINKER:/ALLOWISOLATION
152152
)
153153
endif()
154154
endfunction()
@@ -166,7 +166,7 @@ function(add_ur_library name)
166166
add_ur_target_link_options(${name})
167167
if(MSVC)
168168
target_link_options(${name} PRIVATE
169-
$<$<STREQUAL:$<TARGET_LINKER_FILE_NAME:${name}>,link.exe>:/DEPENDENTLOADFLAG:0x2000>
169+
$<$<STREQUAL:$<TARGET_LINKER_FILE_NAME:${name}>,link.exe>:LINKER:/DEPENDENTLOADFLAG:0x2000>
170170
)
171171
endif()
172172
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/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)