diff options
author | Luke McKee <hojuruku@gmail.com> | 2016-07-24 02:00:24 +0700 |
---|---|---|
committer | Felix Fietkau <nbd@nbd.name> | 2016-07-29 20:27:34 +0200 |
commit | eadf5fb7f8313d78fa503665e96457d080e6e3f9 (patch) | |
tree | 22697a856c3d56963786b557eeb38389d10b0549 /include/cmake.mk | |
parent | 009d6d602496947877766df6f152c713056201de (diff) | |
download | mtk-20170518-eadf5fb7f8313d78fa503665e96457d080e6e3f9.zip mtk-20170518-eadf5fb7f8313d78fa503665e96457d080e6e3f9.tar.gz mtk-20170518-eadf5fb7f8313d78fa503665e96457d080e6e3f9.tar.bz2 |
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]
Diffstat (limited to 'include/cmake.mk')
-rw-r--r-- | include/cmake.mk | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/include/cmake.mk b/include/cmake.mk index 009c6c2..fac2bc0 100644 --- a/include/cmake.mk +++ b/include/cmake.mk @@ -6,7 +6,9 @@ ifneq ($(findstring c,$(OPENWRT_VERBOSE)),) MAKE_FLAGS+=VERBOSE=1 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),) 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 define Build/Configure/Default - (cd $(PKG_BUILD_DIR); \ + mkdir -p $(CMAKE_BINARY_DIR) + (cd $(CMAKE_BINARY_DIR); \ CFLAGS="$(TARGET_CFLAGS) $(EXTRA_CFLAGS)" \ CXXFLAGS="$(TARGET_CFLAGS) $(EXTRA_CFLAGS)" \ LDFLAGS="$(TARGET_LDFLAGS) $(EXTRA_LDFLAGS)" \ |