* [PATCH] cmake: stop FetchContent from fetching content
@ 2022-02-09 12:53 Ross Burton
2022-02-09 17:45 ` [OE-core] " Khem Raj
0 siblings, 1 reply; 4+ messages in thread
From: Ross Burton @ 2022-02-09 12:53 UTC (permalink / raw)
To: openembedded-core
CMake includes a FetchContent module, which will download further
source code at configure time. With the network isolation this will now
fail, but as not all environments support network isolation we can tell
cmake to not download either for extra safety.
Signed-off-by: Ross Burton <ross.burton@arm.com>
---
meta/classes/cmake.bbclass | 1 +
1 file changed, 1 insertion(+)
diff --git a/meta/classes/cmake.bbclass b/meta/classes/cmake.bbclass
index 92b9197c487..fac7bbca7a3 100644
--- a/meta/classes/cmake.bbclass
+++ b/meta/classes/cmake.bbclass
@@ -189,6 +189,7 @@ cmake_do_configure() {
-DCMAKE_TOOLCHAIN_FILE=${WORKDIR}/toolchain.cmake \
-DCMAKE_NO_SYSTEM_FROM_IMPORTED=1 \
-DCMAKE_EXPORT_NO_PACKAGE_REGISTRY=ON \
+ -DFETCHCONTENT_FULLY_DISCONNECTED=ON \
${EXTRA_OECMAKE} \
-Wno-dev
}
--
2.25.1
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [OE-core] [PATCH] cmake: stop FetchContent from fetching content
2022-02-09 12:53 [PATCH] cmake: stop FetchContent from fetching content Ross Burton
@ 2022-02-09 17:45 ` Khem Raj
2022-02-10 10:15 ` Eero Aaltonen
0 siblings, 1 reply; 4+ messages in thread
From: Khem Raj @ 2022-02-09 17:45 UTC (permalink / raw)
To: Ross Burton, openembedded-core
On 2/9/22 4:53 AM, Ross Burton wrote:
> CMake includes a FetchContent module, which will download further
> source code at configure time. With the network isolation this will now
> fail, but as not all environments support network isolation we can tell
> cmake to not download either for extra safety.
>
what is cmake's default ? I think it could become a constant source of
pain if it is not default. Since many cmake based packages might start
to depend on it indirectly in future.
> Signed-off-by: Ross Burton <ross.burton@arm.com>
> ---
> meta/classes/cmake.bbclass | 1 +
> 1 file changed, 1 insertion(+)
>
> diff --git a/meta/classes/cmake.bbclass b/meta/classes/cmake.bbclass
> index 92b9197c487..fac7bbca7a3 100644
> --- a/meta/classes/cmake.bbclass
> +++ b/meta/classes/cmake.bbclass
> @@ -189,6 +189,7 @@ cmake_do_configure() {
> -DCMAKE_TOOLCHAIN_FILE=${WORKDIR}/toolchain.cmake \
> -DCMAKE_NO_SYSTEM_FROM_IMPORTED=1 \
> -DCMAKE_EXPORT_NO_PACKAGE_REGISTRY=ON \
> + -DFETCHCONTENT_FULLY_DISCONNECTED=ON \
> ${EXTRA_OECMAKE} \
> -Wno-dev
> }
>
>
>
> -=-=-=-=-=-=-=-=-=-=-=-
> Links: You receive all messages sent to this group.
> View/Reply Online (#161554): https://lists.openembedded.org/g/openembedded-core/message/161554
> Mute This Topic: https://lists.openembedded.org/mt/89020454/1997914
> Group Owner: openembedded-core+owner@lists.openembedded.org
> Unsubscribe: https://lists.openembedded.org/g/openembedded-core/unsub [raj.khem@gmail.com]
> -=-=-=-=-=-=-=-=-=-=-=-
>
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [OE-core] [PATCH] cmake: stop FetchContent from fetching content
2022-02-09 17:45 ` [OE-core] " Khem Raj
@ 2022-02-10 10:15 ` Eero Aaltonen
2022-02-10 11:40 ` Ross Burton
0 siblings, 1 reply; 4+ messages in thread
From: Eero Aaltonen @ 2022-02-10 10:15 UTC (permalink / raw)
To: raj.khem, Ross Burton, openembedded-core
On Wed, 2022-02-09 at 09:45 -0800, Khem Raj via lists.openembedded.org
wrote:
> On 2/9/22 4:53 AM, Ross Burton wrote:
> > CMake includes a FetchContent module, which will download further
> > source code at configure time. With the network isolation this
> > will now fail, but as not all environments support network
> > isolation we can tell cmake to not download either for extra
> > safety.
>
> what is cmake's default ? I think it could become a constant source
> of pain if it is not default. Since many cmake based packages might
> start to depend on it indirectly in future.
CMake's default is to allow downloads.
It's possible to write CMake projects so that they try find_package
first and then fall back to downloading. I think
FETCHCONTENT_FULLY_DISCONNECTED might be a helpful flag so that the
build can then simply report if a required dependency has the wrong
version or so.
CMake projects that use _only_ FetchContent will likely need heavier
patching.
Eero
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [OE-core] [PATCH] cmake: stop FetchContent from fetching content
2022-02-10 10:15 ` Eero Aaltonen
@ 2022-02-10 11:40 ` Ross Burton
0 siblings, 0 replies; 4+ messages in thread
From: Ross Burton @ 2022-02-10 11:40 UTC (permalink / raw)
To: Eero Aaltonen; +Cc: raj.khem, openembedded-core
On Thu, 10 Feb 2022 at 10:13, Eero Aaltonen <eero.aaltonen@vaisala.com> wrote:
> > what is cmake's default ? I think it could become a constant source
> > of pain if it is not default. Since many cmake based packages might
> > start to depend on it indirectly in future.
>
> CMake's default is to allow downloads.
>
> It's possible to write CMake projects so that they try find_package
> first and then fall back to downloading. I think
> FETCHCONTENT_FULLY_DISCONNECTED might be a helpful flag so that the
> build can then simply report if a required dependency has the wrong
> version or so.
>
> CMake projects that use _only_ FetchContent will likely need heavier
> patching.
The reasoning for this patch is that with the network isolation change
the FetchContents will fail, but as in some environments the network
isolation doesn't work (eg Docker containers) we can disable
FetchContent explicitly too.
Yes, projects which just use FetchContent are a pain. Lets guess why
I wrote this patch. :)
Ross
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2022-02-10 11:40 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-02-09 12:53 [PATCH] cmake: stop FetchContent from fetching content Ross Burton
2022-02-09 17:45 ` [OE-core] " Khem Raj
2022-02-10 10:15 ` Eero Aaltonen
2022-02-10 11:40 ` Ross Burton
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox