/[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.65 Revision 1.69
1# Copyright 1999-2010 Gentoo Foundation 1# Copyright 1999-2010 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.65 2011/01/20 00:48:51 reavertm Exp $ 3# $Header: /var/cvsroot/gentoo-x86/eclass/cmake-utils.eclass,v 1.69 2011/06/27 21:11:57 abcd 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# 8#
44esac 44esac
45inherit toolchain-funcs multilib flag-o-matic base 45inherit toolchain-funcs multilib flag-o-matic base
46 46
47CMAKE_EXPF="src_compile src_test src_install" 47CMAKE_EXPF="src_compile src_test src_install"
48case ${EAPI:-0} in 48case ${EAPI:-0} in
49 3|2) CMAKE_EXPF+=" src_configure" ;; 49 4|3|2) CMAKE_EXPF+=" src_configure" ;;
50 1|0) ;; 50 1|0) ;;
51 *) die "Unknown EAPI, Bug eclass maintainers." ;; 51 *) die "Unknown EAPI, Bug eclass maintainers." ;;
52esac 52esac
53EXPORT_FUNCTIONS ${CMAKE_EXPF} 53EXPORT_FUNCTIONS ${CMAKE_EXPF}
54 54
237 237
238# Internal function for modifying hardcoded definitions. 238# Internal function for modifying hardcoded definitions.
239# Removes dangerous definitions that override Gentoo settings. 239# Removes dangerous definitions that override Gentoo settings.
240_modify-cmakelists() { 240_modify-cmakelists() {
241 debug-print-function ${FUNCNAME} "$@" 241 debug-print-function ${FUNCNAME} "$@"
242
243 # Only edit the files once
244 grep -qs "<<< Gentoo configuration >>>" CMakeLists.txt && return 0
242 245
243 # Comment out all set (<some_should_be_user_defined_variable> value) 246 # Comment out all set (<some_should_be_user_defined_variable> value)
244 # TODO Add QA checker - inform when variable being checked for below is set in CMakeLists.txt 247 # TODO Add QA checker - inform when variable being checked for below is set in CMakeLists.txt
245 find "${CMAKE_USE_DIR}" -name CMakeLists.txt \ 248 find "${CMAKE_USE_DIR}" -name CMakeLists.txt \
246 -exec sed -i -e '/^[[:space:]]*[sS][eE][tT][[:space:]]*([[:space:]]*CMAKE_BUILD_TYPE.*)/{s/^/#IGNORE /g}' {} + \ 249 -exec sed -i -e '/^[[:space:]]*[sS][eE][tT][[:space:]]*([[:space:]]*CMAKE_BUILD_TYPE.*)/{s/^/#IGNORE /g}' {} + \
248 -exec sed -i -e '/^[[:space:]]*[sS][eE][tT][[:space:]]*([[:space:]]*CMAKE_INSTALL_PREFIX.*)/{s/^/#IGNORE /g}' {} + \ 251 -exec sed -i -e '/^[[:space:]]*[sS][eE][tT][[:space:]]*([[:space:]]*CMAKE_INSTALL_PREFIX.*)/{s/^/#IGNORE /g}' {} + \
249 -exec sed -i -e '/^[[:space:]]*[sS][eE][tT][[:space:]]*([[:space:]]*CMAKE_VERBOSE_MAKEFILE.*)/{s/^/#IGNORE /g}' {} + \ 252 -exec sed -i -e '/^[[:space:]]*[sS][eE][tT][[:space:]]*([[:space:]]*CMAKE_VERBOSE_MAKEFILE.*)/{s/^/#IGNORE /g}' {} + \
250 || die "${LINENO}: failed to disable hardcoded settings" 253 || die "${LINENO}: failed to disable hardcoded settings"
251 254
252 # NOTE Append some useful summary here 255 # NOTE Append some useful summary here
253 cat >> CMakeLists.txt <<- _EOF_ 256 cat >> "${CMAKE_USE_DIR}"/CMakeLists.txt <<- _EOF_
254 257
255 MESSAGE(STATUS "<<< Gentoo configuration >>> 258 MESSAGE(STATUS "<<< Gentoo configuration >>>
256 Build type \${CMAKE_BUILD_TYPE} 259 Build type \${CMAKE_BUILD_TYPE}
257 Install path \${CMAKE_INSTALL_PREFIX} 260 Install path \${CMAKE_INSTALL_PREFIX}
258 Compiler flags: 261 Compiler flags:
346 349
347 # Common configure parameters (overridable) 350 # Common configure parameters (overridable)
348 # NOTE CMAKE_BUILD_TYPE can be only overriden via CMAKE_BUILD_TYPE eclass variable 351 # NOTE CMAKE_BUILD_TYPE can be only overriden via CMAKE_BUILD_TYPE eclass variable
349 # No -DCMAKE_BUILD_TYPE=xxx definitions will be in effect. 352 # No -DCMAKE_BUILD_TYPE=xxx definitions will be in effect.
350 local cmakeargs=( 353 local cmakeargs=(
354 --no-warn-unused-cli
351 -C "${common_config}" 355 -C "${common_config}"
352 -DCMAKE_INSTALL_PREFIX="${EPREFIX}${PREFIX:-/usr}" 356 -DCMAKE_INSTALL_PREFIX="${EPREFIX}${PREFIX:-/usr}"
353 "${mycmakeargs_local[@]}" 357 "${mycmakeargs_local[@]}"
354 -DCMAKE_BUILD_TYPE="${CMAKE_BUILD_TYPE}" 358 -DCMAKE_BUILD_TYPE="${CMAKE_BUILD_TYPE}"
355 -DCMAKE_INSTALL_DO_STRIP=OFF 359 -DCMAKE_INSTALL_DO_STRIP=OFF
408 fi 412 fi
409} 413}
410 414
411enable_cmake-utils_src_test() { 415enable_cmake-utils_src_test() {
412 debug-print-function ${FUNCNAME} "$@" 416 debug-print-function ${FUNCNAME} "$@"
417 local ctestargs
413 418
414 _check_build_dir 419 _check_build_dir
415 pushd "${CMAKE_BUILD_DIR}" > /dev/null 420 pushd "${CMAKE_BUILD_DIR}" > /dev/null
416 local ctestargs 421 [[ -e CTestTestfile.cmake ]] || { echo "No tests found. Skipping."; return 0 ; }
422
417 [[ -n ${TEST_VERBOSE} ]] && ctestargs="--extra-verbose --output-on-failure" 423 [[ -n ${TEST_VERBOSE} ]] && ctestargs="--extra-verbose --output-on-failure"
418 ctest ${ctestargs} "$@" || die "Tests failed." 424 ctest ${ctestargs} "$@" || die "Tests failed."
419 popd > /dev/null 425 popd > /dev/null
420} 426}
421 427

Legend:
Removed from v.1.65  
changed lines
  Added in v.1.69

  ViewVC Help
Powered by ViewVC 1.1.20