]> git.ipfire.org Git - thirdparty/openwrt.git/commit
build: pass CPPFLAGS to cmake build
authorHauke Mehrtens <hauke@hauke-m.de>
Sun, 15 Feb 2026 23:49:15 +0000 (00:49 +0100)
committerHauke Mehrtens <hauke@hauke-m.de>
Tue, 17 Feb 2026 00:47:41 +0000 (01:47 +0100)
commitff3fad172d285b1504d54739f9ab7dfb23cf66cb
tree1da024baa0a989c276cbcae8a0c1aa7d4232ed87
parenteddb6342cd4a4470b489a9c9c39893be37440511
build: pass CPPFLAGS to cmake build

The TARGET_CPPFLAGS contain the include paths used by OpenWrt. This also
contains the including of the fortify sources headers. If they are not
provided, the applications will not use fortify sources headers when
compiled against musl. Add them to cmake builds too. cmake does not
support a special CPPFLGS option [0], just add them to CFLAGS and
CXXFLAGS like we also do it for meson and normal make.
This should fix fortify sources support for cmake builds.

I found this explanation for the flags:
 * CFLAGS: C flags, passed during compile AND link
 * CXXFLAGS: C++ flags, passed during compile AND link
 * CPPFLAGS: pre-processor flags, passed ONLY during compile
 * LDFLAGS: linker flags, passed ONLY during link

[0]: https://gitlab.kitware.com/cmake/cmake/-/issues/12928

Link: https://github.com/openwrt/openwrt/pull/22042
Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
(cherry picked from commit 7bf8d568f6c83411041e504e0ca231d4081c2534)
include/cmake.mk