[llvm] 5a39bf2 - [CMake][runtimes] Skip adding 2nd set of the same variables for a generic target

Kristina Bessonova via llvm-commits llvm-commits at lists.llvm.org
Mon Jun 15 01:00:43 PDT 2020


Author: Kristina Bessonova
Date: 2020-06-15T09:59:27+02:00
New Revision: 5a39bf2dc5aeb1cc461e808635e35317a3eb29ad

URL: https://github.com/llvm/llvm-project/commit/5a39bf2dc5aeb1cc461e808635e35317a3eb29ad
DIFF: https://github.com/llvm/llvm-project/commit/5a39bf2dc5aeb1cc461e808635e35317a3eb29ad.diff

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

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

Reviewed By: phosek

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

Added: 
    

Modified: 
    llvm/runtimes/CMakeLists.txt

Removed: 
    


################################################################################
diff  --git a/llvm/runtimes/CMakeLists.txt b/llvm/runtimes/CMakeLists.txt
index 94dabb81484c..824d17e7242a 100644
--- a/llvm/runtimes/CMakeLists.txt
+++ b/llvm/runtimes/CMakeLists.txt
@@ -462,14 +462,16 @@ else() # if this is included from LLVM's CMake
         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}")


        


More information about the llvm-commits mailing list