[CMake] Generator expressions: Identifying when they're used in a custom command?

Elvis Stansvik elvis.stansvik at orexplore.com
Mon Feb 19 15:45:11 EST 2018


2018-02-19 21:03 GMT+01:00 Sam Edwards <cfsworks at gmail.com>:
> Alan,
>
> I'm kicking myself for leaving off the DEPENDS in add_custom_target as that
> is the most essential part of what you suggested. Bah!
>
> I tried copying in your changes verbatim and I'm still left with an output
> that produces IS_INTERROGATE=0. This is on both 3.9.6 (my development
> machine) and 2.8.12 (my testing VM). Does your version of CMake produce
> IS_INTERROGATE=1 with your changes?
>
> The rationale behind 2.8.12 is this is the version that ships with Ubuntu
> Trusty and will probably be what's present if a user is simply told to
> "install CMake" - although 3.5.1 is also available on that platform under
> the cmake3 package, so I might be able to justify a minimum version of
> either that or 3.0.1 (which is what's on backports-less Debian Jessie). I'd
> have to bring it up with the project maintainer to see, but in any case
> we're trying to follow a "stick with the same minimum version until we
> encounter a bug we can't work around, then bump the minimum to the version
> that fixes that bug" approach.
>
> Thanks for your suggestions,

Hm, I'm not sure I'm enough of a CMake ninja to understand this, but,
when I read in the docs:

$<TARGET_PROPERTY:prop>
    Value of the property prop on the target on which the generator
expression is evaluated.

And then see:

set_target_properties(base_target PROPERTIES
  IS_INTERROGATE 0
  INTERFACE_INCLUDE_DIRECTORIES
"IS_INTERROGATE=$<BOOL:$<TARGET_PROPERTY:IS_INTERROGATE>>")

Correct me if I'm wrong, but I think that
$<TARGET_PROPERTY:IS_INTERROGATE> here will always be the value of
IS_INTERROGATE on the base_target (so 0), since that's the target on
which the generator expression is evaluated? Or?

I think that's where the 0 in your output comes from in the end?

Elvis

> Sam
>
> --
>
> 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
>


More information about the CMake mailing list