| 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.89 2012/12/03 12:05:51 mgorny Exp $ |
3 | # $Header: /var/cvsroot/gentoo-x86/eclass/cmake-utils.eclass,v 1.90 2012/12/08 15:58:47 kensington 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: |
| … | |
… | |
| 351 | |
351 | |
| 352 | # Prepare Gentoo override rules (set valid compiler, append CPPFLAGS etc.) |
352 | # Prepare Gentoo override rules (set valid compiler, append CPPFLAGS etc.) |
| 353 | local build_rules=${BUILD_DIR}/gentoo_rules.cmake |
353 | local build_rules=${BUILD_DIR}/gentoo_rules.cmake |
| 354 | cat > "${build_rules}" <<- _EOF_ |
354 | cat > "${build_rules}" <<- _EOF_ |
| 355 | SET (CMAKE_AR $(type -P $(tc-getAR)) CACHE FILEPATH "Archive manager" FORCE) |
355 | SET (CMAKE_AR $(type -P $(tc-getAR)) CACHE FILEPATH "Archive manager" FORCE) |
|
|
356 | SET (CMAKE_ASM_COMPILE_OBJECT "<CMAKE_C_COMPILER> <DEFINES> ${CFLAGS} <FLAGS> -o <OBJECT> -c <SOURCE>" CACHE STRING "ASM compile command" FORCE) |
| 356 | SET (CMAKE_C_COMPILER $(type -P $(tc-getCC)) CACHE FILEPATH "C compiler" FORCE) |
357 | SET (CMAKE_C_COMPILER $(type -P $(tc-getCC)) CACHE FILEPATH "C compiler" FORCE) |
| 357 | SET (CMAKE_C_COMPILE_OBJECT "<CMAKE_C_COMPILER> <DEFINES> ${CPPFLAGS} <FLAGS> -o <OBJECT> -c <SOURCE>" CACHE STRING "C compile command" FORCE) |
358 | SET (CMAKE_C_COMPILE_OBJECT "<CMAKE_C_COMPILER> <DEFINES> ${CPPFLAGS} <FLAGS> -o <OBJECT> -c <SOURCE>" CACHE STRING "C compile command" FORCE) |
| 358 | SET (CMAKE_CXX_COMPILER $(type -P $(tc-getCXX)) CACHE FILEPATH "C++ compiler" FORCE) |
359 | SET (CMAKE_CXX_COMPILER $(type -P $(tc-getCXX)) CACHE FILEPATH "C++ compiler" FORCE) |
| 359 | SET (CMAKE_CXX_COMPILE_OBJECT "<CMAKE_CXX_COMPILER> <DEFINES> ${CPPFLAGS} <FLAGS> -o <OBJECT> -c <SOURCE>" CACHE STRING "C++ compile command" FORCE) |
360 | SET (CMAKE_CXX_COMPILE_OBJECT "<CMAKE_CXX_COMPILER> <DEFINES> ${CPPFLAGS} <FLAGS> -o <OBJECT> -c <SOURCE>" CACHE STRING "C++ compile command" FORCE) |
| 360 | SET (CMAKE_RANLIB $(type -P $(tc-getRANLIB)) CACHE FILEPATH "Archive index generator" FORCE) |
361 | SET (CMAKE_RANLIB $(type -P $(tc-getRANLIB)) CACHE FILEPATH "Archive index generator" FORCE) |
| … | |
… | |
| 484 | fi |
485 | fi |
| 485 | } |
486 | } |
| 486 | |
487 | |
| 487 | enable_cmake-utils_src_test() { |
488 | enable_cmake-utils_src_test() { |
| 488 | debug-print-function ${FUNCNAME} "$@" |
489 | debug-print-function ${FUNCNAME} "$@" |
| 489 | local ctestargs |
|
|
| 490 | |
490 | |
| 491 | _check_build_dir |
491 | _check_build_dir |
| 492 | pushd "${BUILD_DIR}" > /dev/null |
492 | pushd "${BUILD_DIR}" > /dev/null |
| 493 | [[ -e CTestTestfile.cmake ]] || { echo "No tests found. Skipping."; return 0 ; } |
493 | [[ -e CTestTestfile.cmake ]] || { echo "No tests found. Skipping."; return 0 ; } |
| 494 | |
494 | |
| 495 | [[ -n ${TEST_VERBOSE} ]] && ctestargs="--extra-verbose --output-on-failure" |
495 | [[ -n ${TEST_VERBOSE} ]] && myctestargs+=( --extra-verbose --output-on-failure ) |
| 496 | |
496 | |
| 497 | if ctest ${ctestargs} "$@" ; then |
497 | if ctest "${myctestargs[@]}" "$@" ; then |
| 498 | einfo "Tests succeeded." |
498 | einfo "Tests succeeded." |
| 499 | popd > /dev/null |
499 | popd > /dev/null |
| 500 | return 0 |
500 | return 0 |
| 501 | else |
501 | else |
| 502 | if [[ -n "${CMAKE_YES_I_WANT_TO_SEE_THE_TEST_LOG}" ]] ; then |
502 | if [[ -n "${CMAKE_YES_I_WANT_TO_SEE_THE_TEST_LOG}" ]] ; then |