summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJames Le Cuirot <chewi@gentoo.org>2023-02-27 23:19:46 +0000
committerJames Le Cuirot <chewi@gentoo.org>2023-03-18 21:35:32 +0000
commitc9a840065a2553871dd298e933da2874bf26062b (patch)
treed11e78f2655dce876478941b42a30ec2531f634f /eclass/cmake.eclass
parentgames-util/lgogdownloader: Bump to 3.10, drop old 3.9 (diff)
downloadgentoo-c9a840065a2553871dd298e933da2874bf26062b.tar.gz
gentoo-c9a840065a2553871dd298e933da2874bf26062b.tar.bz2
gentoo-c9a840065a2553871dd298e933da2874bf26062b.zip
cmake.eclass: Set CMAKE_SYSROOT in toolchain file when necessary
We previously set CMAKE_FIND_ROOT_PATH, but CMAKE_SYSROOT also sets this and more. The latter is needed when cross-compiling Fortran code such as sci-libs/lapack. Without this, it uses the toolchain's default sysroot, adds a -L/usr/${CHOST}/usr/lib flag based on that, reads the libc.so.6 ld script from this directory, does not apply any sysroot to the paths within because the script is outside the sysroot, and finally fails when attempting to link the host's libc.so.6. Signed-off-by: James Le Cuirot <chewi@gentoo.org>
Diffstat (limited to 'eclass/cmake.eclass')
-rw-r--r--eclass/cmake.eclass2
1 files changed, 1 insertions, 1 deletions
diff --git a/eclass/cmake.eclass b/eclass/cmake.eclass
index 76c63977aa07..03f2517c5b56 100644
--- a/eclass/cmake.eclass
+++ b/eclass/cmake.eclass
@@ -489,7 +489,7 @@ cmake_src_configure() {
# When cross-compiling with a sysroot (e.g. with crossdev's emerge wrappers)
# we need to tell cmake to use libs/headers from the sysroot but programs from / only.
cat >> "${toolchain_file}" <<- _EOF_ || die
- set(CMAKE_FIND_ROOT_PATH "${SYSROOT}")
+ set(CMAKE_SYSROOT "${ESYSROOT}")
set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER)
set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)
set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)