Skip to content

Commit 64ab6fb

Browse files
committed
Fix libnvptxcompiler_static.a absolute path
1 parent 0c18def commit 64ab6fb

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

mlir/lib/Target/LLVM/CMakeLists.txt

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -70,17 +70,20 @@ if ("NVPTX" IN_LIST LLVM_TARGETS_TO_BUILD)
7070
if(MLIR_ENABLE_NVPTXCOMPILER)
7171
# Find the `nvptxcompiler` library.
7272
# TODO: Bump the MLIR CMake version to 3.25 and use `CUDA::nvptxcompiler_static`.
73-
find_library(MLIR_NVPTXCOMPILER_LIB nvptxcompiler_static
73+
find_library(MLIR_NVPTXCOMPILER_LIB_PATH nvptxcompiler_static
7474
PATHS ${CUDAToolkit_LIBRARY_DIR} NO_DEFAULT_PATH)
7575

7676
# Fail if `nvptxcompiler_static` couldn't be found.
77-
if(MLIR_NVPTXCOMPILER_LIB STREQUAL "MLIR_NVPTXCOMPILER_LIB-NOTFOUND")
77+
if(MLIR_NVPTXCOMPILER_LIB_PATH STREQUAL "MLIR_NVPTXCOMPILER_LIB_PATH-NOTFOUND")
7878
message(FATAL_ERROR
7979
"Requested using the `nvptxcompiler` library backend but it couldn't be found.")
8080
endif()
8181

82+
add_library(MLIR_NVPTXCOMPILER_LIB STATIC IMPORTED GLOBAL)
83+
# Downstream project can modify this path and use it in CMake
84+
set_property(TARGET MLIR_NVPTXCOMPILER_LIB PROPERTY IMPORTED_LOCATION ${MLIR_NVPTXCOMPILER_LIB_PATH})
8285
# Link against `nvptxcompiler_static`. TODO: use `CUDA::nvptxcompiler_static`.
83-
target_link_libraries(MLIRNVVMTarget PRIVATE ${MLIR_NVPTXCOMPILER_LIB})
86+
target_link_libraries(MLIRNVVMTarget PRIVATE MLIR_NVPTXCOMPILER_LIB)
8487
target_include_directories(obj.MLIRNVVMTarget PUBLIC ${CUDAToolkit_INCLUDE_DIRS})
8588
endif()
8689
else()

0 commit comments

Comments
 (0)