[llvm] 36adb82 - LLVMProcessSources.cmake: Improve PARTIAL_SOURCES_INTENDED.

NAKAMURA Takumi via llvm-commits llvm-commits at lists.llvm.org
Sun Feb 12 03:13:27 PST 2023


Author: NAKAMURA Takumi
Date: 2023-02-12T20:12:37+09:00
New Revision: 36adb82c251d2d0627856b648a1c357fa7f3864e

URL: https://github.com/llvm/llvm-project/commit/36adb82c251d2d0627856b648a1c357fa7f3864e
DIFF: https://github.com/llvm/llvm-project/commit/36adb82c251d2d0627856b648a1c357fa7f3864e.diff

LOG: LLVMProcessSources.cmake: Improve PARTIAL_SOURCES_INTENDED.

The last non-partial-specified target can collect and check source files.

Case A:
  llvm_add_library(foo PARTIAL_SOURCES_INTENDED ...)
  llvm_add_library(bar PARTIAL_SOURCES_INTENDED ...)
  llvm_add_library(baz ...)

  baz checks source files in foo, bar, and baz.

Case B:
  llvm_add_library(hoge PARTIAL_SOURCES_INTENDED ...)
  llvm_add_library(fuga PARTIAL_SOURCES_INTENDED ...)
  llvm_add_library(piyo PARTIAL_SOURCES_INTENDED ...)
  llvm_check_source_file_list() # Explicitly checks sources in hoge, fuga, and piyo.

Differential Revision: https://reviews.llvm.org/D142256

Added: 
    

Modified: 
    llvm/cmake/modules/LLVMProcessSources.cmake

Removed: 
    


################################################################################
diff  --git a/llvm/cmake/modules/LLVMProcessSources.cmake b/llvm/cmake/modules/LLVMProcessSources.cmake
index e021943d4b2ec..340aa7b43eaed 100644
--- a/llvm/cmake/modules/LLVMProcessSources.cmake
+++ b/llvm/cmake/modules/LLVMProcessSources.cmake
@@ -59,9 +59,7 @@ endfunction(find_all_header_files)
 function(llvm_process_sources OUT_VAR)
   cmake_parse_arguments(ARG "PARTIAL_SOURCES_INTENDED" "" "ADDITIONAL_HEADERS;ADDITIONAL_HEADER_DIRS" ${ARGN})
   set(sources ${ARG_UNPARSED_ARGUMENTS})
-  if (NOT ARG_PARTIAL_SOURCES_INTENDED)
-    llvm_check_source_file_list(${sources})
-  endif()
+  llvm_check_source_file_list(${sources})
 
   # This adds .td and .h files to the Visual Studio solution:
   add_td_sources(sources)
@@ -90,6 +88,12 @@ function(llvm_check_source_file_list)
     file(GLOB globbed *.c *.cpp)
   endif()
 
+  set_property(DIRECTORY APPEND PROPERTY LLVM_SOURCE_FILES ${listed})
+  if (ARG_PARTIAL_SOURCES_INTENDED) # llvm_process_source's scope
+    return()
+  endif()
+  get_directory_property(listed LLVM_SOURCE_FILES)
+
   foreach(g ${globbed})
     get_filename_component(fn ${g} NAME)
     if(ARG_SOURCE_DIR)


        


More information about the llvm-commits mailing list