Patchwork cmake.bbclass: restore OECMAKE_SOURCEPATH

login
register
mail settings
Submitter Ross Burton
Date June 24, 2014, 8:21 p.m.
Message ID <1403641292-20161-1-git-send-email-ross.burton@intel.com>
Download mbox | patch
Permalink /patch/74297/
State New
Headers show

Comments

Ross Burton - June 24, 2014, 8:21 p.m.
Some packages put their CMakeLists.txt file in a subdirectory, so assuming that
it is in ${S} won't work.

Restore OECMAKE_SOURCEPATH (defaulting to ${S}) so that the location of
CMakeLists.txt can be set if required.

Based on a patch by Miroslav KeŇ° <miroslav.kes@gmail.com>

Signed-off-by: Ross Burton <ross.burton@intel.com>
---
 meta/classes/cmake.bbclass |    9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)

Patch

diff --git a/meta/classes/cmake.bbclass b/meta/classes/cmake.bbclass
index c9c15f3..ab2adec 100644
--- a/meta/classes/cmake.bbclass
+++ b/meta/classes/cmake.bbclass
@@ -1,3 +1,6 @@ 
+# Path to the CMake file to process.
+OECMAKE_SOURCEPATH ?= "${S}"
+
 DEPENDS_prepend = "cmake-native "
 B = "${WORKDIR}/build"
 
@@ -65,8 +68,8 @@  EOF
 addtask generate_toolchain_file after do_patch before do_configure
 
 cmake_do_configure() {
-	if [ "${OECMAKE_BUILDPATH}" -o "${OECMAKE_SOURCEPATH}" ]; then
-		bbnote "cmake.bbclass no longer uses OECMAKE_SOURCEPATH and OECMAKE_BUILDPATH.  The default behaviour is now out-of-tree builds with B=WORKDIR/build."
+	if [ "${OECMAKE_BUILDPATH}" ]; then
+		bbnote "cmake.bbclass no longer uses OECMAKE_BUILDPATH.  The default behaviour is now out-of-tree builds with B=WORKDIR/build."
 	fi
 
 	if [ "${S}" != "${B}" ]; then
@@ -84,7 +87,7 @@  cmake_do_configure() {
 
 	cmake \
 	  ${OECMAKE_SITEFILE} \
-	  ${S} \
+	  ${OECMAKE_SOURCEPATH} \
 	  -DCMAKE_INSTALL_PREFIX:PATH=${prefix} \
 	  -DCMAKE_INSTALL_BINDIR:PATH=${bindir} \
 	  -DCMAKE_INSTALL_SBINDIR:PATH=${sbindir} \