Bug 13837

Summary: cmake: changing OECMAKE_GENERATOR needs to force do_configure to start with a clean ${B} dir
Product: [Build System, Metadata & Runtime] OE-Core Reporter: Chris Laplante <mostthingsweb>
Component: devtools / tool chainAssignee: Chris Laplante <mostthingsweb>
Status: RESOLVED INVALID QA Contact:
Severity: normal    
Priority: Undecided CC: meta.mr.watcher, meta.watcher, pascal.bach
Version: 3.0.3   
Target Milestone: ---   
Hardware: x86   
OS: Multiple   
Whiteboard:
OS type for building Yocto: --- Type of Regression: ---
Verified: Documentation change: No (bug/feature does not impact docs)

Description Chris Laplante 2020-03-18 16:08:20 UTC
Changing the generator in a CMake recipe needs to somehow clear out ${B} and force do_configure to start from scratch. Otherwise you get errors from CMake like:

    CMake Error: Error: generator : Ninja
    Does not match the generator used previously: Unix Makefiles
    Either remove the CMakeCache.txt file and CMakeFiles directory or choose a different binary directory.

Perhaps something like:

    do_patch[vardeps] += "OECMAKE_GENERATOR"

but maybe there is a more elegant way.
Comment 1 Chris Laplante 2020-03-18 18:28:33 UTC
My bad, I was using a version of cmake.bbclass that was missing this part:



    if [ "${S}" != "${B}" ]; then
        rm -rf ${B}
        mkdir -p ${B}
        cd ${B}
    else
        find ${B} -name CMakeFiles -or -name Makefile -or -name cmake_install.cmake -or -name CMakeCache.txt -delete
    fi


Sorry for the noise.