Is it safe to add properties to custom target?

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

Is it safe to add properties to custom target?

Marcel Loose
Hi all,

In fact the subject title says it all. Is it safe to do, for example:

add_custom_target(myTarget)
set_target_properties(myTarget PROPERTIES
  LOCATION ${CMAKE_CURRENT_BINARY_DIR})

It seems to work fine, but I'm not sure this is the right way to do it.

Best regards,
Marcel Loose.


_______________________________________________
Powered by www.kitware.com

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

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

Follow this link to subscribe/unsubscribe:
http://www.cmake.org/mailman/listinfo/cmake
Reply | Threaded
Open this post in threaded view
|

Re: Is it safe to add properties to custom target?

Alexander Neundorf-3
On Wednesday 09 December 2009, Marcel Loose wrote:
> Hi all,
>
> In fact the subject title says it all. Is it safe to do, for example:
>
> add_custom_target(myTarget)
> set_target_properties(myTarget PROPERTIES
>   LOCATION ${CMAKE_CURRENT_BINARY_DIR})
>
> It seems to work fine, but I'm not sure this is the right way to do it.

What should this do ?
It is safe to add your own custom properties, so you can query them later. If
you want to force cmake to do something special by setting the LOCATION
property, I'm sure either this doesn't work or this works accidentially but
is not supported.

Alex
_______________________________________________
Powered by www.kitware.com

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

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

Follow this link to subscribe/unsubscribe:
http://www.cmake.org/mailman/listinfo/cmake
Reply | Threaded
Open this post in threaded view
|

Re: Is it safe to add properties to custom target?

Marcel Loose
In reply to this post by Marcel Loose
On Thu, 2009-12-10 at 22:24 +0100, Alexander Neundorf wrote:

> On Wednesday 09 December 2009, Marcel Loose wrote:
> > Hi all,
> >
> > In fact the subject title says it all. Is it safe to do, for example:
> >
> > add_custom_target(myTarget)
> > set_target_properties(myTarget PROPERTIES
> >   LOCATION ${CMAKE_CURRENT_BINARY_DIR})
> >
> > It seems to work fine, but I'm not sure this is the right way to do it.
>
> What should this do ?
> It is safe to add your own custom properties, so you can query them later. If
> you want to force cmake to do something special by setting the LOCATION
> property, I'm sure either this doesn't work or this works accidentially but
> is not supported.
>
> Alex

Hi Alex,

I was considering to set this property for custom targets in analogy
with the LOCATION and LOCATION_<CONFIG> properties that are set for
library and executable targets. I'm aware of the fact that I will need
to handle this property myself; that CMake won't know anything about it.
But I was concerned that it might clash with a future release of CMake,
if support for the LOCATION property for custom targets were added to
CMake.

Best regards,
Marcel Loose.


_______________________________________________
Powered by www.kitware.com

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

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

Follow this link to subscribe/unsubscribe:
http://www.cmake.org/mailman/listinfo/cmake
Reply | Threaded
Open this post in threaded view
|

Re: Is it safe to add properties to custom target?

David Cole
On Fri, Dec 11, 2009 at 3:55 AM, Marcel Loose <[hidden email]> wrote:
On Thu, 2009-12-10 at 22:24 +0100, Alexander Neundorf wrote:
> On Wednesday 09 December 2009, Marcel Loose wrote:
> > Hi all,
> >
> > In fact the subject title says it all. Is it safe to do, for example:
> >
> > add_custom_target(myTarget)
> > set_target_properties(myTarget PROPERTIES
> >   LOCATION ${CMAKE_CURRENT_BINARY_DIR})
> >
> > It seems to work fine, but I'm not sure this is the right way to do it.
>
> What should this do ?
> It is safe to add your own custom properties, so you can query them later. If
> you want to force cmake to do something special by setting the LOCATION
> property, I'm sure either this doesn't work or this works accidentially but
> is not supported.
>
> Alex

Hi Alex,

I was considering to set this property for custom targets in analogy
with the LOCATION and LOCATION_<CONFIG> properties that are set for
library and executable targets. I'm aware of the fact that I will need
to handle this property myself; that CMake won't know anything about it.
But I was concerned that it might clash with a future release of CMake,
if support for the LOCATION property for custom targets were added to
CMake.


It would be a good idea to use your own name for that property. Perhaps ${MY_PROJECT}_LOCATION or something similar... We don't really have a good policy/convention in place about property names and avoiding future clashes, but since you already know we do set LOCATION internally, using your own property name would avoid problems if it ever does make sense for us to add that property to custom targets.

HTH,
David


_______________________________________________
Powered by www.kitware.com

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

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

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