[llvm] 011828e - [CMake][CAS] Do not export CASPluginTest from the install tree (#215292)

via llvm-commits llvm-commits at lists.llvm.org
Tue Aug 11 02:29:34 PDT 2026


Author: Viktoria Maximova
Date: 2026-08-11T11:29:29+02:00
New Revision: 011828ed6155f0d76f595d3a0874dc1a38d314ae

URL: https://github.com/llvm/llvm-project/commit/011828ed6155f0d76f595d3a0874dc1a38d314ae
DIFF: https://github.com/llvm/llvm-project/commit/011828ed6155f0d76f595d3a0874dc1a38d314ae.diff

LOG: [CMake][CAS] Do not export CASPluginTest from the install tree (#215292)

`CASPluginTest` is a unit-test plugin, but it ends up in the installed
`LLVMExports.cmake` and in `LLVM_AVAILABLE_LIBS`.
Installs that don't ship `libCASPluginTest` then fail every
`find_package(LLVM)` with a `FATAL_ERROR`, so nothing out-of-tree can
configure against them.

`BUILDTREE_ONLY` limits the plugin to the build-tree export set. The CAS
unit tests load it by a path relative to the test executable, so they
keep working.

This is a follow-up to #213331.
Regression found in [Out-of-Tree CI
builds](https://github.com/KhronosGroup/SPIRV-LLVM-Translator/actions/runs/31229501194/job/93030341651)
of KhronosGroup/SPIRV-LLVM-Translator:
```
CMake Error at /usr/lib/llvm-24/lib/cmake/llvm/LLVMExports.cmake:1944 (message):
  The imported target "CASPluginTest" references the file

     "/usr/lib/llvm-24/lib/libCASPluginTest.so.24.0"

  but this file does not exist. 
```

AI-assisted: Claude Opus 5 (commercial SaaS)

Added: 
    

Modified: 
    llvm/tools/libCASPluginTest/CMakeLists.txt

Removed: 
    


################################################################################
diff  --git a/llvm/tools/libCASPluginTest/CMakeLists.txt b/llvm/tools/libCASPluginTest/CMakeLists.txt
index 2f3a9a35389b1..a37c8dc603c53 100644
--- a/llvm/tools/libCASPluginTest/CMakeLists.txt
+++ b/llvm/tools/libCASPluginTest/CMakeLists.txt
@@ -16,6 +16,7 @@ set(SOURCES
 
 set(LLVM_EXPORTED_SYMBOL_FILE ${CMAKE_CURRENT_SOURCE_DIR}/libCASPluginTest.exports)
 
-add_llvm_library(CASPluginTest SHARED ${SOURCES}
+# Only loaded by CAS unit tests out of the build tree.
+add_llvm_library(CASPluginTest SHARED BUILDTREE_ONLY ${SOURCES}
   LINK_LIBS ${LLVM_PTHREAD_LIB}
 )


        


More information about the llvm-commits mailing list