From: Andres Noetzli Date: Wed, 16 Mar 2022 00:10:23 +0000 (-0700) Subject: Ignore `CMAKE_SYSROOT` when cross-compiling (#8318) X-Git-Tag: cvc5-1.0.0~247 X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=486bd5a12ae9505ef484935abd6eae6d9b2495c2;p=cvc5.git Ignore `CMAKE_SYSROOT` when cross-compiling (#8318) This commit changes our build system to ignore CMAKE_SYSROOT for find_file(), find_path(), and find_library() when cross-compiling. Previously, it could happen that, e.g., when we were cross-compiling a static build for Windows, CMake would pick up /usr/lib/libgmp.a instead of cross-compiling GMP. The comments in the Toolchain-*.cmake files suggest that the new behavior was the intended behavior all along. --- diff --git a/cmake/Toolchain-aarch64.cmake b/cmake/Toolchain-aarch64.cmake index cb9e1167e..55012c6be 100644 --- a/cmake/Toolchain-aarch64.cmake +++ b/cmake/Toolchain-aarch64.cmake @@ -30,5 +30,5 @@ SET(CMAKE_FIND_ROOT_PATH /usr/${TOOLCHAIN_PREFIX}) # search headers and libraries in the target environment, search # programs in the host environment set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER) -set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY BOTH) -set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE BOTH) +set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY) +set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY) diff --git a/cmake/Toolchain-mingw64.cmake b/cmake/Toolchain-mingw64.cmake index f207875af..f3b6be9da 100644 --- a/cmake/Toolchain-mingw64.cmake +++ b/cmake/Toolchain-mingw64.cmake @@ -30,6 +30,6 @@ SET(CMAKE_FIND_ROOT_PATH /usr/${TOOLCHAIN_PREFIX}) # search headers and libraries in the target environment, search # programs in the host environment set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER) -set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY BOTH) -set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE BOTH) +set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY) +set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)