I'm not sure I like the idea. This is going to break ptests or other usage of CTest in cmake-based recipes that aren't under our control. Building tests is also a test in itself even if you don't run them. I'd say unless this adds significantly to build times we should leave it as it is.
Alex On Tue, 23 Apr 2024 at 14:31, Fabio Berton via lists.openembedded.org <[email protected]> wrote: > > I've noticed that some recipes, like json-c [1], which use the cmake bbclass, > are generating files that aren't being used. This is because CMake sets the > BUILD_TESTING option to ON by default. According to the CMake documentation > [2], when CTest is included, as json-c does here [3], the module > automatically creates a BUILD_TESTING option. This option determines whether > to enable testing support, and it is ON by default. > > In the json-c example, the tests used by the do_install_ptest task are always > generated. Thus, ${B}/tests/ exists even when ptests are not included in > DISTRO_FEATURES. > > As the behavior of CTest/CMake to build tests by default is rather > surprising, we are wondering whether disabling this option by default is > feasible in the OpenEmbedded context. Recipes expecting tests to be built > (e.g. because of ptest support) would then turn on the flag explicitly. > > For example, adding this to cmake.bbclass: > > OECMAKE_BUILD_TESTING ??= "false" > > EXTRA_OECMAKE:append = "\\ > ${@bb.utils.contains('OECMAKE_BUILD_TESTING', 'false', > '-DBUILD_TESTING=OFF', '', d)} \\ > " > > and then set the OECMAKE_BUILD_TESTING in the recipe that requires > BUILD_TESTING=ON > > Do you have any suggestions on which steps we should take to verify that this > does not introduce any regressions? > > > 1 - > https://git.openembedded.org/openembedded-core/tree/meta/recipes-devtools/json-c/json-c_0.17.bb?h=master > > 2 - https://cmake.org/cmake/help/latest/module/CTest.html > > 3 - https://github.com/json-c/json-c/blob/master/CMakeLists.txt#L19 > > > Regards, > > Fabio Berton > > > >
-=-=-=-=-=-=-=-=-=-=-=- Links: You receive all messages sent to this group. View/Reply Online (#198624): https://lists.openembedded.org/g/openembedded-core/message/198624 Mute This Topic: https://lists.openembedded.org/mt/105688417/21656 Group Owner: [email protected] Unsubscribe: https://lists.openembedded.org/g/openembedded-core/unsub [[email protected]] -=-=-=-=-=-=-=-=-=-=-=-
