]> code.ossystems Code Review - openembedded-core.git/commitdiff
cmake.bbclass: remove ${B} before cmake_do_configure
authorKai Kang <kai.kang@windriver.com>
Fri, 23 Apr 2021 03:29:03 +0000 (11:29 +0800)
committerRichard Purdie <richard.purdie@linuxfoundation.org>
Sat, 24 Apr 2021 16:53:01 +0000 (17:53 +0100)
It is fallible to remove ${B} in directory ${B} itself. And it does fail
when call bitbake by third-party wrapper script.

Use flag 'cleandirs' to remove ${B} first if build out of source tree.

Signed-off-by: Kai Kang <kai.kang@windriver.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
meta/classes/cmake.bbclass

index 8876ce5aa565e059ed6bddf8c1db33ecb9693f34..f01db7480b8c6ff69b093e42197c92ec9ba85e49 100644 (file)
@@ -149,16 +149,14 @@ addtask generate_toolchain_file after do_patch before do_configure
 
 CONFIGURE_FILES = "CMakeLists.txt"
 
+do_configure[cleandirs] = "${@d.getVar('B') if d.getVar('S') != d.getVar('B') else ''}"
+
 cmake_do_configure() {
        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
-               rm -rf ${B}
-               mkdir -p ${B}
-               cd ${B}
-       else
+       if [ "${S}" = "${B}" ]; then
                find ${B} -name CMakeFiles -or -name Makefile -or -name cmake_install.cmake -or -name CMakeCache.txt -delete
        fi