1 |
commit: c9a840065a2553871dd298e933da2874bf26062b |
2 |
Author: James Le Cuirot <chewi <AT> gentoo <DOT> org> |
3 |
AuthorDate: Mon Feb 27 23:19:46 2023 +0000 |
4 |
Commit: James Le Cuirot <chewi <AT> gentoo <DOT> org> |
5 |
CommitDate: Sat Mar 18 21:35:32 2023 +0000 |
6 |
URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=c9a84006 |
7 |
|
8 |
cmake.eclass: Set CMAKE_SYSROOT in toolchain file when necessary |
9 |
|
10 |
We previously set CMAKE_FIND_ROOT_PATH, but CMAKE_SYSROOT also sets this |
11 |
and more. The latter is needed when cross-compiling Fortran code such as |
12 |
sci-libs/lapack. Without this, it uses the toolchain's default sysroot, |
13 |
adds a -L/usr/${CHOST}/usr/lib flag based on that, reads the libc.so.6 |
14 |
ld script from this directory, does not apply any sysroot to the paths |
15 |
within because the script is outside the sysroot, and finally fails when |
16 |
attempting to link the host's libc.so.6. |
17 |
|
18 |
Signed-off-by: James Le Cuirot <chewi <AT> gentoo.org> |
19 |
|
20 |
eclass/cmake.eclass | 2 +- |
21 |
1 file changed, 1 insertion(+), 1 deletion(-) |
22 |
|
23 |
diff --git a/eclass/cmake.eclass b/eclass/cmake.eclass |
24 |
index 76c63977aa07..03f2517c5b56 100644 |
25 |
--- a/eclass/cmake.eclass |
26 |
+++ b/eclass/cmake.eclass |
27 |
@@ -489,7 +489,7 @@ cmake_src_configure() { |
28 |
# When cross-compiling with a sysroot (e.g. with crossdev's emerge wrappers) |
29 |
# we need to tell cmake to use libs/headers from the sysroot but programs from / only. |
30 |
cat >> "${toolchain_file}" <<- _EOF_ || die |
31 |
- set(CMAKE_FIND_ROOT_PATH "${SYSROOT}") |
32 |
+ set(CMAKE_SYSROOT "${ESYSROOT}") |
33 |
set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER) |
34 |
set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY) |
35 |
set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY) |