[CMake] LOCATION/CMP0026/export/import

Robert Maynard robert.maynard at kitware.com
Wed Nov 7 17:28:49 EST 2018


Yes you can get if a target is imported by seeing if the IMPORTED
property is set to true. (
https://cmake.org/cmake/help/v3.12/prop_tgt/IMPORTED.html )
On Wed, Nov 7, 2018 at 5:24 PM Hendrik Greving
<hendrik.greving.smi at gmail.com> wrote:
>
> Ok, it seems to be IMPORT_LOCATION, not IMPORTED_LOCATION
> We have a (.cmake) file that shared among things that use it for build targets and external projects for imported targets. Is there a way to find out whether a target is imported or a build target?
>
>
> On Wed, Nov 7, 2018 at 2:19 PM Robert Maynard <robert.maynard at kitware.com> wrote:
>>
>> I am not seeing any cmake errors/warnings when I do so :)
>> On Wed, Nov 7, 2018 at 5:15 PM Hendrik Greving
>> <hendrik.greving.smi at gmail.com> wrote:
>> >
>> > Ok! Except (see above) I do not think one can actually read IMPORTED_LOCATION, can I?
>> > Thanks! - again!
>> >
>> > On Wed, Nov 7, 2018 at 2:07 PM Robert Maynard <robert.maynard at kitware.com> wrote:
>> >>
>> >> Looking at CMP0026 more, I believe should be able to read either the
>> >> IMPORTED_LOCATION or LOCATION for any import target without triggering
>> >> the policy, as the policy only pertains to 'build' targets and not
>> >> 'import' targets.
>> >> On Wed, Nov 7, 2018 at 4:51 PM Hendrik Greving
>> >> <hendrik.greving.smi at gmail.com> wrote:
>> >> >
>> >> > Is IMPORTED_LOCATION a property one can read? I was under the assumption that setting IMPORTED_LOCATION becomes LOCATION (for imported targets). And as such, reading this LOCATION generates the warning. I just tried and it indeed didn't let me read IMPORTED_LOCATION.
>> >> >
>> >> > On Wed, Nov 7, 2018 at 12:36 PM Robert Maynard <robert.maynard at kitware.com> wrote:
>> >> >>
>> >> >> I believe that IMPORTED_LOCATION is safe to use.
>> >> >> On Wed, Nov 7, 2018 at 3:27 PM Hendrik Greving
>> >> >> <hendrik.greving.smi at gmail.com> wrote:
>> >> >> >
>> >> >> > So IMPORTED_LOCATION is obsolete as well? (since reading LOCATION is obsolete)
>> >> >> >
>> >> >> > On Wed, Nov 7, 2018 at 11:39 AM Robert Maynard <robert.maynard at kitware.com> wrote:
>> >> >> >>
>> >> >> >> With generator expressions making the reading of  LOCATION non-viable
>> >> >> >> during configuration time ( since the actual location is now evaluated
>> >> >> >> at generate time ), the general solution is that you need to move your
>> >> >> >> LOCATION reading logic also to generate time. In general this means
>> >> >> >> using something like file(GENERATE ) to dump the location to disk.
>> >> >> >> On Wed, Nov 7, 2018 at 1:05 PM Hendrik Greving
>> >> >> >> <hendrik.greving.smi at gmail.com> wrote:
>> >> >> >> >
>> >> >> >> > Hello,
>> >> >> >> >
>> >> >> >> > w/ LOCATION property made obsolete, how can one read a target's LOCATION for imported targets? Previously, IMPORTED_LOCATION was conveyed for such targets, but reading the LOCATION property of imported targets leads to the same warning as for project targets?
>> >> >> >> >
>> >> >> >> > Thanks in advance
>> >> >> >> > --
>> >> >> >> >
>> >> >> >> > 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