1 # This CMake module is responsible for interpreting the user defined LLVM_
2 # options and executing the appropriate CMake commands to realize the users'
5 # This is commonly needed so make sure it's defined before we include anything
7 string(TOUPPER "${CMAKE_BUILD_TYPE}" uppercase_CMAKE_BUILD_TYPE)
9 include(HandleLLVMStdlib)
10 include(AddLLVMDefinitions)
11 include(CheckCCompilerFlag)
12 include(CheckCXXCompilerFlag)
14 if(NOT LLVM_FORCE_USE_OLD_TOOLCHAIN)
15 if(CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
16 if(CMAKE_CXX_COMPILER_VERSION VERSION_LESS 4.7)
17 message(FATAL_ERROR "Host GCC version must be at least 4.7!")
19 elseif(CMAKE_CXX_COMPILER_ID STREQUAL "Clang")
20 if(CMAKE_CXX_COMPILER_VERSION VERSION_LESS 3.1)
21 message(FATAL_ERROR "Host Clang version must be at least 3.1!")
24 # Also test that we aren't using too old of a version of libstdc++ with the
25 # Clang compiler. This is tricky as there is no real way to check the
26 # version of libstdc++ directly. Instead we test for a known bug in
27 # libstdc++4.6 that is fixed in libstdc++4.7.
28 if(NOT LLVM_ENABLE_LIBCXX)
29 set(OLD_CMAKE_REQUIRED_FLAGS ${CMAKE_REQUIRED_FLAGS})
30 set(OLD_CMAKE_REQUIRED_LIBRARIES ${CMAKE_REQUIRED_LIBRARIES})
31 set(CMAKE_REQUIRED_FLAGS "-std=c++0x")
32 check_cxx_source_compiles("
34 std::atomic<float> x(0.0f);
35 int main() { return (float)x; }"
36 LLVM_NO_OLD_LIBSTDCXX)
37 if(NOT LLVM_NO_OLD_LIBSTDCXX)
38 message(FATAL_ERROR "Host Clang must be able to find libstdc++4.7 or newer!")
40 set(CMAKE_REQUIRED_FLAGS ${OLD_CMAKE_REQUIRED_FLAGS})
41 set(CMAKE_REQUIRED_LIBRARIES ${OLD_CMAKE_REQUIRED_LIBRARIES})
43 elseif(CMAKE_CXX_COMPILER_ID MATCHES "MSVC")
44 if(CMAKE_CXX_COMPILER_VERSION VERSION_LESS 17.0)
45 message(FATAL_ERROR "Host Visual Studio must be at least 2012 (MSVC 17.0)")
50 if( LLVM_ENABLE_ASSERTIONS )
51 # MSVC doesn't like _DEBUG on release builds. See PR 4379.
53 add_definitions( -D_DEBUG )
55 # On non-Debug builds cmake automatically defines NDEBUG, so we
56 # explicitly undefine it:
57 if( NOT uppercase_CMAKE_BUILD_TYPE STREQUAL "DEBUG" )
58 add_definitions( -UNDEBUG )
59 # Also remove /D NDEBUG to avoid MSVC warnings about conflicting defines.
60 foreach (flags_var_to_scrub
61 CMAKE_CXX_FLAGS_RELEASE
62 CMAKE_CXX_FLAGS_RELWITHDEBINFO
63 CMAKE_CXX_FLAGS_MINSIZEREL
65 CMAKE_C_FLAGS_RELWITHDEBINFO
66 CMAKE_C_FLAGS_MINSIZEREL)
67 string (REGEX REPLACE "(^| )[/-]D *NDEBUG($| )" " "
68 "${flags_var_to_scrub}" "${${flags_var_to_scrub}}")
74 set(LLVM_HAVE_LINK_VERSION_SCRIPT 0)
82 # Maximum path length is 160 for non-unicode paths
89 set(LLVM_HAVE_LINK_VERSION_SCRIPT 0)
91 set(LLVM_HAVE_LINK_VERSION_SCRIPT 1)
93 # FIXME: Maximum path length is currently set to 'safe' fixed value
96 MESSAGE(SEND_ERROR "Unable to determine platform")
100 set(EXEEXT ${CMAKE_EXECUTABLE_SUFFIX})
101 set(LTDL_SHLIB_EXT ${CMAKE_SHARED_LIBRARY_SUFFIX})
103 # We use *.dylib rather than *.so on darwin.
104 set(LLVM_PLUGIN_EXT ${CMAKE_SHARED_LIBRARY_SUFFIX})
107 # Darwin-specific linker flags for loadable modules.
108 set(CMAKE_MODULE_LINKER_FLAGS "${CMAKE_MODULE_LINKER_FLAGS} -Wl,-flat_namespace -Wl,-undefined -Wl,suppress")
111 function(append value)
112 foreach(variable ${ARGN})
113 set(${variable} "${${variable}} ${value}" PARENT_SCOPE)
117 function(append_if condition value)
119 foreach(variable ${ARGN})
120 set(${variable} "${${variable}} ${value}" PARENT_SCOPE)
125 macro(add_flag_if_supported flag name)
126 check_c_compiler_flag("-Werror ${flag}" "C_SUPPORTS_${name}")
127 append_if("C_SUPPORTS_${name}" "${flag}" CMAKE_C_FLAGS)
128 check_cxx_compiler_flag("-Werror ${flag}" "CXX_SUPPORTS_${name}")
129 append_if("CXX_SUPPORTS_${name}" "${flag}" CMAKE_CXX_FLAGS)
132 function(add_flag_or_print_warning flag name)
133 check_c_compiler_flag("-Werror ${flag}" "C_SUPPORTS_${name}")
134 check_cxx_compiler_flag("-Werror ${flag}" "CXX_SUPPORTS_${name}")
135 if (C_SUPPORTS_${name} AND CXX_SUPPORTS_${name})
136 message(STATUS "Building with ${flag}")
137 set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${flag}" PARENT_SCOPE)
138 set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${flag}" PARENT_SCOPE)
140 message(WARNING "${flag} is not supported.")
144 if( LLVM_ENABLE_PIC )
146 # Xcode has -mdynamic-no-pic on by default, which overrides -fPIC. I don't
147 # know how to disable this, so just force ENABLE_PIC off for now.
148 message(WARNING "-fPIC not supported with Xcode.")
149 elseif( WIN32 OR CYGWIN)
150 # On Windows all code is PIC. MinGW warns if -fPIC is used.
152 add_flag_or_print_warning("-fPIC" FPIC)
155 # MinGW warns if -fvisibility-inlines-hidden is used.
157 check_cxx_compiler_flag("-fvisibility-inlines-hidden" SUPPORTS_FVISIBILITY_INLINES_HIDDEN_FLAG)
158 append_if(SUPPORTS_FVISIBILITY_INLINES_HIDDEN_FLAG "-fvisibility-inlines-hidden" CMAKE_CXX_FLAGS)
163 if( CMAKE_SIZEOF_VOID_P EQUAL 8 AND NOT WIN32 )
164 # TODO: support other platforms and toolchains.
165 if( LLVM_BUILD_32_BITS )
166 message(STATUS "Building 32 bits executables and libraries.")
167 add_llvm_definitions( -m32 )
168 set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -m32")
169 set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -m32")
170 set(CMAKE_MODULE_LINKER_FLAGS "${CMAKE_MODULE_LINKER_FLAGS} -m32")
171 endif( LLVM_BUILD_32_BITS )
172 endif( CMAKE_SIZEOF_VOID_P EQUAL 8 AND NOT WIN32 )
174 if (LLVM_BUILD_STATIC)
175 set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -static")
179 # For Xcode enable several build settings that correspond to
180 # many warnings that are on by default in Clang but are
181 # not enabled for historical reasons. For versions of Xcode
182 # that do not support these options they will simply
184 set(CMAKE_XCODE_ATTRIBUTE_GCC_WARN_ABOUT_RETURN_TYPE "YES")
185 set(CMAKE_XCODE_ATTRIBUTE_GCC_WARN_ABOUT_MISSING_NEWLINE "YES")
186 set(CMAKE_XCODE_ATTRIBUTE_GCC_WARN_UNUSED_VALUE "YES")
187 set(CMAKE_XCODE_ATTRIBUTE_GCC_WARN_UNUSED_VARIABLE "YES")
188 set(CMAKE_XCODE_ATTRIBUTE_GCC_WARN_SIGN_COMPARE "YES")
189 set(CMAKE_XCODE_ATTRIBUTE_GCC_WARN_UNUSED_FUNCTION "YES")
190 set(CMAKE_XCODE_ATTRIBUTE_GCC_WARN_INITIALIZER_NOT_FULLY_BRACKETED "YES")
191 set(CMAKE_XCODE_ATTRIBUTE_GCC_WARN_HIDDEN_VIRTUAL_FUNCTIONS "YES")
192 set(CMAKE_XCODE_ATTRIBUTE_GCC_WARN_UNINITIALIZED_AUTOS "YES")
193 set(CMAKE_XCODE_ATTRIBUTE_CLANG_WARN_BOOL_CONVERSION "YES")
194 set(CMAKE_XCODE_ATTRIBUTE_CLANG_WARN_EMPTY_BODY "YES")
195 set(CMAKE_XCODE_ATTRIBUTE_CLANG_WARN_ENUM_CONVERSION "YES")
196 set(CMAKE_XCODE_ATTRIBUTE_CLANG_WARN_INT_CONVERSION "YES")
197 set(CMAKE_XCODE_ATTRIBUTE_CLANG_WARN_CONSTANT_CONVERSION "YES")
198 set(CMAKE_XCODE_ATTRIBUTE_GCC_WARN_NON_VIRTUAL_DESTRUCTOR "YES")
201 # On Win32 using MS tools, provide an option to set the number of parallel jobs
204 set(LLVM_COMPILER_JOBS "0" CACHE STRING
205 "Number of parallel compiler jobs. 0 means use all processors. Default is 0.")
206 if( NOT LLVM_COMPILER_JOBS STREQUAL "1" )
207 if( LLVM_COMPILER_JOBS STREQUAL "0" )
208 add_llvm_definitions( /MP )
210 message(STATUS "Number of parallel compiler jobs set to " ${LLVM_COMPILER_JOBS})
211 add_llvm_definitions( /MP${LLVM_COMPILER_JOBS} )
214 message(STATUS "Parallel compilation disabled")
219 include(ChooseMSVCCRT)
221 if( NOT (${CMAKE_VERSION} VERSION_LESS 2.8.11) )
222 # set stack reserved size to ~10MB
223 # CMake previously automatically set this value for MSVC builds, but the
224 # behavior was changed in CMake 2.8.11 (Issue 12437) to use the MSVC default
225 # value (1 MB) which is not enough for us in tasks such as parsing recursive
226 # C++ templates in Clang.
227 set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} /STACK:10000000")
231 add_llvm_definitions(-D_VARIADIC_MAX=10)
234 # Add definitions that make MSVC much less annoying.
235 add_llvm_definitions(
236 # For some reason MS wants to deprecate a bunch of standard functions...
237 -D_CRT_SECURE_NO_DEPRECATE
238 -D_CRT_SECURE_NO_WARNINGS
239 -D_CRT_NONSTDC_NO_DEPRECATE
240 -D_CRT_NONSTDC_NO_WARNINGS
241 -D_SCL_SECURE_NO_DEPRECATE
242 -D_SCL_SECURE_NO_WARNINGS
245 -wd4146 # Suppress 'unary minus operator applied to unsigned type, result still unsigned'
246 -wd4180 # Suppress 'qualifier applied to function type has no meaning; ignored'
247 -wd4244 # Suppress ''argument' : conversion from 'type1' to 'type2', possible loss of data'
248 -wd4258 # Suppress ''var' : definition from the for loop is ignored; the definition from the enclosing scope is used'
249 -wd4267 # Suppress ''var' : conversion from 'size_t' to 'type', possible loss of data'
250 -wd4291 # Suppress ''declaration' : no matching operator delete found; memory will not be freed if initialization throws an exception'
251 -wd4345 # Suppress 'behavior change: an object of POD type constructed with an initializer of the form () will be default-initialized'
252 -wd4351 # Suppress 'new behavior: elements of array 'array' will be default initialized'
253 -wd4355 # Suppress ''this' : used in base member initializer list'
254 -wd4456 # Suppress 'declaration of 'var' hides local variable'
255 -wd4457 # Suppress 'declaration of 'var' hides function parameter'
256 -wd4458 # Suppress 'declaration of 'var' hides class member'
257 -wd4459 # Suppress 'declaration of 'var' hides global declaration'
258 -wd4503 # Suppress ''identifier' : decorated name length exceeded, name was truncated'
259 -wd4624 # Suppress ''derived class' : destructor could not be generated because a base class destructor is inaccessible'
260 -wd4722 # Suppress 'function' : destructor never returns, potential memory leak
261 -wd4800 # Suppress ''type' : forcing value to bool 'true' or 'false' (performance warning)'
264 -w14062 # Promote 'enumerator in switch of enum is not handled' to level 1 warning.
266 # Promoted warnings to errors.
267 -we4238 # Promote 'nonstandard extension used : class rvalue used as lvalue' to error.
271 if (LLVM_ENABLE_WARNINGS)
272 add_llvm_definitions( /W4 )
273 if (LLVM_ENABLE_PEDANTIC)
274 # No MSVC equivalent available
275 endif (LLVM_ENABLE_PEDANTIC)
276 endif (LLVM_ENABLE_WARNINGS)
277 if (LLVM_ENABLE_WERROR)
278 add_llvm_definitions( /WX )
279 endif (LLVM_ENABLE_WERROR)
280 elseif( LLVM_COMPILER_IS_GCC_COMPATIBLE )
281 if (LLVM_ENABLE_WARNINGS)
282 append("-Wall -W -Wno-unused-parameter -Wwrite-strings" CMAKE_C_FLAGS CMAKE_CXX_FLAGS)
283 append("-Wcast-qual" CMAKE_CXX_FLAGS)
285 # Turn off missing field initializer warnings for gcc to avoid noise from
286 # false positives with empty {}. Turn them on otherwise (they're off by
287 # default for clang).
288 check_cxx_compiler_flag("-Wmissing-field-initializers" CXX_SUPPORTS_MISSING_FIELD_INITIALIZERS_FLAG)
289 if (CXX_SUPPORTS_MISSING_FIELD_INITIALIZERS_FLAG)
290 if (CMAKE_COMPILER_IS_GNUCXX)
291 append("-Wno-missing-field-initializers" CMAKE_C_FLAGS CMAKE_CXX_FLAGS)
293 append("-Wmissing-field-initializers" CMAKE_C_FLAGS CMAKE_CXX_FLAGS)
297 append_if(LLVM_ENABLE_PEDANTIC "-pedantic -Wno-long-long" CMAKE_C_FLAGS CMAKE_CXX_FLAGS)
298 add_flag_if_supported("-Wcovered-switch-default" COVERED_SWITCH_DEFAULT_FLAG)
299 append_if(USE_NO_UNINITIALIZED "-Wno-uninitialized" CMAKE_CXX_FLAGS)
300 append_if(USE_NO_MAYBE_UNINITIALIZED "-Wno-maybe-uninitialized" CMAKE_CXX_FLAGS)
302 # Check if -Wnon-virtual-dtor warns even though the class is marked final.
303 # If it does, don't add it. So it won't be added on clang 3.4 and older.
304 # This also catches cases when -Wnon-virtual-dtor isn't supported by
305 # the compiler at all.
306 set(OLD_CMAKE_REQUIRED_FLAGS ${CMAKE_REQUIRED_FLAGS})
307 set(CMAKE_REQUIRED_FLAGS "${CMAKE_REQUIRED_FLAGS} -std=c++11 -Werror=non-virtual-dtor")
308 CHECK_CXX_SOURCE_COMPILES("class base {public: virtual void anchor();protected: ~base();};
309 class derived final : public base { public: ~derived();};
310 int main() { return 0; }"
311 CXX_WONT_WARN_ON_FINAL_NONVIRTUALDTOR)
312 set(CMAKE_REQUIRED_FLAGS ${OLD_CMAKE_REQUIRED_FLAGS})
313 append_if(CXX_WONT_WARN_ON_FINAL_NONVIRTUALDTOR
314 "-Wnon-virtual-dtor" CMAKE_CXX_FLAGS)
316 # Check if -Wcomment is OK with an // comment ending with '\' if the next
317 # line is also a // comment.
318 set(OLD_CMAKE_REQUIRED_FLAGS ${CMAKE_REQUIRED_FLAGS})
319 set(CMAKE_REQUIRED_FLAGS "${CMAKE_REQUIRED_FLAGS} -Werror -Wcomment")
320 CHECK_C_SOURCE_COMPILES("// \\\\\\n//\\nint main() {return 0;}"
321 C_WCOMMENT_ALLOWS_LINE_WRAP)
322 set(CMAKE_REQUIRED_FLAGS ${OLD_CMAKE_REQUIRED_FLAGS})
323 if (NOT C_WCOMMENT_ALLOWS_LINE_WRAP)
324 append("-Wno-comment" CMAKE_C_FLAGS CMAKE_CXX_FLAGS)
326 endif (LLVM_ENABLE_WARNINGS)
327 append_if(LLVM_ENABLE_WERROR "-Werror" CMAKE_C_FLAGS CMAKE_CXX_FLAGS)
328 if (NOT LLVM_ENABLE_TIMESTAMPS)
329 add_flag_if_supported("-Werror=date-time" WERROR_DATE_TIME)
331 if (LLVM_ENABLE_CXX1Y)
332 check_cxx_compiler_flag("-std=c++1y" CXX_SUPPORTS_CXX1Y)
333 append_if(CXX_SUPPORTS_CXX1Y "-std=c++1y" CMAKE_CXX_FLAGS)
335 check_cxx_compiler_flag("-std=c++11" CXX_SUPPORTS_CXX11)
336 if (CXX_SUPPORTS_CXX11)
338 # MinGW and Cygwin are a bit stricter and lack things like
339 # 'strdup', 'stricmp', etc in c++11 mode.
340 append("-std=gnu++11" CMAKE_CXX_FLAGS)
342 append("-std=c++11" CMAKE_CXX_FLAGS)
345 message(FATAL_ERROR "LLVM requires C++11 support but the '-std=c++11' flag isn't supported.")
348 if (LLVM_ENABLE_MODULES)
349 set(OLD_CMAKE_REQUIRED_FLAGS ${CMAKE_REQUIRED_FLAGS})
350 set(CMAKE_REQUIRED_FLAGS "${CMAKE_REQUIRED_FLAGS} -fmodules -fcxx-modules")
351 # Check that we can build code with modules enabled, and that repeatedly
352 # including <cassert> still manages to respect NDEBUG properly.
353 CHECK_CXX_SOURCE_COMPILES("#undef NDEBUG
357 int main() { assert(this code is not compiled); }"
358 CXX_SUPPORTS_MODULES)
359 set(CMAKE_REQUIRED_FLAGS ${OLD_CMAKE_REQUIRED_FLAGS})
360 if (CXX_SUPPORTS_MODULES)
361 append_if(CXX_SUPPORTS_MODULES "-fmodules" CMAKE_C_FLAGS)
362 append_if(CXX_SUPPORTS_MODULES "-fmodules -fcxx-modules" CMAKE_CXX_FLAGS)
364 message(FATAL_ERROR "LLVM_ENABLE_MODULES is not supported by this compiler")
366 endif(LLVM_ENABLE_MODULES)
369 macro(append_common_sanitizer_flags)
370 # Append -fno-omit-frame-pointer and turn on debug info to get better
372 add_flag_if_supported("-fno-omit-frame-pointer" FNO_OMIT_FRAME_POINTER)
373 if (NOT uppercase_CMAKE_BUILD_TYPE STREQUAL "DEBUG" AND
374 NOT uppercase_CMAKE_BUILD_TYPE STREQUAL "RELWITHDEBINFO")
375 add_flag_if_supported("-gline-tables-only" GLINE_TABLES_ONLY)
377 # Use -O1 even in debug mode, otherwise sanitizers slowdown is too large.
378 if (uppercase_CMAKE_BUILD_TYPE STREQUAL "DEBUG")
379 add_flag_if_supported("-O1" O1)
383 # Turn on sanitizers if necessary.
384 if(LLVM_USE_SANITIZER)
386 if (LLVM_USE_SANITIZER STREQUAL "Address")
387 append_common_sanitizer_flags()
388 append("-fsanitize=address" CMAKE_C_FLAGS CMAKE_CXX_FLAGS)
389 elseif (LLVM_USE_SANITIZER MATCHES "Memory(WithOrigins)?")
390 append_common_sanitizer_flags()
391 append("-fsanitize=memory" CMAKE_C_FLAGS CMAKE_CXX_FLAGS)
392 if(LLVM_USE_SANITIZER STREQUAL "MemoryWithOrigins")
393 append("-fsanitize-memory-track-origins" CMAKE_C_FLAGS CMAKE_CXX_FLAGS)
395 elseif (LLVM_USE_SANITIZER STREQUAL "Undefined")
396 append_common_sanitizer_flags()
397 append("-fsanitize=undefined -fno-sanitize=vptr,function -fno-sanitize-recover"
398 CMAKE_C_FLAGS CMAKE_CXX_FLAGS)
399 elseif (LLVM_USE_SANITIZER STREQUAL "Thread")
400 append_common_sanitizer_flags()
401 append("-fsanitize=thread" CMAKE_C_FLAGS CMAKE_CXX_FLAGS)
403 message(WARNING "Unsupported value of LLVM_USE_SANITIZER: ${LLVM_USE_SANITIZER}")
406 message(WARNING "LLVM_USE_SANITIZER is not supported on this platform.")
410 # Turn on -gsplit-dwarf if requested
411 if(LLVM_USE_SPLIT_DWARF)
412 add_definitions("-gsplit-dwarf")
415 add_llvm_definitions( -D__STDC_CONSTANT_MACROS )
416 add_llvm_definitions( -D__STDC_FORMAT_MACROS )
417 add_llvm_definitions( -D__STDC_LIMIT_MACROS )
419 # clang doesn't print colored diagnostics when invoked from Ninja
421 CMAKE_CXX_COMPILER_ID STREQUAL "Clang" AND
422 CMAKE_GENERATOR STREQUAL "Ninja")
423 append("-fcolor-diagnostics" CMAKE_C_FLAGS CMAKE_CXX_FLAGS)
426 # Add flags for add_dead_strip().
427 # FIXME: With MSVS, consider compiling with /Gy and linking with /OPT:REF?
428 # But MinSizeRel seems to add that automatically, so maybe disable these
429 # flags instead if LLVM_NO_DEAD_STRIP is set.
430 if(NOT CYGWIN AND NOT WIN32)
431 if(NOT ${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
432 check_c_compiler_flag("-Werror -fno-function-sections" C_SUPPORTS_FNO_FUNCTION_SECTIONS)
433 if (C_SUPPORTS_FNO_FUNCTION_SECTIONS)
434 # Don't add -ffunction-section if it can be disabled with -fno-function-sections.
435 # Doing so will break sanitizers.
436 add_flag_if_supported("-ffunction-sections" FFUNCTION_SECTIONS)
438 add_flag_if_supported("-fdata-sections" FDATA_SECTIONS)
443 # Prune --out-implib from executables. It doesn't make sense even
444 # with --export-all-symbols.
445 string(REGEX REPLACE "-Wl,--out-implib,[^ ]+ " " "
446 CMAKE_C_LINK_EXECUTABLE "${CMAKE_C_LINK_EXECUTABLE}")
447 string(REGEX REPLACE "-Wl,--out-implib,[^ ]+ " " "
448 CMAKE_CXX_LINK_EXECUTABLE "${CMAKE_CXX_LINK_EXECUTABLE}")
452 # Remove flags here, for exceptions and RTTI.
453 # Each target property or source property should be responsible to control
455 # CL.EXE complains to override flags like "/GR /GR-".
456 string(REGEX REPLACE "(^| ) */EH[-cs]+ *( |$)" "\\1 \\2" CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}")
457 string(REGEX REPLACE "(^| ) */GR-? *( |$)" "\\1 \\2" CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}")
460 # Provide public options to globally control RTTI and EH
461 option(LLVM_ENABLE_EH "Enable Exception handling" OFF)
462 option(LLVM_ENABLE_RTTI "Enable run time type information" OFF)
463 if(LLVM_ENABLE_EH AND NOT LLVM_ENABLE_RTTI)
464 message(FATAL_ERROR "Exception handling requires RTTI. You must set LLVM_ENABLE_RTTI to ON")
468 # FIXME: Make this configurable.
470 if(BUILD_SHARED_LIBS)
471 set(LLVM_ENABLE_PLUGINS ON)
473 set(LLVM_ENABLE_PLUGINS OFF)
476 set(LLVM_ENABLE_PLUGINS ON)