Gentoo Archives: gentoo-dev

From: "Michał Górny" <mgorny@g.o>
To: gentoo-dev@l.g.o
Cc: kde@g.o, "Michał Górny" <mgorny@g.o>
Subject: [gentoo-dev] [PATCH] cmake-utils.eclass: Fix multi-arg CC/CXX/FC, #542530
Date: Wed, 26 Oct 2016 16:51:02
Message-Id: 20161026164926.22112-1-mgorny@gentoo.org
1 Fix handling CC/CXX/FC values that contain three or more words by
2 splitting all multi-argument CC/CXX/FC into the executable name kept
3 in the variable, and additional options that are moved to CFLAGS,
4 CXXFLAGS or FCFLAGS appropriately.
5 ---
6 eclass/cmake-utils.eclass | 21 ++++++++++++++++++---
7 1 file changed, 18 insertions(+), 3 deletions(-)
8
9 diff --git a/eclass/cmake-utils.eclass b/eclass/cmake-utils.eclass
10 index 393ee28..2c41f6b 100644
11 --- a/eclass/cmake-utils.eclass
12 +++ b/eclass/cmake-utils.eclass
13 @@ -492,6 +492,21 @@ enable_cmake-utils_src_configure() {
14
15 _cmake_check_build_dir
16
17 + # Split CC/CXX/FC from multilib.eclass to be CMake-friendly, #542530
18 + local myCC=( $(tc-getCC) )
19 + local myCXX=( $(tc-getCXX) )
20 + local myFC=( $(tc-getFC) )
21 + local -x CC="${myCC[0]}" CXX="${myCXX[0]}" FC="${myFC[0]}"
22 + [[ ${#myCC[@]} -gt 1 && ${myCC[1]} != -* ]] \
23 + && die "CC contains non-relocatable option: ${myCC[*]:0:2} ..."
24 + [[ ${#myCXX[@]} -gt 1 && ${myCXX[1]} != -* ]] \
25 + && die "CXX contains non-relocatable option: ${myCXX[*]:0:2} ..."
26 + [[ ${#myFC[@]} -gt 1 && ${myFC[1]} != -* ]] \
27 + && die "FC contains non-relocatable option: ${myFC[*]:0:2} ..."
28 + local -x CFLAGS="${myCC[*]:1} ${CFLAGS}"
29 + local -x CXXFLAGS="${myCXX[*]:1} ${CXXFLAGS}"
30 + local -x FCFLAGS="${myFC[*]:1} ${FCFLAGS}"
31 +
32 # Fix xdg collision with sandbox
33 local -x XDG_CONFIG_HOME="${T}"
34
35 @@ -528,9 +543,9 @@ enable_cmake-utils_src_configure() {
36
37 local toolchain_file=${BUILD_DIR}/gentoo_toolchain.cmake
38 cat > ${toolchain_file} <<- _EOF_ || die
39 - SET (CMAKE_C_COMPILER $(tc-getCC))
40 - SET (CMAKE_CXX_COMPILER $(tc-getCXX))
41 - SET (CMAKE_Fortran_COMPILER $(tc-getFC))
42 + SET (CMAKE_C_COMPILER "${CC}")
43 + SET (CMAKE_CXX_COMPILER "${CXX}")
44 + SET (CMAKE_Fortran_COMPILER "${FC}")
45 _EOF_
46
47 if tc-is-cross-compiler; then
48 --
49 2.10.1