Skip to content

Commit 1167ee6

Browse files
authored
[UR][CMake]Set CMAKE_MSVC_RUNTIME_LIBRARY to fix UMF linking issues (#17366)
Caller might set CMAKE_MSVC_RUNTIME_LIBRARY to MultiThreaded to do static linking of MSVC runtime. However, UMF is not yet ready for static linking. Override the CMAKE_MSVC_RUNTIME_LIBRARY to fix lnking failures.
1 parent 829b30d commit 1167ee6

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

unified-runtime/cmake/FetchLevelZero.cmake

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,9 @@ if (NOT DEFINED LEVEL_ZERO_LIBRARY OR NOT DEFINED LEVEL_ZERO_INCLUDE_DIR)
5151
# Prevent L0 loader from exporting extra symbols
5252
set(CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS OFF)
5353

54+
set(CMAKE_MSVC_RUNTIME_LIBRARY_BAK "${CMAKE_MSVC_RUNTIME_LIBRARY}")
55+
# UMF has not yet been able to build as static
56+
set(CMAKE_MSVC_RUNTIME_LIBRARY "MultiThreaded$<$<CONFIG:Debug>:Debug>DLL")
5457
message(STATUS "Level Zero Adapter: Will fetch Level Zero Loader from ${UR_LEVEL_ZERO_LOADER_REPO}")
5558
include(FetchContent)
5659
FetchContent_Declare(level-zero-loader
@@ -65,6 +68,7 @@ if (NOT DEFINED LEVEL_ZERO_LIBRARY OR NOT DEFINED LEVEL_ZERO_INCLUDE_DIR)
6568

6669
# Restore original flags
6770
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS_BAK}")
71+
set(CMAKE_MSVC_RUNTIME_LIBRARY "${CMAKE_MSVC_RUNTIME_LIBRARY_BAK}")
6872

6973
target_compile_options(ze_loader PRIVATE
7074
$<$<IN_LIST:$<CXX_COMPILER_ID>,GNU;Clang;Intel;IntelLLVM>:-Wno-error>

0 commit comments

Comments
 (0)