1 |
From: Maciej Mrozowski <reavertm@g.o> |
2 |
|
3 |
--- |
4 |
eclass/cmake-utils.eclass | 54 ++++++++++++++++++----------------------------- |
5 |
1 file changed, 21 insertions(+), 33 deletions(-) |
6 |
|
7 |
diff --git a/eclass/cmake-utils.eclass b/eclass/cmake-utils.eclass |
8 |
index 393ee28..88d2163 100644 |
9 |
--- a/eclass/cmake-utils.eclass |
10 |
+++ b/eclass/cmake-utils.eclass |
11 |
@@ -517,13 +517,10 @@ enable_cmake-utils_src_configure() { |
12 |
includes="<INCLUDES>" |
13 |
fi |
14 |
cat > "${build_rules}" <<- _EOF_ || die |
15 |
- SET (CMAKE_AR $(type -P $(tc-getAR)) CACHE FILEPATH "Archive manager" FORCE) |
16 |
SET (CMAKE_ASM_COMPILE_OBJECT "<CMAKE_C_COMPILER> <DEFINES> ${includes} ${CFLAGS} <FLAGS> -o <OBJECT> -c <SOURCE>" CACHE STRING "ASM compile command" FORCE) |
17 |
SET (CMAKE_C_COMPILE_OBJECT "<CMAKE_C_COMPILER> <DEFINES> ${includes} ${CPPFLAGS} <FLAGS> -o <OBJECT> -c <SOURCE>" CACHE STRING "C compile command" FORCE) |
18 |
SET (CMAKE_CXX_COMPILE_OBJECT "<CMAKE_CXX_COMPILER> <DEFINES> ${includes} ${CPPFLAGS} <FLAGS> -o <OBJECT> -c <SOURCE>" CACHE STRING "C++ compile command" FORCE) |
19 |
SET (CMAKE_Fortran_COMPILE_OBJECT "<CMAKE_Fortran_COMPILER> <DEFINES> ${includes} ${FCFLAGS} <FLAGS> -o <OBJECT> -c <SOURCE>" CACHE STRING "Fortran compile command" FORCE) |
20 |
- SET (CMAKE_RANLIB $(type -P $(tc-getRANLIB)) CACHE FILEPATH "Archive index generator" FORCE) |
21 |
- SET (PKG_CONFIG_EXECUTABLE $(type -P $(tc-getPKG_CONFIG)) CACHE FILEPATH "pkg-config executable" FORCE) |
22 |
_EOF_ |
23 |
|
24 |
local toolchain_file=${BUILD_DIR}/gentoo_toolchain.cmake |
25 |
@@ -531,6 +528,8 @@ enable_cmake-utils_src_configure() { |
26 |
SET (CMAKE_C_COMPILER $(tc-getCC)) |
27 |
SET (CMAKE_CXX_COMPILER $(tc-getCXX)) |
28 |
SET (CMAKE_Fortran_COMPILER $(tc-getFC)) |
29 |
+ SET (CMAKE_AR $(type -P $(tc-getAR)) CACHE FILEPATH "Archive manager" FORCE) |
30 |
+ SET (CMAKE_RANLIB $(type -P $(tc-getRANLIB)) CACHE FILEPATH "Archive index generator" FORCE) |
31 |
_EOF_ |
32 |
|
33 |
if tc-is-cross-compiler; then |
34 |
@@ -571,32 +570,29 @@ enable_cmake-utils_src_configure() { |
35 |
# in Prefix we need rpath and must ensure cmake gets our default linker path |
36 |
# right ... except for Darwin hosts |
37 |
IF (NOT APPLE) |
38 |
- SET (CMAKE_SKIP_RPATH OFF CACHE BOOL "" FORCE) |
39 |
- SET (CMAKE_PLATFORM_REQUIRED_RUNTIME_PATH "${EPREFIX}/usr/${CHOST}/lib/gcc;${EPREFIX}/usr/${CHOST}/lib;${EPREFIX}/usr/$(get_libdir);${EPREFIX}/$(get_libdir)" |
40 |
- CACHE STRING "" FORCE) |
41 |
- |
42 |
+ SET (CMAKE_SKIP_RPATH OFF CACHE BOOL "" FORCE) |
43 |
+ SET (CMAKE_PLATFORM_REQUIRED_RUNTIME_PATH "${EPREFIX}/usr/${CHOST}/lib/gcc;${EPREFIX}/usr/${CHOST}/lib;${EPREFIX}/usr/$(get_libdir);${EPREFIX}/$(get_libdir)" CACHE STRING "" FORCE) |
44 |
ELSE () |
45 |
- |
46 |
- SET(CMAKE_PREFIX_PATH "${EPREFIX}${PREFIX}" CACHE STRING "" FORCE) |
47 |
- SET(CMAKE_SKIP_BUILD_RPATH OFF CACHE BOOL "" FORCE) |
48 |
- SET(CMAKE_SKIP_RPATH OFF CACHE BOOL "" FORCE) |
49 |
- SET(CMAKE_BUILD_WITH_INSTALL_RPATH TRUE CACHE BOOL "") |
50 |
- SET(CMAKE_INSTALL_RPATH "${EPREFIX}${PREFIX}/lib;${EPREFIX}/usr/${CHOST}/lib/gcc;${EPREFIX}/usr/${CHOST}/lib;${EPREFIX}/usr/$(get_libdir);${EPREFIX}/$(get_libdir)" CACHE STRING "" FORCE) |
51 |
- SET(CMAKE_INSTALL_RPATH_USE_LINK_PATH TRUE CACHE BOOL "" FORCE) |
52 |
- SET(CMAKE_INSTALL_NAME_DIR "${EPREFIX}${PREFIX}/lib" CACHE STRING "" FORCE) |
53 |
- |
54 |
+ SET(CMAKE_PREFIX_PATH "${EPREFIX}${PREFIX}" CACHE STRING "" FORCE) |
55 |
+ SET(CMAKE_SKIP_BUILD_RPATH OFF CACHE BOOL "" FORCE) |
56 |
+ SET(CMAKE_SKIP_RPATH OFF CACHE BOOL "" FORCE) |
57 |
+ SET(CMAKE_BUILD_WITH_INSTALL_RPATH TRUE CACHE BOOL "") |
58 |
+ SET(CMAKE_INSTALL_RPATH "${EPREFIX}${PREFIX}/lib;${EPREFIX}/usr/${CHOST}/lib/gcc;${EPREFIX}/usr/${CHOST}/lib;${EPREFIX}/usr/$(get_libdir);${EPREFIX}/$(get_libdir)" CACHE STRING "" FORCE) |
59 |
+ SET(CMAKE_INSTALL_RPATH_USE_LINK_PATH TRUE CACHE BOOL "" FORCE) |
60 |
+ SET(CMAKE_INSTALL_NAME_DIR "${EPREFIX}${PREFIX}/lib" CACHE STRING "" FORCE) |
61 |
ENDIF (NOT APPLE) |
62 |
_EOF_ |
63 |
fi |
64 |
|
65 |
# Common configure parameters (invariants) |
66 |
- local common_config=${BUILD_DIR}/gentoo_common_config.cmake |
67 |
local libdir=$(get_libdir) |
68 |
- cat > "${common_config}" <<- _EOF_ || die |
69 |
- SET (LIB_SUFFIX ${libdir/lib} CACHE STRING "library path suffix" FORCE) |
70 |
- SET (CMAKE_INSTALL_LIBDIR ${libdir} CACHE PATH "Output directory for libraries") |
71 |
- _EOF_ |
72 |
- [[ "${NOCOLOR}" = true || "${NOCOLOR}" = yes ]] && echo 'SET (CMAKE_COLOR_MAKEFILE OFF CACHE BOOL "pretty colors during make" FORCE)' >> "${common_config}" |
73 |
+ local cmakeargs=( |
74 |
+ -DLIB_SUFFIX="${libdir/lib}" |
75 |
+ -DCMAKE_INSTALL_LIBDIR="${libdir}" |
76 |
+ -DPKG_CONFIG_EXECUTABLE="$(type -P $(tc-getPKG_CONFIG))" |
77 |
+ -DCMAKE_USER_MAKE_RULES_OVERRIDE="${build_rules}" |
78 |
+ -DCMAKE_TOOLCHAIN_FILE="${toolchain_file}" |
79 |
+ ) |
80 |
|
81 |
# Convert mycmakeargs to an array, for backwards compatibility |
82 |
# Make the array a local variable since <=portage-2.1.6.x does not |
83 |
@@ -615,25 +611,17 @@ enable_cmake-utils_src_configure() { |
84 |
local mycmakeargs_local=("${mycmakeargs[@]}") |
85 |
fi |
86 |
|
87 |
- if [[ ${CMAKE_WARN_UNUSED_CLI} == no ]] ; then |
88 |
- local warn_unused_cli="--no-warn-unused-cli" |
89 |
- else |
90 |
- local warn_unused_cli="" |
91 |
- fi |
92 |
- |
93 |
# Common configure parameters (overridable) |
94 |
# NOTE CMAKE_BUILD_TYPE can be only overriden via CMAKE_BUILD_TYPE eclass variable |
95 |
# No -DCMAKE_BUILD_TYPE=xxx definitions will be in effect. |
96 |
- local cmakeargs=( |
97 |
- ${warn_unused_cli} |
98 |
- -C "${common_config}" |
99 |
+ cmakeargs+=( |
100 |
+ $([[ ${CMAKE_WARN_UNUSED_CLI} == no ]] && echo --no-warn-unused-cli) |
101 |
+ $([[ "${NOCOLOR}" = true || "${NOCOLOR}" = yes ]] && echo -DCMAKE_COLOR_MAKEFILE=OFF) |
102 |
-G "$(_cmake_generator_to_use)" |
103 |
-DCMAKE_INSTALL_PREFIX="${EPREFIX}${PREFIX}" |
104 |
"${mycmakeargs_local[@]}" |
105 |
-DCMAKE_BUILD_TYPE="${CMAKE_BUILD_TYPE}" |
106 |
$([[ ${EAPI} == [2345] ]] && echo -DCMAKE_INSTALL_DO_STRIP=OFF) |
107 |
- -DCMAKE_USER_MAKE_RULES_OVERRIDE="${build_rules}" |
108 |
- -DCMAKE_TOOLCHAIN_FILE="${toolchain_file}" |
109 |
"${MYCMAKEARGS}" |
110 |
) |
111 |
|
112 |
-- |
113 |
2.7.3 |