[PATCH] D119199: replace clang LLVM_ENABLE_PLUGINS -> CLANG_PLUGIN_SUPPORT in tests

Simon Tatham via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Fri Feb 11 04:16:10 PST 2022


simon_tatham added a comment.

Hi. This commit seems to have broken the following cmake command, on Windows (with HEAD pointing at 76cad51ba700233d6e3492eddcbb466b6adbc2eb <https://reviews.llvm.org/rG76cad51ba700233d6e3492eddcbb466b6adbc2eb>):

  cmake -DLLVM_ENABLE_PROJECTS=clang -DLLVM_EXPORT_SYMBOLS_FOR_PLUGINS=ON ..\llvm-project\llvm

The symptom is the same as @cristian.adam shows above:

  -- SampleAnalyzerPlugin ignored -- Loadable modules not supported on this platform.
  CMake Error at [...]/llvm-project/clang/cmake/modules/AddClang.cmake:185 (target_link_libraries):
    Utility target "SampleAnalyzerPlugin" must not be used as the target of a
    target_link_libraries call.
  Call Stack (most recent call first):
    [...]/llvm-project/clang/lib/Analysis/plugins/SampleAnalyzer/CMakeLists.txt:8 (clang_target_link_libraries)

With HEAD pointing at the previous commit, `clang/lib/Analysis/plugins/CMakeLists.txt` does not add the `SampleAnalyzer` subdirectory at all, because `LLVM_ENABLE_PLUGINS` has the value `OFF`. But `CLANG_PLUGIN_SUPPORT` is `ON`, so now it does, and the above error happens.

If I try to work around this by setting `CLANG_PLUGIN_SUPPORT` to `OFF` as well ...

  cmake -DLLVM_ENABLE_PROJECTS=clang -DLLVM_EXPORT_SYMBOLS_FOR_PLUGINS=ON -DCLANG_PLUGIN_SUPPORT=OFF ..\llvm-project\llvm

... then this error happens instead:

  CMake Error at cmake/modules/AddLLVM.cmake:676 (target_link_libraries):
    Target "clang" of type EXECUTABLE may not be linked into another target.
    One may link only to INTERFACE, OBJECT, STATIC or SHARED libraries, or to
    executables with the ENABLE_EXPORTS property set.
  Call Stack (most recent call first):
    cmake/modules/AddLLVM.cmake:808 (llvm_add_library)
    [...]/llvm-project/clang/examples/PrintFunctionNames/CMakeLists.txt:12 (add_llvm_library)

So, either way, the build fails.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D119199/new/

https://reviews.llvm.org/D119199



More information about the cfe-commits mailing list