[llvm] c74da05 - [CMake] Make sure _cmake_system_name has a default

David Tenty via llvm-commits llvm-commits at lists.llvm.org
Fri Sep 25 08:33:19 PDT 2020


Author: David Tenty
Date: 2020-09-25T11:33:12-04:00
New Revision: c74da051b8680d322328a1ba2e6c2ed794a74f59

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

LOG: [CMake] Make sure _cmake_system_name has a default

We currently try to pick it up from the CMake arguments passed to llvm_ExternalProject_Add but
if there isn't an explicit option passed, we should reflect CMake's own default behaviour
of targeting the host, since we'll make decisions about what tools to use for the build based on
the setting. Otherwise, we'll get different behaviour between configuring an external project with
the default target and configuring with an explicit one targeting the same platform.

Reviewed By: stevewan, hubert.reinterpretcast

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

Added: 
    

Modified: 
    llvm/cmake/modules/LLVMExternalProjectUtils.cmake

Removed: 
    


################################################################################
diff  --git a/llvm/cmake/modules/LLVMExternalProjectUtils.cmake b/llvm/cmake/modules/LLVMExternalProjectUtils.cmake
index c01a6dd71d9f..ad6475729fbd 100644
--- a/llvm/cmake/modules/LLVMExternalProjectUtils.cmake
+++ b/llvm/cmake/modules/LLVMExternalProjectUtils.cmake
@@ -52,6 +52,12 @@ function(llvm_ExternalProject_Add name source_dir)
     endif()
   endforeach()
 
+  # If CMAKE_SYSTEM_NAME is not set explicitly in the arguments passed to us,
+  # reflect CMake's own default.
+  if (NOT _cmake_system_name)
+    set(_cmake_system_name "${CMAKE_HOST_SYSTEM_NAME}")
+  endif()
+
   if(NOT ARG_TOOLCHAIN_TOOLS)
     set(ARG_TOOLCHAIN_TOOLS clang lld llvm-ar llvm-ranlib llvm-nm llvm-objdump)
     if(_cmake_system_name STREQUAL Darwin)


        


More information about the llvm-commits mailing list