/[gentoo-x86]/eclass/cmake-utils.eclass
Gentoo

Diff of /eclass/cmake-utils.eclass

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

Revision 1.78 Revision 1.79
1# Copyright 1999-2012 Gentoo Foundation 1# Copyright 1999-2012 Gentoo Foundation
2# Distributed under the terms of the GNU General Public License v2 2# Distributed under the terms of the GNU General Public License v2
3# $Header: /var/cvsroot/gentoo-x86/eclass/cmake-utils.eclass,v 1.78 2012/04/16 10:28:47 scarabeus Exp $ 3# $Header: /var/cvsroot/gentoo-x86/eclass/cmake-utils.eclass,v 1.79 2012/05/08 21:27:10 dilfridge Exp $
4 4
5# @ECLASS: cmake-utils.eclass 5# @ECLASS: cmake-utils.eclass
6# @MAINTAINER: 6# @MAINTAINER:
7# kde@gentoo.org 7# kde@gentoo.org
8# @AUTHOR: 8# @AUTHOR:
137# plugin needs to be done by cmake. 137# plugin needs to be done by cmake.
138# By default it uses ${S}. 138# By default it uses ${S}.
139 139
140# @ECLASS-VARIABLE: CMAKE_VERBOSE 140# @ECLASS-VARIABLE: CMAKE_VERBOSE
141# @DESCRIPTION: 141# @DESCRIPTION:
142# Set to enable verbose messages during compilation. 142# Set to OFF to disable verbose messages during compilation
143: ${CMAKE_VERBOSE:=ON}
143 144
144# @ECLASS-VARIABLE: PREFIX 145# @ECLASS-VARIABLE: PREFIX
145# @DESCRIPTION: 146# @DESCRIPTION:
146# Eclass respects PREFIX variable, though it's not recommended way to set 147# Eclass respects PREFIX variable, though it's not recommended way to set
147# install/lib/bin prefixes. 148# install/lib/bin prefixes.
148# Use -DCMAKE_INSTALL_PREFIX=... CMake variable instead. 149# Use -DCMAKE_INSTALL_PREFIX=... CMake variable instead.
150: ${PREFIX:=/usr}
149 151
150# @ECLASS-VARIABLE: CMAKE_BINARY 152# @ECLASS-VARIABLE: CMAKE_BINARY
151# @DESCRIPTION: 153# @DESCRIPTION:
152# Eclass can use different cmake binary than the one provided in by system. 154# Eclass can use different cmake binary than the one provided in by system.
153: ${CMAKE_BINARY:=cmake} 155: ${CMAKE_BINARY:=cmake}
332 SET (CMAKE_PLATFORM_REQUIRED_RUNTIME_PATH "${EPREFIX}/usr/${CHOST}/lib/gcc;${EPREFIX}/usr/${CHOST}/lib;${EPREFIX}/usr/$(get_libdir);${EPREFIX}/$(get_libdir)" 334 SET (CMAKE_PLATFORM_REQUIRED_RUNTIME_PATH "${EPREFIX}/usr/${CHOST}/lib/gcc;${EPREFIX}/usr/${CHOST}/lib;${EPREFIX}/usr/$(get_libdir);${EPREFIX}/$(get_libdir)"
333 CACHE STRING "" FORCE) 335 CACHE STRING "" FORCE)
334 336
335 ELSE () 337 ELSE ()
336 338
337 SET(CMAKE_PREFIX_PATH "${EPREFIX}${PREFIX:-/usr}" CACHE STRING ""FORCE) 339 SET(CMAKE_PREFIX_PATH "${EPREFIX}${PREFIX}" CACHE STRING ""FORCE)
338 SET(CMAKE_SKIP_BUILD_RPATH OFF CACHE BOOL "" FORCE) 340 SET(CMAKE_SKIP_BUILD_RPATH OFF CACHE BOOL "" FORCE)
339 SET(CMAKE_SKIP_RPATH OFF CACHE BOOL "" FORCE) 341 SET(CMAKE_SKIP_RPATH OFF CACHE BOOL "" FORCE)
340 SET(CMAKE_BUILD_WITH_INSTALL_RPATH TRUE CACHE BOOL "") 342 SET(CMAKE_BUILD_WITH_INSTALL_RPATH TRUE CACHE BOOL "")
341 SET(CMAKE_INSTALL_RPATH "${EPREFIX}${PREFIX:-/usr}/lib;${EPREFIX}/usr/${CHOST}/lib/gcc;${EPREFIX}/usr/${CHOST}/lib;${EPREFIX}/usr/$(get_libdir);${EPREFIX}/$(get_libdir)" CACHE STRING "" FORCE) 343 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)
342 SET(CMAKE_INSTALL_RPATH_USE_LINK_PATH TRUE CACHE BOOL "" FORCE) 344 SET(CMAKE_INSTALL_RPATH_USE_LINK_PATH TRUE CACHE BOOL "" FORCE)
343 SET(CMAKE_INSTALL_NAME_DIR "${EPREFIX}${PREFIX:-/usr}/lib" CACHE STRING "" FORCE) 345 SET(CMAKE_INSTALL_NAME_DIR "${EPREFIX}${PREFIX}/lib" CACHE STRING "" FORCE)
344 346
345 ENDIF (NOT APPLE) 347 ENDIF (NOT APPLE)
346 _EOF_ 348 _EOF_
347 fi 349 fi
348 350
349 # Common configure parameters (invariants) 351 # Common configure parameters (invariants)
350 local common_config=${CMAKE_BUILD_DIR}/gentoo_common_config.cmake 352 local common_config=${CMAKE_BUILD_DIR}/gentoo_common_config.cmake
351 local libdir=$(get_libdir) 353 local libdir=$(get_libdir)
352 cat > "${common_config}" <<- _EOF_ 354 cat > "${common_config}" <<- _EOF_
353 SET (LIB_SUFFIX ${libdir/lib} CACHE STRING "library path suffix" FORCE) 355 SET (LIB_SUFFIX ${libdir/lib} CACHE STRING "library path suffix" FORCE)
354 SET (CMAKE_INSTALL_LIBDIR ${libdir} CACHE PATH "Output directory for libraries") 356 SET (CMAKE_INSTALL_LIBDIR ${PREFIX}/${libdir} CACHE PATH "Output directory for libraries")
355 _EOF_ 357 _EOF_
356 [[ "${NOCOLOR}" = true || "${NOCOLOR}" = yes ]] && echo 'SET (CMAKE_COLOR_MAKEFILE OFF CACHE BOOL "pretty colors during make" FORCE)' >> "${common_config}" 358 [[ "${NOCOLOR}" = true || "${NOCOLOR}" = yes ]] && echo 'SET (CMAKE_COLOR_MAKEFILE OFF CACHE BOOL "pretty colors during make" FORCE)' >> "${common_config}"
357 359
358 # Convert mycmakeargs to an array, for backwards compatibility 360 # Convert mycmakeargs to an array, for backwards compatibility
359 # Make the array a local variable since <=portage-2.1.6.x does not 361 # Make the array a local variable since <=portage-2.1.6.x does not
368 # NOTE CMAKE_BUILD_TYPE can be only overriden via CMAKE_BUILD_TYPE eclass variable 370 # NOTE CMAKE_BUILD_TYPE can be only overriden via CMAKE_BUILD_TYPE eclass variable
369 # No -DCMAKE_BUILD_TYPE=xxx definitions will be in effect. 371 # No -DCMAKE_BUILD_TYPE=xxx definitions will be in effect.
370 local cmakeargs=( 372 local cmakeargs=(
371 --no-warn-unused-cli 373 --no-warn-unused-cli
372 -C "${common_config}" 374 -C "${common_config}"
373 -DCMAKE_INSTALL_PREFIX="${EPREFIX}${PREFIX:-/usr}" 375 -DCMAKE_INSTALL_PREFIX="${EPREFIX}${PREFIX}"
374 "${mycmakeargs_local[@]}" 376 "${mycmakeargs_local[@]}"
375 -DCMAKE_BUILD_TYPE="${CMAKE_BUILD_TYPE}" 377 -DCMAKE_BUILD_TYPE="${CMAKE_BUILD_TYPE}"
376 -DCMAKE_INSTALL_DO_STRIP=OFF 378 -DCMAKE_INSTALL_DO_STRIP=OFF
377 -DCMAKE_USER_MAKE_RULES_OVERRIDE="${build_rules}" 379 -DCMAKE_USER_MAKE_RULES_OVERRIDE="${build_rules}"
378 "${MYCMAKEARGS}" 380 "${MYCMAKEARGS}"
401 403
402 _check_build_dir 404 _check_build_dir
403 pushd "${CMAKE_BUILD_DIR}" > /dev/null 405 pushd "${CMAKE_BUILD_DIR}" > /dev/null
404 # first check if Makefile exist otherwise die 406 # first check if Makefile exist otherwise die
405 [[ -e Makefile ]] || die "Makefile not found. Error during configure stage." 407 [[ -e Makefile ]] || die "Makefile not found. Error during configure stage."
406 if [[ -n ${CMAKE_VERBOSE} ]]; then 408 if [[ "${CMAKE_VERBOSE}" != "OFF" ]]; then
407 emake VERBOSE=1 "$@" || die "Make failed!" 409 emake VERBOSE=1 "$@" || die "Make failed!"
408 else 410 else
409 emake "$@" || die "Make failed!" 411 emake "$@" || die "Make failed!"
410 fi 412 fi
411 popd > /dev/null 413 popd > /dev/null

Legend:
Removed from v.1.78  
changed lines
  Added in v.1.79

  ViewVC Help
Powered by ViewVC 1.1.20