Skip to content

Commit 7bf8d56

Browse files
committed
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: openwrt/openwrt#22042 Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
1 parent b237266 commit 7bf8d56

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

include/cmake.mk

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -89,8 +89,8 @@ endif
8989
define Build/Configure/Default
9090
mkdir -p $(CMAKE_BINARY_DIR)
9191
(cd $(CMAKE_BINARY_DIR); \
92-
CFLAGS="$(TARGET_CFLAGS) $(EXTRA_CFLAGS)" \
93-
CXXFLAGS="$(TARGET_CXXFLAGS) $(EXTRA_CXXFLAGS)" \
92+
CFLAGS="$(TARGET_CFLAGS) $(EXTRA_CFLAGS) $(TARGET_CPPFLAGS) $(EXTRA_CPPFLAGS)" \
93+
CXXFLAGS="$(TARGET_CXXFLAGS) $(EXTRA_CXXFLAGS) $(TARGET_CPPFLAGS) $(EXTRA_CPPFLAGS)" \
9494
LDFLAGS="$(TARGET_LDFLAGS) $(EXTRA_LDFLAGS)" \
9595
cmake \
9696
--no-warn-unused-cli \

0 commit comments

Comments
 (0)