[CMake] IF(TARGET var) fails on cmake 2.6.0
Marcel Loose
loose at astron.nl
Thu Jul 8 03:43:37 EDT 2010
On Wed, 2010-07-07 at 16:49 -0400, Brad King wrote:
> On 7/7/2010 7:45 AM, Marcel Loose wrote:
> > My pragmatic question is: is there a different way to check whether
a
> > target has already been defined, or not.
>
> Try this:
>
> get_target_property(mytarget_exists mytarget TYPE)
> if(mytarget_exists)
> message("YES")
> else()
> message("NO")
> endif()
>
> The if(TARGET) mode was added in 2.6.2 to make the
> test more readable.
>
> -Brad
Thanks Brad,
That works like a charm.
Regards,
Marcel Loose.
More information about the CMake
mailing list