[prev in list] [next in list] [prev in thread] [next in thread] 

List:       cmake
Subject:    Re: [CMake] Iterating over a generator expression list, specifically $<TARGET_OBJECTS:objlib> of an 
From:       Eric Noulard <eric.noulard () gmail ! com>
Date:       2018-08-29 13:48:45
Message-ID: CAPASGLrxW8jgEojBKrXX3EciD7r1fW2tQ_91QEr29Xv0UUqT8A () mail ! gmail ! com
[Download RAW message or body]

[Attachment #2 (multipart/alternative)]


Le mer. 29 août 2018 à 14:44, George PF <george.p.f@mail.com> a écrit :

>
> >
> > My opinion (but I may be proven wrong by others) is that genex contains
> > generator specific bits that cannot be **evaluated**
> > until the build system is generated.  Properties (on target, or
> directory,
> > or files) contains informations that is available as soon
> > as the corresponding CMakeLists.txt part defining the object has been
> > processed.
>
> That seems more like an internal cmake limitation. Though maybe on purpose
> so
> the scripts can not be tailored for just one backend.
>

I think this was a design choice thus the name "Generator" expression they
are evaluated at generation time
not configuration time and I don't think it's an internal cmake limitation,
I think (but I may be wrong) that this
"generation step" would happen for any generative build system.

And there is more than that about "when" you'll know some var values.
Some generators are supporting "multiple build configuration" like MSVC and
Xcode so that
the build output dir is "mangled" with a prefix **at build time** (since
you can switch configuration after you have generated your project files).
see e.g.
https://cmake.org/cmake/help/latest/variable/CMAKE_CFG_INTDIR.html

And the documentation says quite optimistically: "Generator expressions are
> allowed
> in the context of many target properties", a more restrictive phrasing -
> "only works
> with X / Y for reasons Z" would help there.


I agree this could be clearer.
Having a possibly exhaustive description of where genex may be used would
be nice.
May be it's worth a bug report with a proposal doc update?

Genex support is added in places where it is useful (and possible I guess):
https://gitlab.kitware.com/cmake/cmake/issues/15374
https://gitlab.kitware.com/cmake/cmake/issues/15785

And concerning having them "at configure time", there is open issue
about "configuration expression":
https://gitlab.kitware.com/cmake/cmake/issues/17962


-- 
Eric

[Attachment #5 (text/html)]

<div dir="ltr"><br><br><div class="gmail_quote"><div dir="ltr">Le  mer. 29 août 2018 \
à  14:44, George PF &lt;<a \
href="mailto:george.p.f@mail.com">george.p.f@mail.com</a>&gt; a écrit  \
:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px \
0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><br> &gt; <br>
&gt; My opinion (but I may be proven wrong by others) is that genex contains<br>
&gt; generator specific bits that cannot be **evaluated**<br>
&gt; until the build system is generated.   Properties (on target, or directory,<br>
&gt; or files) contains informations that is available as soon<br>
&gt; as the corresponding CMakeLists.txt part defining the object has been<br>
&gt; processed.<br>
<br>
That seems more like an internal cmake limitation. Though maybe on purpose so <br>
the scripts can not be tailored for just one \
backend.<br></blockquote><div><br></div><div>I think this was a design choice thus \
the name &quot;Generator&quot; expression they are evaluated at generation \
time</div><div>not configuration time and I don&#39;t think it&#39;s an internal \
cmake limitation, I think (but I may be wrong) that this</div><div>&quot;generation \
step&quot; would happen for any generative build system.</div><div><br></div><div>And \
there is more than that about &quot;when&quot; you&#39;ll know some var \
values.</div><div>Some generators are supporting &quot;multiple build \
configuration&quot; like MSVC and Xcode so that</div><div>the build output dir is \
&quot;mangled&quot; with a prefix **at build time** (since you can switch \
configuration after you have generated your project files).</div><div>see e.g.  \
</div><div><a href="https://cmake.org/cmake/help/latest/variable/CMAKE_CFG_INTDIR.html \
">https://cmake.org/cmake/help/latest/variable/CMAKE_CFG_INTDIR.html</a></div><div><br></div><blockquote \
class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid \
rgb(204,204,204);padding-left:1ex"> And the documentation says quite optimistically: \
&quot;Generator expressions are allowed <br> in the context of many target \
properties&quot;, a more restrictive phrasing - &quot;only works <br> with X / Y for \
reasons Z&quot; would help there.</blockquote><div><br></div><div>I agree this could \
be clearer.</div><div>Having a possibly exhaustive description of where genex may be \
used would be nice.</div><div>May be it&#39;s worth a bug report with a proposal doc \
update?<br></div><div><br></div><div>Genex support is added in places where it is \
useful (and possible I guess):</div><div><a \
href="https://gitlab.kitware.com/cmake/cmake/issues/15374">https://gitlab.kitware.com/cmake/cmake/issues/15374</a><br></div><div><a \
href="https://gitlab.kitware.com/cmake/cmake/issues/15785">https://gitlab.kitware.com/cmake/cmake/issues/15785</a><br></div><div><br></div><div><div>And \
concerning having them &quot;at configure time&quot;, there is open \
issue</div><div>about &quot;configuration expression&quot;:</div><div><a \
href="https://gitlab.kitware.com/cmake/cmake/issues/17962">https://gitlab.kitware.com/ \
cmake/cmake/issues/17962</a><br></div></div><div><br></div><div><br></div></div>-- \
<br><div dir="ltr" class="gmail_signature"><div dir="ltr"><div><div \
dir="ltr"><div>Eric<br></div></div></div></div></div></div>



-- 

Powered by www.kitware.com

Please keep messages on-topic and check the CMake FAQ at: \
http://www.cmake.org/Wiki/CMake_FAQ

Kitware offers various services to support the CMake community. For more information \
on each offering, please visit:

CMake Support: http://cmake.org/cmake/help/support.html
CMake Consulting: http://cmake.org/cmake/help/consulting.html
CMake Training Courses: http://cmake.org/cmake/help/training.html

Visit other Kitware open-source projects at \
http://www.kitware.com/opensource/opensource.html

Follow this link to subscribe/unsubscribe:
https://cmake.org/mailman/listinfo/cmake



[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic