[Mlir-commits] [mlir] Fix libnvptxcompiler_static.a absolute path (PR #115015)

Mehdi Amini llvmlistbot at llvm.org
Tue Nov 5 12:24:48 PST 2024


================
@@ -70,17 +70,20 @@ if ("NVPTX" IN_LIST LLVM_TARGETS_TO_BUILD)
     if(MLIR_ENABLE_NVPTXCOMPILER)
       # Find the `nvptxcompiler` library.
       # TODO: Bump the MLIR CMake version to 3.25 and use `CUDA::nvptxcompiler_static`.
-      find_library(MLIR_NVPTXCOMPILER_LIB nvptxcompiler_static
+      find_library(MLIR_NVPTXCOMPILER_LIB_PATH nvptxcompiler_static
                   PATHS ${CUDAToolkit_LIBRARY_DIR} NO_DEFAULT_PATH)
 
       # Fail if `nvptxcompiler_static` couldn't be found.
-      if(MLIR_NVPTXCOMPILER_LIB STREQUAL "MLIR_NVPTXCOMPILER_LIB-NOTFOUND")
+      if(MLIR_NVPTXCOMPILER_LIB_PATH STREQUAL "MLIR_NVPTXCOMPILER_LIB_PATH-NOTFOUND")
         message(FATAL_ERROR
                 "Requested using the `nvptxcompiler` library backend but it couldn't be found.")
       endif()
 
+      add_library(MLIR_NVPTXCOMPILER_LIB STATIC IMPORTED GLOBAL)
+      # Downstream project can modify this path and use it in CMake
----------------
joker-eph wrote:

Should we add the example you mentioned here:
```suggestion
     # Downstream project can modify this path and use it in CMake. For example:
     # add_library(MLIR_NVPTXCOMPILER_LIB STATIC IMPORTED GLOBAL)
     # set_property(TARGET MLIR_NVPTXCOMPILER_LIB PROPERTY IMPORTED_LOCATION ${...})  
     # where `...` is to be replaced with the path to the library.
```


https://github.com/llvm/llvm-project/pull/115015


More information about the Mlir-commits mailing list