Summary: This avoids adding any additional global constructors, like cl::opt. There is a temporary exception on IR/, which has a few cl::opts that require a bit of plumbing to remove.
Differential Revision: https://reviews.llvm.org/D77824
+# Enable errors for any global constructors.
+add_flag_if_supported("-Werror=global-constructors" WERROR_GLOBAL_CONSTRUCTOR)
+
add_subdirectory(Analysis)
add_subdirectory(Conversion)
add_subdirectory(Dialect)
+# TODO: Remove the need for global constructors within IR/
+add_flag_if_supported("-Wno-global-constructors" WNO_GLOBAL_CONSTRUCTOR_MLIR_IR)
+
file(GLOB globbed *.c *.cpp)
add_mlir_library(MLIRIR
${globbed}