summaryrefslogtreecommitdiffstats
path: root/package/pkg-cmake.mk
diff options
context:
space:
mode:
authorGwenhael Goavec-Merou <gwenhael.goavec-merou@trabucayre.com>2015-03-13 09:24:08 +0100
committerThomas Petazzoni <thomas.petazzoni@free-electrons.com>2015-03-13 22:34:43 +0100
commit604c92043bf0e40a8eb23aa54f57d0e49ca6fbe2 (patch)
tree2f8595c20b51daaea5564d87b23864430a5fb9fa /package/pkg-cmake.mk
parent68443c52dd871ec157aff6b3f77bed1294c2eb57 (diff)
downloadbuildroot-604c92043bf0e40a8eb23aa54f57d0e49ca6fbe2.tar.gz
buildroot-604c92043bf0e40a8eb23aa54f57d0e49ca6fbe2.zip
pkg-cmake: allow to build package in a subdirectory
For some cmake based packages, like GNURadio, it's forbidden to do the compilation directly in the sources directory. This patch add a new variable to specify, if needed, the name of a sub-directory used to compile. [Thomas: put the documentation at the right place in the manual, not in the middle of the <pkg>_CONF_OPTS description.] Signed-off-by: Gwenhael Goavec-Merou <gwenhael.goavec-merou@trabucayre.com> Reviewed-by: Arnout Vandecappelle (Essensium/Mind) <arnout@mind.be> Tested-by: Angelo Compagnucci <angelo.compagnucci@gmail.com> Reviewed-by: Samuel Martin <s.martin49@gmail.com> Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
Diffstat (limited to 'package/pkg-cmake.mk')
-rw-r--r--package/pkg-cmake.mk14
1 files changed, 12 insertions, 2 deletions
diff --git a/package/pkg-cmake.mk b/package/pkg-cmake.mk
index 2404c40122..2262012483 100644
--- a/package/pkg-cmake.mk
+++ b/package/pkg-cmake.mk
@@ -61,7 +61,15 @@ $(2)_INSTALL_STAGING_OPTS ?= DESTDIR=$$(STAGING_DIR) install
$(2)_INSTALL_TARGET_OPTS ?= DESTDIR=$$(TARGET_DIR) install
$(2)_SRCDIR = $$($(2)_DIR)/$$($(2)_SUBDIR)
+
+$(3)_SUPPORTS_IN_SOURCE_BUILD ?= YES
+
+
+ifeq ($$($(3)_SUPPORTS_IN_SOURCE_BUILD),YES)
$(2)_BUILDDIR = $$($(2)_SRCDIR)
+else
+$(2)_BUILDDIR = $$($(2)_SRCDIR)/buildroot-build
+endif
#
# Configure step. Only define it if not already defined by the package
@@ -73,7 +81,8 @@ ifeq ($(4),target)
# Configure package for target
define $(2)_CONFIGURE_CMDS
- (cd $$($$(PKG)_BUILDDIR) && \
+ (mkdir -p $$($$(PKG)_BUILDDIR) && \
+ cd $$($$(PKG)_BUILDDIR) && \
rm -f CMakeCache.txt && \
PATH=$$(BR_PATH) \
$$($$(PKG)_CONF_ENV) $$(HOST_DIR)/usr/bin/cmake $$($$(PKG)_SRCDIR) \
@@ -98,7 +107,8 @@ else
# Configure package for host
define $(2)_CONFIGURE_CMDS
- (cd $$($$(PKG)_BUILDDIR) && \
+ (mkdir -p $$($$(PKG)_BUILDDIR) && \
+ cd $$($$(PKG)_BUILDDIR) && \
rm -f CMakeCache.txt && \
PATH=$$(BR_PATH) \
$$(HOST_DIR)/usr/bin/cmake $$($$(PKG)_SRCDIR) \
OpenPOWER on IntegriCloud