| 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.68 2011/04/27 16:54:44 scarabeus 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 | # |
| … | |
… | |
| 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 | |
242 | |
|
|
243 | # Only edit the files once |
|
|
244 | grep -qs "<<< Gentoo configuration >>>" CMakeLists.txt && return 0 |
|
|
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}' {} + \ |
| 247 | -exec sed -i -e '/^[[:space:]]*[sS][eE][tT][[:space:]]*([[:space:]]*CMAKE_COLOR_MAKEFILE.*)/{s/^/#IGNORE /g}' {} + \ |
250 | -exec sed -i -e '/^[[:space:]]*[sS][eE][tT][[:space:]]*([[:space:]]*CMAKE_COLOR_MAKEFILE.*)/{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: |