[llvm] 5664b56 - [CMake][Z3]Don't attempt to compile / run if cross-compiling (#66355)

via llvm-commits llvm-commits at lists.llvm.org
Fri Sep 15 03:57:37 PDT 2023


Author: Zhang
Date: 2023-09-15T12:57:33+02:00
New Revision: 5664b56043f1f6a838183e74275bfee389fea177

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

LOG: [CMake][Z3]Don't attempt to compile / run if cross-compiling (#66355)

Otherwise CMake might throw and error:
CMake Error: try_run() invoked in cross-compiling mode, please set the
following cache variables appropriately:
   Z3_RETURNCODE (advanced)
   Z3_RETURNCODE__TRYRUN_OUTPUT (advanced)

Added: 
    

Modified: 
    llvm/cmake/modules/FindZ3.cmake

Removed: 
    


################################################################################
diff  --git a/llvm/cmake/modules/FindZ3.cmake b/llvm/cmake/modules/FindZ3.cmake
index 72fb5a96a52b9d6..2981753c84fe11c 100644
--- a/llvm/cmake/modules/FindZ3.cmake
+++ b/llvm/cmake/modules/FindZ3.cmake
@@ -75,7 +75,7 @@ unset(Z3_VERSION_STRING)
 
 # First, try to check it dynamically, by compiling a small program that
 # prints Z3's version
-if(Z3_INCLUDE_DIR AND Z3_LIBRARIES)
+if(Z3_INCLUDE_DIR AND Z3_LIBRARIES AND NOT CMAKE_CROSSCOMPILING)
   # We do not have the Z3 binary to query for a version. Try to use
   # a small C++ program to detect it via the Z3_get_version() API call.
   check_z3_version(${Z3_INCLUDE_DIR} ${Z3_LIBRARIES})


        


More information about the llvm-commits mailing list