Bug 13837 - cmake: changing OECMAKE_GENERATOR needs to force do_configure to start with a clean ${B} dir
Summary: cmake: changing OECMAKE_GENERATOR needs to force do_configure to start with a...
Status: RESOLVED INVALID
Alias: None
Product: OE-Core
Classification: Build System, Metadata & Runtime
Component: devtools / tool chain (show other bugs)
Version: 3.0.3
Hardware: x86 Multiple
: Undecided normal
Target Milestone: ---
Assignee: Chris Laplante
QA Contact:
URL:
Whiteboard:
Depends on:
Blocks:
 
Reported: 2020-03-18 16:08 UTC by Chris Laplante
Modified: 2020-03-18 18:28 UTC (History)
3 users (show)

See Also:
OS type for building Yocto: ---
Type of Regression: ---
Verified:
Documentation change: No (bug/feature does not impact docs)


Attachments

Note You need to log in before you can comment on or make changes to this bug.
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.