[PATCH] D142256: LLVMProcessSources.cmake: Improve PARTIAL_SOURCES_INTENDED.

NAKAMURA Takumi via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Jan 20 14:36:04 PST 2023


chapuni created this revision.
Herald added a subscriber: hiraditya.
Herald added a project: All.
chapuni requested review of this revision.
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.

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.

LLVMFuzzerCLI: [CMake] Prune the last PARTIAL_SOURCES_INTENDED to cover all sources.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D142256

Files:
  llvm/cmake/modules/LLVMProcessSources.cmake
  llvm/lib/FuzzMutate/CMakeLists.txt


Index: llvm/lib/FuzzMutate/CMakeLists.txt
===================================================================
--- llvm/lib/FuzzMutate/CMakeLists.txt
+++ llvm/lib/FuzzMutate/CMakeLists.txt
@@ -18,7 +18,6 @@
   OpDescriptor.cpp
   Operations.cpp
   RandomIRBuilder.cpp
-  PARTIAL_SOURCES_INTENDED
 
   ADDITIONAL_HEADER_DIRS
   ${LLVM_MAIN_INCLUDE_DIR}/llvm/FuzzMutate
Index: llvm/cmake/modules/LLVMProcessSources.cmake
===================================================================
--- llvm/cmake/modules/LLVMProcessSources.cmake
+++ llvm/cmake/modules/LLVMProcessSources.cmake
@@ -59,9 +59,7 @@
 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 @@
     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)


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D142256.490977.patch
Type: text/x-patch
Size: 1400 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20230120/0d6c56f9/attachment.bin>


More information about the llvm-commits mailing list