Skip to content

Commit 6863d4a

Browse files
[SYCL][L0] Fix L0 library linking for remote paths on Windows (#8246)
This commit fixes a bug in the L0 plugin CMake with MSVC when the path to the L0 library starts with /. Signed-off-by: Larsen, Steffen <[email protected]>
1 parent 1d6d391 commit 6863d4a

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

sycl/plugins/level_zero/CMakeLists.txt

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,8 +46,16 @@ if (NOT DEFINED LEVEL_ZERO_LIBRARY OR NOT DEFINED LEVEL_ZERO_INCLUDE_DIR)
4646
endif()
4747

4848
add_library (LevelZeroLoader INTERFACE)
49+
# The MSVC linker does not like / at the start of a path, so to work around this
50+
# we split it into a link library and a library path, where the path is allowed
51+
# to have leading /.
52+
get_filename_component(LEVEL_ZERO_LIBRARY_SRC "${LEVEL_ZERO_LIBRARY}" DIRECTORY)
53+
get_filename_component(LEVEL_ZERO_LIB_NAME "${LEVEL_ZERO_LIBRARY}" NAME)
54+
target_link_directories(LevelZeroLoader
55+
INTERFACE "${LEVEL_ZERO_LIBRARY_SRC}"
56+
)
4957
target_link_libraries(LevelZeroLoader
50-
INTERFACE "${LEVEL_ZERO_LIBRARY}"
58+
INTERFACE "${LEVEL_ZERO_LIB_NAME}"
5159
)
5260

5361
add_library (LevelZeroLoader-Headers INTERFACE)

0 commit comments

Comments
 (0)