/[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.82 Revision 1.85
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.82 2012/09/27 16:35:41 axs Exp $ 3# $Header: /var/cvsroot/gentoo-x86/eclass/cmake-utils.eclass,v 1.85 2012/10/25 12:48:58 scarabeus 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:
264# Removes dangerous definitions that override Gentoo settings. 264# Removes dangerous definitions that override Gentoo settings.
265_modify-cmakelists() { 265_modify-cmakelists() {
266 debug-print-function ${FUNCNAME} "$@" 266 debug-print-function ${FUNCNAME} "$@"
267 267
268 # Only edit the files once 268 # Only edit the files once
269 grep -qs "<<< Gentoo configuration >>>" CMakeLists.txt && return 0 269 grep -qs "<<< Gentoo configuration >>>" "${CMAKE_USE_DIR}"/CMakeLists.txt && return 0
270 270
271 # Comment out all set (<some_should_be_user_defined_variable> value) 271 # Comment out all set (<some_should_be_user_defined_variable> value)
272 # TODO Add QA checker - inform when variable being checked for below is set in CMakeLists.txt 272 # TODO Add QA checker - inform when variable being checked for below is set in CMakeLists.txt
273 find "${CMAKE_USE_DIR}" -name CMakeLists.txt \ 273 find "${CMAKE_USE_DIR}" -name CMakeLists.txt \
274 -exec sed -i -e '/^[[:space:]]*[sS][eE][tT][[:space:]]*([[:space:]]*CMAKE_BUILD_TYPE.*)/{s/^/#IGNORE /g}' {} + \ 274 -exec sed -i -e '/^[[:space:]]*[sS][eE][tT][[:space:]]*([[:space:]]*CMAKE_BUILD_TYPE.*)/{s/^/#IGNORE /g}' {} + \
325 if ! has debug ${IUSE//+} || ! use debug; then 325 if ! has debug ${IUSE//+} || ! use debug; then
326 append-cppflags -DNDEBUG 326 append-cppflags -DNDEBUG
327 fi 327 fi
328 fi 328 fi
329 329
330 # Prepare Gentoo override rules (set valid compiler, append CPPFLAGS) 330 # Prepare Gentoo override rules (set valid compiler, append CPPFLAGS etc.)
331 local build_rules=${CMAKE_BUILD_DIR}/gentoo_rules.cmake 331 local build_rules=${CMAKE_BUILD_DIR}/gentoo_rules.cmake
332 cat > "${build_rules}" <<- _EOF_ 332 cat > "${build_rules}" <<- _EOF_
333 SET (CMAKE_AR $(type -P $(tc-getAR)) CACHE FILEPATH "Archive manager" FORCE)
333 SET (CMAKE_C_COMPILER $(type -P $(tc-getCC)) CACHE FILEPATH "C compiler" FORCE) 334 SET (CMAKE_C_COMPILER $(type -P $(tc-getCC)) CACHE FILEPATH "C compiler" FORCE)
334 SET (CMAKE_C_COMPILE_OBJECT "<CMAKE_C_COMPILER> <DEFINES> ${CPPFLAGS} <FLAGS> -o <OBJECT> -c <SOURCE>" CACHE STRING "C compile command" FORCE) 335 SET (CMAKE_C_COMPILE_OBJECT "<CMAKE_C_COMPILER> <DEFINES> ${CPPFLAGS} <FLAGS> -o <OBJECT> -c <SOURCE>" CACHE STRING "C compile command" FORCE)
335 SET (CMAKE_CXX_COMPILER $(type -P $(tc-getCXX)) CACHE FILEPATH "C++ compiler" FORCE) 336 SET (CMAKE_CXX_COMPILER $(type -P $(tc-getCXX)) CACHE FILEPATH "C++ compiler" FORCE)
336 SET (CMAKE_CXX_COMPILE_OBJECT "<CMAKE_CXX_COMPILER> <DEFINES> ${CPPFLAGS} <FLAGS> -o <OBJECT> -c <SOURCE>" CACHE STRING "C++ compile command" FORCE) 337 SET (CMAKE_CXX_COMPILE_OBJECT "<CMAKE_CXX_COMPILER> <DEFINES> ${CPPFLAGS} <FLAGS> -o <OBJECT> -c <SOURCE>" CACHE STRING "C++ compile command" FORCE)
338 SET (CMAKE_RANLIB $(type -P $(tc-getRANLIB)) CACHE FILEPATH "Archive index generator" FORCE)
337 _EOF_ 339 _EOF_
338 340
339 has "${EAPI:-0}" 0 1 2 && ! use prefix && EPREFIX= 341 has "${EAPI:-0}" 0 1 2 && ! use prefix && EPREFIX=
340 342
341 if [[ ${EPREFIX} ]]; then 343 if [[ ${EPREFIX} ]]; then
470 472
471 [[ -n ${TEST_VERBOSE} ]] && ctestargs="--extra-verbose --output-on-failure" 473 [[ -n ${TEST_VERBOSE} ]] && ctestargs="--extra-verbose --output-on-failure"
472 474
473 if ctest ${ctestargs} "$@" ; then 475 if ctest ${ctestargs} "$@" ; then
474 einfo "Tests succeeded." 476 einfo "Tests succeeded."
477 popd > /dev/null
478 return 0
475 else 479 else
476 if [[ -n "${CMAKE_YES_I_WANT_TO_SEE_THE_TEST_LOG}" ]] ; then 480 if [[ -n "${CMAKE_YES_I_WANT_TO_SEE_THE_TEST_LOG}" ]] ; then
477 # on request from Diego 481 # on request from Diego
478 eerror "Tests failed. Test log ${CMAKE_BUILD_DIR}/Testing/Temporary/LastTest.log follows:" 482 eerror "Tests failed. Test log ${CMAKE_BUILD_DIR}/Testing/Temporary/LastTest.log follows:"
479 eerror "--START TEST LOG--------------------------------------------------------------" 483 eerror "--START TEST LOG--------------------------------------------------------------"
481 eerror "--END TEST LOG----------------------------------------------------------------" 485 eerror "--END TEST LOG----------------------------------------------------------------"
482 die "Tests failed." 486 die "Tests failed."
483 else 487 else
484 die "Tests failed. When you file a bug, please attach the following file: \n\t${CMAKE_BUILD_DIR}/Testing/Temporary/LastTest.log" 488 die "Tests failed. When you file a bug, please attach the following file: \n\t${CMAKE_BUILD_DIR}/Testing/Temporary/LastTest.log"
485 fi 489 fi
486 fi 490
491 # die might not die due to nonfatal
487 popd > /dev/null 492 popd > /dev/null
493 return 1
494 fi
488} 495}
489 496
490# @FUNCTION: cmake-utils_src_configure 497# @FUNCTION: cmake-utils_src_configure
491# @DESCRIPTION: 498# @DESCRIPTION:
492# General function for configuring with cmake. Default behaviour is to start an 499# General function for configuring with cmake. Default behaviour is to start an

Legend:
Removed from v.1.82  
changed lines
  Added in v.1.85

  ViewVC Help
Powered by ViewVC 1.1.20