[CMake] llvm_update_compile_flags: Honor LLVM_COMPILE_FLAGS.
authorNAKAMURA Takumi <geek4civic@gmail.com>
Thu, 30 Jan 2014 22:55:25 +0000 (22:55 +0000)
committerNAKAMURA Takumi <geek4civic@gmail.com>
Thu, 30 Jan 2014 22:55:25 +0000 (22:55 +0000)
I accidentally mis-dropped LLVM_COMPILE_FLAGS in r200301. Sorry for that.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@200499 91177308-0d34-0410-b5e6-96231b3b80d8

cmake/modules/AddLLVM.cmake

index 19a68387fee33f7f12405fe62d49e450d2d35f5c..301aeea80f5f95e64cede1f5f97f73ca90fe2b6b 100644 (file)
@@ -12,22 +12,27 @@ function(llvm_update_compile_flags name)
     set(LLVM_REQUIRES_RTTI ON)
   else()
     if(LLVM_COMPILER_IS_GCC_COMPATIBLE)
     set(LLVM_REQUIRES_RTTI ON)
   else()
     if(LLVM_COMPILER_IS_GCC_COMPATIBLE)
-      set(target_compile_flags "${target_compile_flags} -fno-exceptions")
+      list(APPEND LLVM_COMPILE_FLAGS "-fno-exceptions")
     elseif(MSVC)
       list(APPEND LLVM_COMPILE_DEFINITIONS _HAS_EXCEPTIONS=0)
     elseif(MSVC)
       list(APPEND LLVM_COMPILE_DEFINITIONS _HAS_EXCEPTIONS=0)
-      set(target_compile_flags "${target_compile_flags} /EHs-c-")
+      list(APPEND LLVM_COMPILE_FLAGS "/EHs-c-")
     endif()
   endif()
 
   if(NOT LLVM_REQUIRES_RTTI)
     list(APPEND LLVM_COMPILE_DEFINITIONS GTEST_HAS_RTTI=0)
     if (LLVM_COMPILER_IS_GCC_COMPATIBLE)
     endif()
   endif()
 
   if(NOT LLVM_REQUIRES_RTTI)
     list(APPEND LLVM_COMPILE_DEFINITIONS GTEST_HAS_RTTI=0)
     if (LLVM_COMPILER_IS_GCC_COMPATIBLE)
-      set(target_compile_flags "${target_compile_flags} -fno-rtti")
+      list(APPEND LLVM_COMPILE_FLAGS "-fno-rtti")
     elseif (MSVC)
     elseif (MSVC)
-      set(target_compile_flags "${target_compile_flags} /GR-")
+      list(APPEND LLVM_COMPILE_FLAGS "/GR-")
     endif ()
   endif()
 
     endif ()
   endif()
 
+  # Assume that;
+  #   - LLVM_COMPILE_FLAGS is list.
+  #   - PROPERTY COMPILE_FLAGS is string.
+  string(REPLACE ";" " " target_compile_flags "${LLVM_COMPILE_FLAGS}")
+
   if(update_src_props)
     foreach(fn ${sources})
       get_filename_component(suf ${fn} EXT)
   if(update_src_props)
     foreach(fn ${sources})
       get_filename_component(suf ${fn} EXT)
@@ -399,7 +404,7 @@ function(add_unittest test_suite test_name)
   endif ()
 
   if (SUPPORTS_NO_VARIADIC_MACROS_FLAG)
   endif ()
 
   if (SUPPORTS_NO_VARIADIC_MACROS_FLAG)
-    set(LLVM_COMPILE_FLAGS "-Wno-variadic-macros")
+    list(APPEND LLVM_COMPILE_FLAGS "-Wno-variadic-macros")
   endif ()
 
   set(LLVM_REQUIRES_RTTI OFF)
   endif ()
 
   set(LLVM_REQUIRES_RTTI OFF)