[PATCH] D40087: [CMake][runtimes] Use cmake_parse_arguments in runtimes functions

Petr Hosek via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Nov 16 13:29:02 PST 2017


This revision was automatically updated to reflect the committed changes.
Closed by commit rL318457: [CMake][runtimes] Use cmake_parse_arguments in runtimes functions (authored by phosek).

Changed prior to commit:
  https://reviews.llvm.org/D40087?vs=123043&id=123237#toc

Repository:
  rL LLVM

https://reviews.llvm.org/D40087

Files:
  llvm/trunk/runtimes/CMakeLists.txt


Index: llvm/trunk/runtimes/CMakeLists.txt
===================================================================
--- llvm/trunk/runtimes/CMakeLists.txt
+++ llvm/trunk/runtimes/CMakeLists.txt
@@ -298,7 +298,9 @@
     list(APPEND runtime_names ${projName})
   endforeach()
 
-  function(runtime_default_target deps prefixes)
+  function(runtime_default_target)
+    cmake_parse_arguments(ARG "" "" "DEPS;PREFIXES" ${ARGN})
+
     include(${LLVM_BINARY_DIR}/runtimes/Components.cmake OPTIONAL)
     set_property(DIRECTORY APPEND PROPERTY CMAKE_CONFIGURE_DEPENDS ${LLVM_BINARY_DIR}/runtimes/Components.cmake)
 
@@ -317,15 +319,15 @@
 
     llvm_ExternalProject_Add(runtimes
                              ${CMAKE_CURRENT_SOURCE_DIR}
-                             DEPENDS ${deps}
+                             DEPENDS ${ARG_DEPS}
                              # Builtins were built separately above
                              CMAKE_ARGS -DCOMPILER_RT_BUILD_BUILTINS=Off
                                         -DLLVM_INCLUDE_TESTS=${LLVM_INCLUDE_TESTS}
                                         -DLLVM_LIBRARY_DIR=${LLVM_LIBRARY_DIR}
                                         -DCMAKE_C_COMPILER_WORKS=ON
                                         -DCMAKE_CXX_COMPILER_WORKS=ON
                                         -DCMAKE_ASM_COMPILER_WORKS=ON
-                             PASSTHROUGH_PREFIXES ${prefixes}
+                             PASSTHROUGH_PREFIXES ${ARG_PREFIXES}
                              EXTRA_TARGETS ${extra_targets}
                                            ${test_targets}
                                            ${SUB_COMPONENTS}
@@ -337,11 +339,12 @@
 
   # runtime_register_target(target)
   #   Utility function to register external runtime target.
-  function(runtime_register_target name target deps prefixes)
+  function(runtime_register_target name target)
+    cmake_parse_arguments(ARG "" "" "DEPS" ${ARGN})
     include(${LLVM_BINARY_DIR}/runtimes/${name}/Components.cmake OPTIONAL)
     set_property(DIRECTORY APPEND PROPERTY CMAKE_CONFIGURE_DEPENDS ${LLVM_BINARY_DIR}/runtimes/${name}/Components.cmake)
 
-    set(${name}_deps ${deps})
+    set(${name}_deps ${ARG_DEPS})
     if(NOT name STREQUAL target)
       list(APPEND ${name}_deps runtimes-${target})
     endif()
@@ -398,7 +401,6 @@
                                         -DLLVM_RUNTIMES_TARGET=${name}
                                         ${${name}_extra_args}
                              TOOLCHAIN_TOOLS clang lld llvm-ar llvm-ranlib
-                             PASSTHROUGH_PREFIXES ${prefixes}
                              EXTRA_TARGETS ${${name}_extra_targets}
                                            ${${name}_test_targets}
                              USE_TOOLCHAIN
@@ -410,10 +412,15 @@
     # The runtimes target is a configuration of all the runtime libraries
     # together in a single CMake invocaiton.
     if(NOT LLVM_RUNTIME_TARGETS)
-      runtime_default_target(${deps} ${prefixes})
+      runtime_default_target(
+        DEPS ${deps}
+        PREFIXES ${prefixes}
+        )
     else()
       if("default" IN_LIST LLVM_RUNTIME_TARGETS)
-        runtime_default_target(${deps} ${prefixes})
+        runtime_default_target(
+          DEPS ${deps}
+          PREFIXES ${prefixes})
         list(REMOVE_ITEM LLVM_RUNTIME_TARGETS "default")
       else()
         add_custom_target(runtimes)
@@ -435,7 +442,9 @@
           list(GET target_list 1 target)
         endif()
 
-        runtime_register_target(${name} ${target} ${deps} ${prefixes})
+        runtime_register_target(${name} ${target}
+          DEPS ${deps}
+          )
 
         add_dependencies(runtimes runtimes-${name})
         add_dependencies(runtimes-configure runtimes-${name}-configure)


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D40087.123237.patch
Type: text/x-patch
Size: 3784 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20171116/a6878a8c/attachment.bin>


More information about the llvm-commits mailing list