[PATCH] D81574: [CMake][runtimes] Skip adding 2nd set of the same variables for a generic target

Kristina Bessonova via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Jun 10 07:37:40 PDT 2020


krisb created this revision.
krisb added reviewers: phosek, compnerd.
Herald added subscribers: llvm-commits, mgorny.
Herald added a project: LLVM.

No need to parse and add the same variables twice if runtimes is being
built for a generic target (i.e. w/o multilib).


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D81574

Files:
  llvm/runtimes/CMakeLists.txt


Index: llvm/runtimes/CMakeLists.txt
===================================================================
--- llvm/runtimes/CMakeLists.txt
+++ llvm/runtimes/CMakeLists.txt
@@ -462,14 +462,16 @@
         list(APPEND ${name}_extra_args "-D${new_name}=${new_value}")
       endif()
     endforeach()
-    foreach(variableName ${variableNames})
-      string(FIND "${variableName}" "RUNTIMES_${name}_" out)
-      if("${out}" EQUAL 0)
-        string(REPLACE "RUNTIMES_${name}_" "" new_name ${variableName})
-        string(REPLACE ";" "|" new_value "${${variableName}}")
-        list(APPEND ${name}_extra_args "-D${new_name}=${new_value}")
-      endif()
-    endforeach()
+    if(NOT "${name}" STREQUAL "${target}")
+      foreach(variableName ${variableNames})
+        string(FIND "${variableName}" "RUNTIMES_${name}_" out)
+        if("${out}" EQUAL 0)
+          string(REPLACE "RUNTIMES_${name}_" "" new_name ${variableName})
+          string(REPLACE ";" "|" new_value "${${variableName}}")
+          list(APPEND ${name}_extra_args "-D${new_name}=${new_value}")
+        endif()
+      endforeach()
+    endif()
 
     if(NOT RUNTIMES_${name}_LLVM_ENABLE_RUNTIMES AND NOT RUNTIMES_${target}_LLVM_ENABLE_RUNTIMES)
       string(REPLACE ";" "|" LLVM_ENABLE_RUNTIMES_PASSTHROUGH "${LLVM_ENABLE_RUNTIMES}")


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D81574.269842.patch
Type: text/x-patch
Size: 1307 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20200610/2f35f69f/attachment-0001.bin>


More information about the llvm-commits mailing list