#1153355 cmake: CPPFLAGS are ignored when compiling Objective-C++

Package:
cmake
Source:
cmake
Description:
cross-platform, open-source make system
Submitter:
Yavor Doganov
Date:
2026-11-07 16:55:02 UTC
Severity:
normal
#1153355#5
Date:
2026-11-07 16:54:13 UTC
From:
To:
I am working on a package which uses CMake as its build system and
contains files in C, C++, Objective-C and Objective-C++.  CPPFLAGS, as
set for a hardened build of a Debian package, are not used when
compiling Objective-C++ so blhc rightfully complains:

CPPFLAGS missing (-D_FORTIFY_SOURCE=2): [34/463] /usr/lib/ccache/clang++ -DCXA_ALLOCATE_EXCEPTION_SPECIFIER=noexcept -DGNUSTEP -DNO_LEGACY -DOLDABI_COMPAT=1 -DTYPE_DEPENDENT_DISPATCH -D__OBJC_RUNTIME_INTERNAL__=1 -Dobjc_EXPORTS  -x objective-c++ -g -O2 -ffile-prefix-map=/build/reproducible-path/libobjc2-2.2.1=. -fstack-protector-strong -fstack-clash-protection -Wformat -Werror=format-security -fcf-protection -std=gnu++17 -fPIC -Wno-deprecated-objc-isa-usage -Wno-objc-root-class -fobjc-runtime=gnustep-2.0 -MD -MT CMakeFiles/objc.dir/arc.mm.o -MF CMakeFiles/objc.dir/arc.mm.o.d -o CMakeFiles/objc.dir/arc.mm.o -c /build/reproducible-path/libobjc2-2.2.1/arc.mm

A workaround is to include buildflags.mk and then set

export DEB_OBJCXXFLAGS_MAINT_APPEND := $(CPPFLAGS)