[CMake] Passthrough CMAKE_SYSTEM_NAME to default builtin and runtimes target
authorPetr Hosek <phosek@google.com>
Fri, 31 Jan 2020 22:53:07 +0000 (14:53 -0800)
committerPetr Hosek <phosek@google.com>
Wed, 5 Feb 2020 06:38:20 +0000 (22:38 -0800)
When building the default builtin and runtimes target, set the
CMAKE_SYSTEM_NAME to the current one. This is not necessary on
Linux and Darwin, but it appears to be necessary on Windows,
otherwise CMake fails.

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

llvm/runtimes/CMakeLists.txt

index 40869f0..6d68b07 100644 (file)
@@ -245,6 +245,7 @@ else() # if this is included from LLVM's CMake
                                         -DCMAKE_ASM_COMPILER_TARGET=${TARGET_TRIPLE}
                                         -DCMAKE_C_COMPILER_WORKS=ON
                                         -DCMAKE_ASM_COMPILER_WORKS=ON
+                                        -DCMAKE_SYSTEM_NAME=${CMAKE_SYSTEM_NAME}
                              PASSTHROUGH_PREFIXES COMPILER_RT
                              USE_TOOLCHAIN
                              ${EXTRA_ARGS})
@@ -390,6 +391,7 @@ else() # if this is included from LLVM's CMake
                                         -DCMAKE_C_COMPILER_WORKS=ON
                                         -DCMAKE_CXX_COMPILER_WORKS=ON
                                         -DCMAKE_ASM_COMPILER_WORKS=ON
+                                        -DCMAKE_SYSTEM_NAME=${CMAKE_SYSTEM_NAME}
                              PASSTHROUGH_PREFIXES LLVM_ENABLE_RUNTIMES
                                                   ${ARG_PREFIXES}
                              EXTRA_TARGETS ${extra_targets}