From 6a10d7b6941a971353aa3663140e18800ade0347 Mon Sep 17 00:00:00 2001 From: Modestas Vainius Date: Sat, 18 Feb 2012 13:49:14 +0200 Subject: [PATCH] Respect CPPFLAGS environment variable. Append it to C(XX)FLAGS when building C/C++ sources. Patch support_cppflags.diff. (Closes: #653916) --- debian/changelog | 2 ++ debian/patches/series | 1 + debian/patches/support_cppflags.diff | 32 ++++++++++++++++++++++++++++ 3 files changed, 35 insertions(+) create mode 100644 debian/patches/support_cppflags.diff diff --git a/debian/changelog b/debian/changelog index ae3dcb002..1821ad7c1 100644 --- a/debian/changelog +++ b/debian/changelog @@ -5,6 +5,8 @@ cmake (2.8.7-0r1) UNRELEASED; urgency=low Felix Geyer. (Closes: #634603) * Remove multiarch_lib_dirs_should_be_implicit.diff patch, merged upstream. * Refresh other patches. + * Respect CPPFLAGS environment variable when building C/C++ sources (patch + support_cppflags.diff). (Closes: #653916) -- Modestas Vainius Sat, 18 Feb 2012 12:41:16 +0200 diff --git a/debian/patches/series b/debian/patches/series index cc249dfeb..d3719e20f 100644 --- a/debian/patches/series +++ b/debian/patches/series @@ -1,2 +1,3 @@ FindBoost_add_-lpthread_#563479.diff multiarch_findgtk2_fix.diff +support_cppflags.diff diff --git a/debian/patches/support_cppflags.diff b/debian/patches/support_cppflags.diff new file mode 100644 index 000000000..561864e56 --- /dev/null +++ b/debian/patches/support_cppflags.diff @@ -0,0 +1,32 @@ +From: Modestas Vainius +Subject: Support CPPFLAGS environment variable +Bug: http://www.cmake.org/Bug/view.php?id=12928 +Bug-Debian: http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=653916 +Forwarded: no +Last-Update: 2012-02-18 + +For now, append CPPFLAGS to CFLAGS and CXXFLAGS. In the perfect world, whenever +C/C++ preprocessor is invoked, CPPFLAGS should be passed to it. + +--- a/Modules/CMakeCInformation.cmake ++++ b/Modules/CMakeCInformation.cmake +@@ -102,7 +102,7 @@ IF(NOT CMAKE_MODULE_EXISTS) + SET(CMAKE_SHARED_MODULE_CREATE_C_FLAGS ${CMAKE_SHARED_LIBRARY_CREATE_C_FLAGS}) + ENDIF(NOT CMAKE_MODULE_EXISTS) + +-SET(CMAKE_C_FLAGS_INIT "$ENV{CFLAGS} ${CMAKE_C_FLAGS_INIT}") ++SET(CMAKE_C_FLAGS_INIT "$ENV{CFLAGS} $ENV{CPPFLAGS} ${CMAKE_C_FLAGS_INIT}") + # avoid just having a space as the initial value for the cache + IF(CMAKE_C_FLAGS_INIT STREQUAL " ") + SET(CMAKE_C_FLAGS_INIT) +--- a/Modules/CMakeCXXInformation.cmake ++++ b/Modules/CMakeCXXInformation.cmake +@@ -183,7 +183,7 @@ ENDFOREACH(type) + # on the initial values computed in the platform/*.cmake files + # use _INIT variables so that this only happens the first time + # and you can set these flags in the cmake cache +-SET(CMAKE_CXX_FLAGS_INIT "$ENV{CXXFLAGS} ${CMAKE_CXX_FLAGS_INIT}") ++SET(CMAKE_CXX_FLAGS_INIT "$ENV{CXXFLAGS} $ENV{CPPFLAGS} ${CMAKE_CXX_FLAGS_INIT}") + # avoid just having a space as the initial value for the cache + IF(CMAKE_CXX_FLAGS_INIT STREQUAL " ") + SET(CMAKE_CXX_FLAGS_INIT)