From: Maciej Mrozowski <reave...@gentoo.org>

---
 eclass/cmake-utils.eclass | 54 ++++++++++++++++++-----------------------------
 1 file changed, 21 insertions(+), 33 deletions(-)

diff --git a/eclass/cmake-utils.eclass b/eclass/cmake-utils.eclass
index 393ee28..88d2163 100644
--- a/eclass/cmake-utils.eclass
+++ b/eclass/cmake-utils.eclass
@@ -517,13 +517,10 @@ enable_cmake-utils_src_configure() {
                includes="<INCLUDES>"
        fi
        cat > "${build_rules}" <<- _EOF_ || die
-               SET (CMAKE_AR $(type -P $(tc-getAR)) CACHE FILEPATH "Archive 
manager" FORCE)
                SET (CMAKE_ASM_COMPILE_OBJECT "<CMAKE_C_COMPILER> <DEFINES> 
${includes} ${CFLAGS} <FLAGS> -o <OBJECT> -c <SOURCE>" CACHE STRING "ASM 
compile command" FORCE)
                SET (CMAKE_C_COMPILE_OBJECT "<CMAKE_C_COMPILER> <DEFINES> 
${includes} ${CPPFLAGS} <FLAGS> -o <OBJECT> -c <SOURCE>" CACHE STRING "C 
compile command" FORCE)
                SET (CMAKE_CXX_COMPILE_OBJECT "<CMAKE_CXX_COMPILER> <DEFINES> 
${includes} ${CPPFLAGS} <FLAGS> -o <OBJECT> -c <SOURCE>" CACHE STRING "C++ 
compile command" FORCE)
                SET (CMAKE_Fortran_COMPILE_OBJECT "<CMAKE_Fortran_COMPILER> 
<DEFINES> ${includes} ${FCFLAGS} <FLAGS> -o <OBJECT> -c <SOURCE>" CACHE STRING 
"Fortran compile command" FORCE)
-               SET (CMAKE_RANLIB $(type -P $(tc-getRANLIB)) CACHE FILEPATH 
"Archive index generator" FORCE)
-               SET (PKG_CONFIG_EXECUTABLE $(type -P $(tc-getPKG_CONFIG)) CACHE 
FILEPATH "pkg-config executable" FORCE)
        _EOF_
 
        local toolchain_file=${BUILD_DIR}/gentoo_toolchain.cmake
@@ -531,6 +528,8 @@ enable_cmake-utils_src_configure() {
                SET (CMAKE_C_COMPILER $(tc-getCC))
                SET (CMAKE_CXX_COMPILER $(tc-getCXX))
                SET (CMAKE_Fortran_COMPILER $(tc-getFC))
+               SET (CMAKE_AR $(type -P $(tc-getAR)) CACHE FILEPATH "Archive 
manager" FORCE)
+               SET (CMAKE_RANLIB $(type -P $(tc-getRANLIB)) CACHE FILEPATH 
"Archive index generator" FORCE)
        _EOF_
 
        if tc-is-cross-compiler; then
@@ -571,32 +570,29 @@ enable_cmake-utils_src_configure() {
                        # in Prefix we need rpath and must ensure cmake gets 
our default linker path
                        # right ... except for Darwin hosts
                        IF (NOT APPLE)
-                       SET (CMAKE_SKIP_RPATH OFF CACHE BOOL "" FORCE)
-                       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)
-
+                               SET (CMAKE_SKIP_RPATH OFF CACHE BOOL "" FORCE)
+                               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)
                        ELSE ()
-
-                       SET(CMAKE_PREFIX_PATH "${EPREFIX}${PREFIX}" CACHE 
STRING "" FORCE)
-                       SET(CMAKE_SKIP_BUILD_RPATH OFF CACHE BOOL "" FORCE)
-                       SET(CMAKE_SKIP_RPATH OFF CACHE BOOL "" FORCE)
-                       SET(CMAKE_BUILD_WITH_INSTALL_RPATH TRUE CACHE BOOL "")
-                       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)
-                       SET(CMAKE_INSTALL_RPATH_USE_LINK_PATH TRUE CACHE BOOL 
"" FORCE)
-                       SET(CMAKE_INSTALL_NAME_DIR "${EPREFIX}${PREFIX}/lib" 
CACHE STRING "" FORCE)
-
+                               SET(CMAKE_PREFIX_PATH "${EPREFIX}${PREFIX}" 
CACHE STRING "" FORCE)
+                               SET(CMAKE_SKIP_BUILD_RPATH OFF CACHE BOOL "" 
FORCE)
+                               SET(CMAKE_SKIP_RPATH OFF CACHE BOOL "" FORCE)
+                               SET(CMAKE_BUILD_WITH_INSTALL_RPATH TRUE CACHE 
BOOL "")
+                               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)
+                               SET(CMAKE_INSTALL_RPATH_USE_LINK_PATH TRUE 
CACHE BOOL "" FORCE)
+                               SET(CMAKE_INSTALL_NAME_DIR 
"${EPREFIX}${PREFIX}/lib" CACHE STRING "" FORCE)
                        ENDIF (NOT APPLE)
                _EOF_
        fi
 
        # Common configure parameters (invariants)
-       local common_config=${BUILD_DIR}/gentoo_common_config.cmake
        local libdir=$(get_libdir)
-       cat > "${common_config}" <<- _EOF_ || die
-               SET (LIB_SUFFIX ${libdir/lib} CACHE STRING "library path 
suffix" FORCE)
-               SET (CMAKE_INSTALL_LIBDIR ${libdir} CACHE PATH "Output 
directory for libraries")
-       _EOF_
-       [[ "${NOCOLOR}" = true || "${NOCOLOR}" = yes ]] && echo 'SET 
(CMAKE_COLOR_MAKEFILE OFF CACHE BOOL "pretty colors during make" FORCE)' >> 
"${common_config}"
+       local cmakeargs=(
+               -DLIB_SUFFIX="${libdir/lib}"
+               -DCMAKE_INSTALL_LIBDIR="${libdir}"
+               -DPKG_CONFIG_EXECUTABLE="$(type -P $(tc-getPKG_CONFIG))"
+               -DCMAKE_USER_MAKE_RULES_OVERRIDE="${build_rules}"
+               -DCMAKE_TOOLCHAIN_FILE="${toolchain_file}"
+       )
 
        # Convert mycmakeargs to an array, for backwards compatibility
        # Make the array a local variable since <=portage-2.1.6.x does not
@@ -615,25 +611,17 @@ enable_cmake-utils_src_configure() {
                local mycmakeargs_local=("${mycmakeargs[@]}")
        fi
 
-       if [[ ${CMAKE_WARN_UNUSED_CLI} == no ]] ; then
-               local warn_unused_cli="--no-warn-unused-cli"
-       else
-               local warn_unused_cli=""
-       fi
-
        # Common configure parameters (overridable)
        # NOTE CMAKE_BUILD_TYPE can be only overriden via CMAKE_BUILD_TYPE 
eclass variable
        # No -DCMAKE_BUILD_TYPE=xxx definitions will be in effect.
-       local cmakeargs=(
-               ${warn_unused_cli}
-               -C "${common_config}"
+       cmakeargs+=(
+               $([[ ${CMAKE_WARN_UNUSED_CLI} == no ]] && echo 
--no-warn-unused-cli)
+               $([[ "${NOCOLOR}" = true || "${NOCOLOR}" = yes ]] && echo 
-DCMAKE_COLOR_MAKEFILE=OFF)
                -G "$(_cmake_generator_to_use)"
                -DCMAKE_INSTALL_PREFIX="${EPREFIX}${PREFIX}"
                "${mycmakeargs_local[@]}"
                -DCMAKE_BUILD_TYPE="${CMAKE_BUILD_TYPE}"
                $([[ ${EAPI} == [2345] ]] && echo -DCMAKE_INSTALL_DO_STRIP=OFF)
-               -DCMAKE_USER_MAKE_RULES_OVERRIDE="${build_rules}"
-               -DCMAKE_TOOLCHAIN_FILE="${toolchain_file}"
                "${MYCMAKEARGS}"
        )
 
-- 
2.7.3


Reply via email to