From e74fba3d9cf2f6930732344e84a4086d707e6c17 Mon Sep 17 00:00:00 2001 From: Harmen Stoppels Date: Thu, 20 Jun 2024 12:42:06 +0200 Subject: [PATCH] find_library: Search per-arch lib directories when compiling with sysroot When using Gentoo Prefix on Debian, find_library for libm.so fails, because it needs to locate the lib in $sysroot/usr/lib64/libm.so, i.e. lib64/ not lib/. To fix this, do not disable per-arch lib directories when a sysroot is set. Fixes: #26069 --- Modules/Platform/Linux.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Modules/Platform/Linux.cmake b/Modules/Platform/Linux.cmake index fba6ab81b7..58749deafa 100644 --- a/Modules/Platform/Linux.cmake +++ b/Modules/Platform/Linux.cmake @@ -84,7 +84,7 @@ include(Platform/UnixPaths) # Debian has lib32 and lib64 paths only for compatibility so they should not be # searched. -if(NOT CMAKE_CROSSCOMPILING) +if(NOT CMAKE_CROSSCOMPILING AND NOT CMAKE_COMPILER_SYSROOT) if (EXISTS "/etc/debian_version") set_property(GLOBAL PROPERTY FIND_LIBRARY_USE_LIB32_PATHS FALSE) set_property(GLOBAL PROPERTY FIND_LIBRARY_USE_LIB64_PATHS FALSE)