cmake: include/cmake.mk add CMAKE_BINARY_SUBDIR to allow out of source tree builds
Some packages need out of source tree building with cmake, for example when building kernel modules. See an example here: https://sourceforge.net/p/accel-ppp/code/ci/master/tree/README Signed-off-by: Luke McKee <hojuruku@gmail.com> Signed-off-by: Felix Fietkau <nbd@nbd.name> [cleanup, rework]
This commit is contained in:
parent
009d6d6024
commit
eadf5fb7f8
2 changed files with 6 additions and 3 deletions
|
@ -6,7 +6,9 @@ ifneq ($(findstring c,$(OPENWRT_VERBOSE)),)
|
||||||
MAKE_FLAGS+=VERBOSE=1
|
MAKE_FLAGS+=VERBOSE=1
|
||||||
endif
|
endif
|
||||||
|
|
||||||
CMAKE_SOURCE_DIR:=.
|
CMAKE_BINARY_DIR = $(PKG_BUILD_DIR)$(if $(CMAKE_BINARY_SUBDIR),/$(CMAKE_BINARY_SUBDIR))
|
||||||
|
CMAKE_SOURCE_DIR = $(PKG_BUILD_DIR)
|
||||||
|
MAKE_PATH = $(firstword $(CMAKE_BINARY_SUBDIR) .)
|
||||||
|
|
||||||
ifeq ($(CONFIG_EXTERNAL_TOOLCHAIN),)
|
ifeq ($(CONFIG_EXTERNAL_TOOLCHAIN),)
|
||||||
cmake_tool=$(TOOLCHAIN_DIR)/bin/$(1)
|
cmake_tool=$(TOOLCHAIN_DIR)/bin/$(1)
|
||||||
|
@ -35,7 +37,8 @@ CMAKE_HOST_FIND_ROOT_PATH:=$(STAGING_DIR)/host;$(STAGING_DIR_HOST)
|
||||||
CMAKE_SHARED_LDFLAGS:=-Wl,-Bsymbolic-functions
|
CMAKE_SHARED_LDFLAGS:=-Wl,-Bsymbolic-functions
|
||||||
|
|
||||||
define Build/Configure/Default
|
define Build/Configure/Default
|
||||||
(cd $(PKG_BUILD_DIR); \
|
mkdir -p $(CMAKE_BINARY_DIR)
|
||||||
|
(cd $(CMAKE_BINARY_DIR); \
|
||||||
CFLAGS="$(TARGET_CFLAGS) $(EXTRA_CFLAGS)" \
|
CFLAGS="$(TARGET_CFLAGS) $(EXTRA_CFLAGS)" \
|
||||||
CXXFLAGS="$(TARGET_CFLAGS) $(EXTRA_CFLAGS)" \
|
CXXFLAGS="$(TARGET_CFLAGS) $(EXTRA_CFLAGS)" \
|
||||||
LDFLAGS="$(TARGET_LDFLAGS) $(EXTRA_LDFLAGS)" \
|
LDFLAGS="$(TARGET_LDFLAGS) $(EXTRA_LDFLAGS)" \
|
||||||
|
|
|
@ -136,7 +136,7 @@ MAKE_INSTALL_FLAGS = \
|
||||||
$(MAKE_FLAGS) \
|
$(MAKE_FLAGS) \
|
||||||
DESTDIR="$(PKG_INSTALL_DIR)"
|
DESTDIR="$(PKG_INSTALL_DIR)"
|
||||||
|
|
||||||
MAKE_PATH = .
|
MAKE_PATH ?= .
|
||||||
|
|
||||||
define Build/Compile/Default
|
define Build/Compile/Default
|
||||||
+$(MAKE_VARS) \
|
+$(MAKE_VARS) \
|
||||||
|
|
Loading…
Reference in a new issue