summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichał Górny <mgorny@gentoo.org>2016-11-27 14:28:55 +0100
committerMichał Górny <mgorny@gentoo.org>2016-11-30 10:42:11 +0100
commit92700a0e7bce7aeadaf65fb778cec49e5ebc594d (patch)
treef1baccfdb0d9a9c8da64e0ee3386ba57ffbd0581 /eclass/cmake-utils.eclass
parentcmake-utils.eclass: Declare CMAKE_GENTOO_BUILD (diff)
downloadgentoo-92700a0e7bce7aeadaf65fb778cec49e5ebc594d.tar.gz
gentoo-92700a0e7bce7aeadaf65fb778cec49e5ebc594d.tar.bz2
gentoo-92700a0e7bce7aeadaf65fb778cec49e5ebc594d.zip
cmake-utils.eclass: Wipe out default flags for std build types
Wipe out the default compiler & linker flags that are forced by CMake for the standard build types. This improves the sanity of the build if we are forced to use one of those types.
Diffstat (limited to 'eclass/cmake-utils.eclass')
-rw-r--r--eclass/cmake-utils.eclass13
1 files changed, 13 insertions, 0 deletions
diff --git a/eclass/cmake-utils.eclass b/eclass/cmake-utils.eclass
index fbd60c24ab27..b21435b1782d 100644
--- a/eclass/cmake-utils.eclass
+++ b/eclass/cmake-utils.eclass
@@ -599,6 +599,19 @@ enable_cmake-utils_src_configure() {
_EOF_
[[ "${NOCOLOR}" = true || "${NOCOLOR}" = yes ]] && echo 'SET (CMAKE_COLOR_MAKEFILE OFF CACHE BOOL "pretty colors during make" FORCE)' >> "${common_config}"
+ # Wipe the default optimization flags out of CMake
+ if [[ ${CMAKE_BUILD_TYPE} != Gentoo ]] && ! has "${EAPI}" 2 3 4 5; then
+ cat >> ${common_config} <<- _EOF_ || die
+ SET (CMAKE_C_FLAGS_${CMAKE_BUILD_TYPE^^} "" CACHE STRING "")
+ SET (CMAKE_CXX_FLAGS_${CMAKE_BUILD_TYPE^^} "" CACHE STRING "")
+ SET (CMAKE_Fortran_FLAGS_${CMAKE_BUILD_TYPE^^} "" CACHE STRING "")
+ SET (CMAKE_EXE_LINKER_FLAGS_${CMAKE_BUILD_TYPE^^} "" CACHE STRING "")
+ SET (CMAKE_MODULE_LINKER_FLAGS_${CMAKE_BUILD_TYPE^^} "" CACHE STRING "")
+ SET (CMAKE_SHARED_LINKER_FLAGS_${CMAKE_BUILD_TYPE^^} "" CACHE STRING "")
+ SET (CMAKE_STATIC_LINKER_FLAGS_${CMAKE_BUILD_TYPE^^} "" CACHE STRING "")
+ _EOF_
+ fi
+
# Convert mycmakeargs to an array, for backwards compatibility
# Make the array a local variable since <=portage-2.1.6.x does not
# support global arrays (see bug #297255).