[CMake] llvm_update_compile_flags(name) doesn't require source files. TARGET PROPERTY...
authorNAKAMURA Takumi <geek4civic@gmail.com>
Tue, 28 Jan 2014 11:40:04 +0000 (11:40 +0000)
committerNAKAMURA Takumi <geek4civic@gmail.com>
Tue, 28 Jan 2014 11:40:04 +0000 (11:40 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@200311 91177308-0d34-0410-b5e6-96231b3b80d8

cmake/modules/AddLLVM.cmake

index 6996c38..19a6838 100644 (file)
@@ -3,8 +3,8 @@ include(LLVMProcessSources)
 include(LLVM-Config)
 
 function(llvm_update_compile_flags name)
-  set(ALL_SOURCES ${ARGN})
-  if("${ALL_SOURCES}" MATCHES "\\.c(;|$)")
+  get_property(sources TARGET ${name} PROPERTY SOURCES)
+  if("${sources}" MATCHES "\\.c(;|$)")
     set(update_src_props ON)
   endif()
 
@@ -29,7 +29,7 @@ function(llvm_update_compile_flags name)
   endif()
 
   if(update_src_props)
-    foreach(fn ${ALL_SOURCES})
+    foreach(fn ${sources})
       get_filename_component(suf ${fn} EXT)
       if("${suf}" STREQUAL ".cpp")
        set_property(SOURCE ${fn} APPEND_STRING PROPERTY
@@ -162,7 +162,7 @@ macro(add_llvm_library name)
   add_library( ${name} ${ALL_FILES} )
   set_output_directory(${name} ${LLVM_RUNTIME_OUTPUT_INTDIR} ${LLVM_LIBRARY_OUTPUT_INTDIR})
   set_property( GLOBAL APPEND PROPERTY LLVM_LIBS ${name} )
-  llvm_update_compile_flags(${name} ${ALL_FILES})
+  llvm_update_compile_flags(${name})
   add_dead_strip( ${name} )
   if( LLVM_COMMON_DEPENDS )
     add_dependencies( ${name} ${LLVM_COMMON_DEPENDS} )
@@ -222,7 +222,7 @@ ${name} ignored.")
     add_library( ${name} ${libkind} ${ALL_FILES} )
     set_output_directory(${name} ${LLVM_RUNTIME_OUTPUT_INTDIR} ${LLVM_LIBRARY_OUTPUT_INTDIR})
     set_target_properties( ${name} PROPERTIES PREFIX "" )
-    llvm_update_compile_flags(${name} ${ALL_FILES})
+    llvm_update_compile_flags(${name})
     add_dead_strip( ${name} )
 
     if (LLVM_EXPORTED_SYMBOL_FILE)
@@ -264,7 +264,7 @@ macro(add_llvm_executable name)
   else()
     add_executable(${name} ${ALL_FILES})
   endif()
-  llvm_update_compile_flags(${name} ${ALL_FILES})
+  llvm_update_compile_flags(${name})
   add_dead_strip( ${name} )
 
   if (LLVM_EXPORTED_SYMBOL_FILE)