[flang-commits] [clang] [compiler-rt] [flang] [libc] [llvm] [polly] [cmake] Drop `AddFileDependencies` and `CMakeParseArguments` (PR #120002)

via flang-commits flang-commits at lists.llvm.org
Sun Dec 15 04:13:59 PST 2024


https://github.com/paperchalice created https://github.com/llvm/llvm-project/pull/120002

Theses modules are deprecated and have trivial implementations in modern cmake.

>From 7d7d410e4893de02f69309c5e95f58c949df643a Mon Sep 17 00:00:00 2001
From: PaperChalice <liujunchang97 at outlook.com>
Date: Sat, 14 Dec 2024 15:50:00 +0800
Subject: [PATCH 1/2] [cmake] Drop `AddFileDependencies` and
 `CMakeParseArguments`

Theses modules are deprecated and have trivial implementations in modern cmake.
---
 llvm/cmake/modules/LLVMProcessSources.cmake | 3 ---
 llvm/tools/llvm-config/CMakeLists.txt       | 4 +++-
 2 files changed, 3 insertions(+), 4 deletions(-)

diff --git a/llvm/cmake/modules/LLVMProcessSources.cmake b/llvm/cmake/modules/LLVMProcessSources.cmake
index 205089bd2704cb..0670d60bf2afd7 100644
--- a/llvm/cmake/modules/LLVMProcessSources.cmake
+++ b/llvm/cmake/modules/LLVMProcessSources.cmake
@@ -1,6 +1,3 @@
-include(AddFileDependencies)
-include(CMakeParseArguments)
-
 function(llvm_replace_compiler_option var old new)
   # Replaces a compiler option or switch `old' in `var' by `new'.
   # If `old' is not in `var', appends `new' to `var'.
diff --git a/llvm/tools/llvm-config/CMakeLists.txt b/llvm/tools/llvm-config/CMakeLists.txt
index e02bda1ead50c0..02c2532dba77a7 100644
--- a/llvm/tools/llvm-config/CMakeLists.txt
+++ b/llvm/tools/llvm-config/CMakeLists.txt
@@ -89,7 +89,9 @@ if(LLVM_ENABLE_MODULES)
 endif()
 
 # Add the dependency on the generation step.
-add_file_dependencies(${CMAKE_CURRENT_SOURCE_DIR}/llvm-config.cpp ${BUILDVARIABLES_OBJPATH})
+set_property(SOURCE ${CMAKE_CURRENT_SOURCE_DIR}/llvm-config.cpp
+  APPEND PROPERTY OBJECT_DEPENDS ${BUILDVARIABLES_OBJPATH}
+)
 
 if(CMAKE_CROSSCOMPILING)
   if (LLVM_NATIVE_TOOL_DIR AND NOT LLVM_CONFIG_PATH)

>From d8143aadc14c6bcaaf014093499918ee25ddcf6f Mon Sep 17 00:00:00 2001
From: paperchalice <liujunchang97 at outlook.com>
Date: Sun, 15 Dec 2024 20:13:00 +0800
Subject: [PATCH 2/2] [cmake] Update for other projects

---
 clang/CMakeLists.txt                                  | 1 -
 compiler-rt/cmake/Modules/CompilerRTAIXUtils.cmake    | 1 -
 compiler-rt/cmake/Modules/CompilerRTDarwinUtils.cmake | 1 -
 flang/CMakeLists.txt                                  | 2 --
 libc/CMakeLists.txt                                   | 1 -
 polly/cmake/polly_macros.cmake                        | 3 ---
 6 files changed, 9 deletions(-)

diff --git a/clang/CMakeLists.txt b/clang/CMakeLists.txt
index 27e8095534a65c..b79e570667b2c4 100644
--- a/clang/CMakeLists.txt
+++ b/clang/CMakeLists.txt
@@ -362,7 +362,6 @@ if (APPLE AND NOT CMAKE_LINKER MATCHES ".*lld.*")
   message(STATUS "Host linker version: ${HOST_LINK_VERSION}")
 endif()
 
-include(CMakeParseArguments)
 include(AddClang)
 
 set(CMAKE_INCLUDE_CURRENT_DIR ON)
diff --git a/compiler-rt/cmake/Modules/CompilerRTAIXUtils.cmake b/compiler-rt/cmake/Modules/CompilerRTAIXUtils.cmake
index d8a491dbbd732a..53aa750d934d72 100644
--- a/compiler-rt/cmake/Modules/CompilerRTAIXUtils.cmake
+++ b/compiler-rt/cmake/Modules/CompilerRTAIXUtils.cmake
@@ -1,4 +1,3 @@
-include(CMakeParseArguments)
 include(CompilerRTUtils)
 
 function(get_aix_libatomic_default_link_flags link_flags export_list)
diff --git a/compiler-rt/cmake/Modules/CompilerRTDarwinUtils.cmake b/compiler-rt/cmake/Modules/CompilerRTDarwinUtils.cmake
index 74a5d4edcd859f..fa8c6be6c5d462 100644
--- a/compiler-rt/cmake/Modules/CompilerRTDarwinUtils.cmake
+++ b/compiler-rt/cmake/Modules/CompilerRTDarwinUtils.cmake
@@ -1,4 +1,3 @@
-include(CMakeParseArguments)
 include(CompilerRTUtils)
 include(BuiltinTests)
 
diff --git a/flang/CMakeLists.txt b/flang/CMakeLists.txt
index 971e5d5c93f231..e1e40bd70390a6 100644
--- a/flang/CMakeLists.txt
+++ b/flang/CMakeLists.txt
@@ -117,7 +117,6 @@ if (FLANG_STANDALONE_BUILD)
     set(USE_NO_MAYBE_UNINITIALIZED 1)
   endif()
 
-  include(CMakeParseArguments)
   include(AddLLVM)
   include(HandleLLVMOptions)
   include(VersionFromVCS)
@@ -445,7 +444,6 @@ if (APPLE)
   endif()
 endif()
 
-include(CMakeParseArguments)
 include(AddFlang)
 
 if (FLANG_INCLUDE_TESTS)
diff --git a/libc/CMakeLists.txt b/libc/CMakeLists.txt
index 88cc75e83b043d..00a07ea3c8ac75 100644
--- a/libc/CMakeLists.txt
+++ b/libc/CMakeLists.txt
@@ -329,7 +329,6 @@ endif()
 
 option(LIBC_INCLUDE_DOCS "Build the libc documentation." ${LLVM_INCLUDE_DOCS})
 
-include(CMakeParseArguments)
 include(LLVMLibCCheckCpuFeatures)
 include(CheckCompilerFeatures)
 include(LLVMLibCRules)
diff --git a/polly/cmake/polly_macros.cmake b/polly/cmake/polly_macros.cmake
index a791be4fa5bc87..ddd6376273376a 100644
--- a/polly/cmake/polly_macros.cmake
+++ b/polly/cmake/polly_macros.cmake
@@ -1,6 +1,3 @@
-
-include(CMakeParseArguments)
-
 macro(add_polly_library name)
   cmake_parse_arguments(ARG "" "" "" ${ARGN})
   set(srcs ${ARG_UNPARSED_ARGUMENTS})



More information about the flang-commits mailing list