[libcxx-commits] [PATCH] D138864: Setting the LLVM_TARGET_TRIPLE macro based on the LLVM_DEFAULT_TARGET_TRIPLE

Nicole Rabjohn via Phabricator via libcxx-commits libcxx-commits at lists.llvm.org
Mon Nov 28 14:26:58 PST 2022


nicolerabjohn updated this revision to Diff 478376.
nicolerabjohn added a comment.

Removing comment to allow for more generic use.


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D138864/new/

https://reviews.llvm.org/D138864

Files:
  llvm/CMakeLists.txt
  llvm/cmake/modules/SetTargetTriple.cmake
  runtimes/CMakeLists.txt


Index: runtimes/CMakeLists.txt
===================================================================
--- runtimes/CMakeLists.txt
+++ runtimes/CMakeLists.txt
@@ -169,6 +169,9 @@
 # This can be used to detect whether we're in the runtimes build.
 set(LLVM_RUNTIMES_BUILD ON)
 
+include(SetTargetTriple)
+set_llvm_target_triple()
+
 foreach(entry ${runtimes})
   get_filename_component(projName ${entry} NAME)
 
Index: llvm/cmake/modules/SetTargetTriple.cmake
===================================================================
--- /dev/null
+++ llvm/cmake/modules/SetTargetTriple.cmake
@@ -0,0 +1,14 @@
+
+macro(set_llvm_target_triple)
+  set(LLVM_DEFAULT_TARGET_TRIPLE "${LLVM_DEFAULT_TARGET_TRIPLE_default}" CACHE STRING
+  "Default target for which LLVM will generate code." )
+  if (TARGET_TRIPLE)
+    message(WARNING "TARGET_TRIPLE is deprecated and will be removed in a future release. "
+    "Please use LLVM_DEFAULT_TARGET_TRIPLE instead.")
+    set(LLVM_TARGET_TRIPLE "${TARGET_TRIPLE}")
+  else()
+    set(LLVM_TARGET_TRIPLE "${LLVM_DEFAULT_TARGET_TRIPLE}")
+  endif()
+  message(STATUS "LLVM host triple: ${LLVM_HOST_TRIPLE}")
+  message(STATUS "LLVM default target triple: ${LLVM_DEFAULT_TARGET_TRIPLE}")
+endmacro()
Index: llvm/CMakeLists.txt
===================================================================
--- llvm/CMakeLists.txt
+++ llvm/CMakeLists.txt
@@ -865,17 +865,8 @@
   endif()
 endif()
 
-set(LLVM_DEFAULT_TARGET_TRIPLE "${LLVM_DEFAULT_TARGET_TRIPLE_default}" CACHE STRING
-  "Default target for which LLVM will generate code." )
-if (TARGET_TRIPLE)
-  message(WARNING "TARGET_TRIPLE is deprecated and will be removed in a future release. "
-                  "Please use LLVM_DEFAULT_TARGET_TRIPLE instead.")
-  set(LLVM_TARGET_TRIPLE "${TARGET_TRIPLE}")
-else()
-  set(LLVM_TARGET_TRIPLE "${LLVM_DEFAULT_TARGET_TRIPLE}")
-endif()
-message(STATUS "LLVM host triple: ${LLVM_HOST_TRIPLE}")
-message(STATUS "LLVM default target triple: ${LLVM_DEFAULT_TARGET_TRIPLE}")
+include(SetTargetTriple)
+set_llvm_target_triple()
 
 if(WIN32 OR CYGWIN)
   if(BUILD_SHARED_LIBS OR LLVM_BUILD_LLVM_DYLIB)


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D138864.478376.patch
Type: text/x-patch
Size: 2115 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/libcxx-commits/attachments/20221128/88d12164/attachment.bin>


More information about the libcxx-commits mailing list