Add LLVM_ENABLE_MODULES flag to CMake to enable building with C++ modules.
[oota-llvm.git] / cmake / modules / AddLLVM.cmake
index 409a5d61e65be6e8b6514d1f07a2834af5e61206..57e8955ccd9ba6ea5176a95c150310686788c4a6 100644 (file)
@@ -310,6 +310,12 @@ function(llvm_add_library name)
   endif()
 
   if(ARG_MODULE OR ARG_SHARED)
+    # Do not add -Dname_EXPORTS to the command-line when building files in this
+    # target. Doing so is actively harmful for the modules build because it
+    # creates extra module variants, and not useful because we don't use these
+    # macros.
+    set_target_properties( ${name} PROPERTIES DEFINE_SYMBOL "" )
+
     if (LLVM_EXPORTED_SYMBOL_FILE)
       add_llvm_symbol_exports( ${name} ${LLVM_EXPORTED_SYMBOL_FILE} )
     endif()
@@ -435,6 +441,12 @@ macro(add_llvm_executable name)
   llvm_update_compile_flags(${name})
   add_dead_strip( ${name} )
 
+  # Do not add -Dname_EXPORTS to the command-line when building files in this
+  # target. Doing so is actively harmful for the modules build because it
+  # creates extra module variants, and not useful because we don't use these
+  # macros.
+  set_target_properties( ${name} PROPERTIES DEFINE_SYMBOL "" )
+
   if (LLVM_EXPORTED_SYMBOL_FILE)
     add_llvm_symbol_exports( ${name} ${LLVM_EXPORTED_SYMBOL_FILE} )
   endif(LLVM_EXPORTED_SYMBOL_FILE)