File tree Expand file tree Collapse file tree 1 file changed +9
-3
lines changed Expand file tree Collapse file tree 1 file changed +9
-3
lines changed Original file line number Diff line number Diff line change @@ -70,17 +70,23 @@ 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 projects can modify this path and use it in CMake. For example:
84+ # add_library(MLIR_NVPTXCOMPILER_LIB STATIC IMPORTED GLOBAL)
85+ # set_property(TARGET MLIR_NVPTXCOMPILER_LIB PROPERTY IMPORTED_LOCATION ${...})
86+ # where `...` is to be replaced with the path to the library.
87+ set_property (TARGET MLIR_NVPTXCOMPILER_LIB PROPERTY IMPORTED_LOCATION ${MLIR_NVPTXCOMPILER_LIB_PATH} )
8288 # Link against `nvptxcompiler_static`. TODO: use `CUDA::nvptxcompiler_static`.
83- target_link_libraries (MLIRNVVMTarget PRIVATE ${ MLIR_NVPTXCOMPILER_LIB} )
89+ target_link_libraries (MLIRNVVMTarget PRIVATE MLIR_NVPTXCOMPILER_LIB)
8490 target_include_directories (obj.MLIRNVVMTarget PUBLIC ${CUDAToolkit_INCLUDE_DIRS} )
8591 endif ()
8692 else ()
You can’t perform that action at this time.
0 commit comments