[source] cmake: include/cmake.mk add CMAKE_BINARY_SUBDIR to allow out of source tree builds
LEDE Commits
lede-commits at lists.infradead.org
Fri Jul 29 12:00:55 PDT 2016
nbd pushed a commit to source.git, branch master:
https://git.lede-project.org/?p=source.git;a=commitdiff;h=eadf5fb7f8313d78fa503665e96457d080e6e3f9
commit eadf5fb7f8313d78fa503665e96457d080e6e3f9
Author: Luke McKee <hojuruku at gmail.com>
AuthorDate: Sun Jul 24 02:00:24 2016 +0700
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 at gmail.com>
Signed-off-by: Felix Fietkau <nbd at nbd.name> [cleanup, rework]
---
include/cmake.mk | 7 +++++--
include/package-defaults.mk | 2 +-
2 files changed, 6 insertions(+), 3 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)" \
diff --git a/include/package-defaults.mk b/include/package-defaults.mk
index 2896b4c..e371c3b 100644
--- a/include/package-defaults.mk
+++ b/include/package-defaults.mk
@@ -136,7 +136,7 @@ MAKE_INSTALL_FLAGS = \
$(MAKE_FLAGS) \
DESTDIR="$(PKG_INSTALL_DIR)"
-MAKE_PATH = .
+MAKE_PATH ?= .
define Build/Compile/Default
+$(MAKE_VARS) \
More information about the lede-commits
mailing list