replace clang LLVM_ENABLE_PLUGINS -> CLANG_PLUGIN_SUPPORT in tests
Ensure CLANG_PLUGIN_SUPPORT is compatible with llvm_add_library.
Fixes an issue noted in D111100.
Differential Revision: https://reviews.llvm.org/D119199
GitOrigin-RevId: 76cad51ba700233d6e3492eddcbb466b6adbc2eb
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 1cc9bac..4225c02 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -476,6 +476,10 @@
option(CLANG_BUILD_TOOLS
"Build the Clang tools. If OFF, just generate build targets." ON)
+CMAKE_DEPENDENT_OPTION(CLANG_PLUGIN_SUPPORT
+ "Build clang with plugin support" ON
+ "LLVM_ENABLE_PLUGINS OR LLVM_EXPORT_SYMBOLS_FOR_PLUGINS" OFF)
+
option(CLANG_ENABLE_ARCMT "Build ARCMT." ON)
option(CLANG_ENABLE_STATIC_ANALYZER
"Include static analyzer in clang binary." ON)
diff --git a/examples/AnnotateFunctions/CMakeLists.txt b/examples/AnnotateFunctions/CMakeLists.txt
index e9850b6..e6541f7 100644
--- a/examples/AnnotateFunctions/CMakeLists.txt
+++ b/examples/AnnotateFunctions/CMakeLists.txt
@@ -1,6 +1,6 @@
add_llvm_library(AnnotateFunctions MODULE AnnotateFunctions.cpp PLUGIN_TOOL clang)
-if(LLVM_ENABLE_PLUGINS AND (WIN32 OR CYGWIN))
+if(CLANG_PLUGIN_SUPPORT AND (WIN32 OR CYGWIN))
set(LLVM_LINK_COMPONENTS
Support
)
diff --git a/examples/Attribute/CMakeLists.txt b/examples/Attribute/CMakeLists.txt
index 42f04f5..5392ac0 100644
--- a/examples/Attribute/CMakeLists.txt
+++ b/examples/Attribute/CMakeLists.txt
@@ -1,6 +1,6 @@
add_llvm_library(Attribute MODULE Attribute.cpp PLUGIN_TOOL clang)
-if(LLVM_ENABLE_PLUGINS AND (WIN32 OR CYGWIN))
+if(CLANG_PLUGIN_SUPPORT AND (WIN32 OR CYGWIN))
target_link_libraries(Attribute PRIVATE
clangAST
clangBasic
diff --git a/examples/CallSuperAttribute/CMakeLists.txt b/examples/CallSuperAttribute/CMakeLists.txt
index 922f0cf..f4284ad 100644
--- a/examples/CallSuperAttribute/CMakeLists.txt
+++ b/examples/CallSuperAttribute/CMakeLists.txt
@@ -1,6 +1,6 @@
add_llvm_library(CallSuperAttr MODULE CallSuperAttrInfo.cpp PLUGIN_TOOL clang)
-if(LLVM_ENABLE_PLUGINS AND (WIN32 OR CYGWIN))
+if(CLANG_PLUGIN_SUPPORT AND (WIN32 OR CYGWIN))
set(LLVM_LINK_COMPONENTS
Support
)
diff --git a/examples/PluginsOrder/CMakeLists.txt b/examples/PluginsOrder/CMakeLists.txt
index 289e234..612587a 100644
--- a/examples/PluginsOrder/CMakeLists.txt
+++ b/examples/PluginsOrder/CMakeLists.txt
@@ -1,6 +1,6 @@
add_llvm_library(PluginsOrder MODULE PluginsOrder.cpp PLUGIN_TOOL clang)
-if(LLVM_ENABLE_PLUGINS AND (WIN32 OR CYGWIN))
+if(CLANG_PLUGIN_SUPPORT AND (WIN32 OR CYGWIN))
set(LLVM_LINK_COMPONENTS
Support
)
diff --git a/examples/PrintFunctionNames/CMakeLists.txt b/examples/PrintFunctionNames/CMakeLists.txt
index 63b0c01..67f1b16 100644
--- a/examples/PrintFunctionNames/CMakeLists.txt
+++ b/examples/PrintFunctionNames/CMakeLists.txt
@@ -11,7 +11,7 @@
add_llvm_library(PrintFunctionNames MODULE PrintFunctionNames.cpp PLUGIN_TOOL clang)
-if(LLVM_ENABLE_PLUGINS AND (WIN32 OR CYGWIN))
+if(CLANG_PLUGIN_SUPPORT AND (WIN32 OR CYGWIN))
set(LLVM_LINK_COMPONENTS
Support
)
diff --git a/lib/Analysis/plugins/CMakeLists.txt b/lib/Analysis/plugins/CMakeLists.txt
index bd7314a..7b754ea 100644
--- a/lib/Analysis/plugins/CMakeLists.txt
+++ b/lib/Analysis/plugins/CMakeLists.txt
@@ -1,4 +1,4 @@
-if(CLANG_ENABLE_STATIC_ANALYZER AND LLVM_ENABLE_PLUGINS)
+if(CLANG_ENABLE_STATIC_ANALYZER AND CLANG_PLUGIN_SUPPORT)
add_subdirectory(SampleAnalyzer)
add_subdirectory(CheckerDependencyHandling)
add_subdirectory(CheckerOptionHandling)
diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt
index 05e2d39..0577978 100644
--- a/test/CMakeLists.txt
+++ b/test/CMakeLists.txt
@@ -14,12 +14,12 @@
CLANG_DEFAULT_PIE_ON_LINUX
CLANG_ENABLE_ARCMT
CLANG_ENABLE_STATIC_ANALYZER
+ CLANG_PLUGIN_SUPPORT
CLANG_SPAWN_CC1
ENABLE_BACKTRACES
LLVM_ENABLE_NEW_PASS_MANAGER
LLVM_ENABLE_ZLIB
LLVM_ENABLE_PER_TARGET_RUNTIME_DIR
- LLVM_ENABLE_PLUGINS
LLVM_ENABLE_THREADS
LLVM_WITH_Z3
)
@@ -146,7 +146,7 @@
endif()
if (CLANG_ENABLE_STATIC_ANALYZER)
- if (LLVM_ENABLE_PLUGINS)
+ if (CLANG_PLUGIN_SUPPORT)
list(APPEND CLANG_TEST_DEPS
SampleAnalyzerPlugin
CheckerDependencyHandlingAnalyzerPlugin
diff --git a/test/lit.site.cfg.py.in b/test/lit.site.cfg.py.in
index bc3022d..1e2e331 100644
--- a/test/lit.site.cfg.py.in
+++ b/test/lit.site.cfg.py.in
@@ -34,7 +34,7 @@
config.host_arch = "@HOST_ARCH@"
config.python_executable = "@Python3_EXECUTABLE@"
config.use_z3_solver = lit_config.params.get('USE_Z3_SOLVER', "@USE_Z3_SOLVER@")
-config.has_plugins = @LLVM_ENABLE_PLUGINS@
+config.has_plugins = @CLANG_PLUGIN_SUPPORT@
config.clang_vendor_uti = "@CLANG_VENDOR_UTI@"
config.llvm_external_lit = path(r"@LLVM_EXTERNAL_LIT@")
diff --git a/tools/driver/CMakeLists.txt b/tools/driver/CMakeLists.txt
index 52d439c..6b3e159 100644
--- a/tools/driver/CMakeLists.txt
+++ b/tools/driver/CMakeLists.txt
@@ -17,8 +17,6 @@
Vectorize
)
-option(CLANG_PLUGIN_SUPPORT "Build clang with plugin support" ON)
-
# Support plugins.
if(CLANG_PLUGIN_SUPPORT)
set(support_plugins SUPPORT_PLUGINS)