summaryrefslogtreecommitdiffstats
path: root/meta/classes/cmake.bbclass
diff options
context:
space:
mode:
authorRoss Burton <ross.burton@intel.com>2013-12-03 15:42:58 +0000
committerRichard Purdie <richard.purdie@linuxfoundation.org>2014-01-14 11:33:55 +0000
commit6aafc529d7007e4d5646cb76c5f4573d8598602f (patch)
treed2018060c15d7dd63efd01baa5239b4e629e0cfa /meta/classes/cmake.bbclass
parentd4ad8f7119cceff3e7088227e19e80e3485ec2ff (diff)
downloadast2050-yocto-poky-6aafc529d7007e4d5646cb76c5f4573d8598602f.zip
ast2050-yocto-poky-6aafc529d7007e4d5646cb76c5f4573d8598602f.tar.gz
cmake: respect ${S} and ${B}
Instead of the class-specific variables OECMAKE_BUILDPATH and OECMAKE_SOURCEPATH, just use ${B} and ${S}. If these two paths are different, delete any existing ${B} before running a build so that previous builds don't taint the current build. Note that OECMAKE_SOURCEPATH and OECMAKE_BUILDPATH are not respected, so recipes that manually set these in the past will need to be updated to either use something along the lines of separatebuilddir.inc or set B themselves. If the old variables are set, a warning is displayed. (From OE-Core rev: 43073569cb67d98c11aa71211d77b566b64f9145) Signed-off-by: Ross Burton <ross.burton@intel.com> Signed-off-by: Saul Wold <sgw@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/classes/cmake.bbclass')
-rw-r--r--meta/classes/cmake.bbclass35
1 files changed, 11 insertions, 24 deletions
diff --git a/meta/classes/cmake.bbclass b/meta/classes/cmake.bbclass
index 30c1792..1dc406d 100644
--- a/meta/classes/cmake.bbclass
+++ b/meta/classes/cmake.bbclass
@@ -6,15 +6,6 @@ CCACHE = ""
# We want the staging and installing functions from autotools
inherit autotools
-# Use in-tree builds by default but allow this to be changed
-# since some packages do not support them (e.g. llvm 2.5).
-OECMAKE_SOURCEPATH ?= "."
-
-# If declaring this, make sure you also set EXTRA_OEMAKE to
-# "-C ${OECMAKE_BUILDPATH}". So it will run the right makefiles.
-OECMAKE_BUILDPATH ?= ""
-B="${S}"
-
# C/C++ Compiler (without cpu arch/tune arguments)
OECMAKE_C_COMPILER ?= "`echo ${CC} | sed 's/^\([^ ]*\).*/\1/'`"
OECMAKE_CXX_COMPILER ?= "`echo ${CXX} | sed 's/^\([^ ]*\).*/\1/'`"
@@ -73,10 +64,14 @@ EOF
addtask generate_toolchain_file after do_patch before do_configure
cmake_do_configure() {
- if [ ${OECMAKE_BUILDPATH} ]
- then
- mkdir -p ${OECMAKE_BUILDPATH}
- cd ${OECMAKE_BUILDPATH}
+ if [ "${OECMAKE_BUILDPATH}" -o "${OECMAKE_SOURCEPATH}" ]; then
+ bbnote "cmake.bbclass no longer uses OECMAKE_SOURCEPATH and OECMAKE_BUILDPATH. This recipe now will do in-tree builds, to do out-of-tree builds set S and B."
+ fi
+
+ if [ "${S}" != "${B}" ]; then
+ rm -rf ${B}
+ mkdir -p ${B}
+ cd ${B}
fi
# Just like autotools cmake can use a site file to cache result that need generated binaries to run
@@ -88,7 +83,7 @@ cmake_do_configure() {
cmake \
${OECMAKE_SITEFILE} \
- ${OECMAKE_SOURCEPATH} \
+ ${S} \
-DCMAKE_INSTALL_PREFIX:PATH=${prefix} \
-DCMAKE_INSTALL_SO_NO_EXE=0 \
-DCMAKE_TOOLCHAIN_FILE=${WORKDIR}/toolchain.cmake \
@@ -98,20 +93,12 @@ cmake_do_configure() {
}
cmake_do_compile() {
- if [ ${OECMAKE_BUILDPATH} ]
- then
- cd ${OECMAKE_BUILDPATH}
- fi
-
+ cd ${B}
base_do_compile
}
cmake_do_install() {
- if [ ${OECMAKE_BUILDPATH} ];
- then
- cd ${OECMAKE_BUILDPATH}
- fi
-
+ cd ${B}
autotools_do_install
}
OpenPOWER on IntegriCloud