summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNicole Rabjohn <nicolerabjohn@gmail.com>2022-12-13 19:54:52 -0500
committerDavid Tenty <daltenty@ibm.com>2022-12-13 20:03:50 -0500
commit2ee308ceea88a4a3c3eb56de9ad6ed7abcdd3bde (patch)
tree925c22fb441cac0383b86c189f216b500951efc9
parentbeb3fa2d2efbdc1fbedee2d5c587eae1364652d3 (diff)
downloadllvm-2ee308ceea88a4a3c3eb56de9ad6ed7abcdd3bde.tar.gz
[CMake] Setting the LLVM_TARGET_TRIPLE macro based on the LLVM_DEFAULT_TARGET_TRIPLE
After D137870, LLVM_TARGET_TRIPLE is no longer defined on the runtime path into compiler-rt. This patch creates a common block of code to set LLVM_TARGET_TRIPLE equal to the default for both the llvm- and runtime- paths. Differential Revision: https://reviews.llvm.org/D138864
-rw-r--r--llvm/CMakeLists.txt13
-rw-r--r--llvm/cmake/modules/SetTargetTriple.cmake13
-rw-r--r--runtimes/CMakeLists.txt3
3 files changed, 18 insertions, 11 deletions
diff --git a/llvm/CMakeLists.txt b/llvm/CMakeLists.txt
index 8191b27e99f0..fb2fdea19274 100644
--- a/llvm/CMakeLists.txt
+++ b/llvm/CMakeLists.txt
@@ -857,17 +857,8 @@ else()
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)
diff --git a/llvm/cmake/modules/SetTargetTriple.cmake b/llvm/cmake/modules/SetTargetTriple.cmake
new file mode 100644
index 000000000000..ed0a53ca3ec9
--- /dev/null
+++ b/llvm/cmake/modules/SetTargetTriple.cmake
@@ -0,0 +1,13 @@
+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()
diff --git a/runtimes/CMakeLists.txt b/runtimes/CMakeLists.txt
index 1626b7b9786c..50f782205ab4 100644
--- a/runtimes/CMakeLists.txt
+++ b/runtimes/CMakeLists.txt
@@ -176,6 +176,9 @@ endif()
# 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)