[CMake] Understanding SET- and GET_TARGET_PROPERTY

Brad King brad.king at kitware.com
Tue Jun 13 07:55:16 EDT 2006


wedekind wrote:
> Hello all,
> 
> I am using CMake 2.2.3 and have a question about SET_TARGET_PROPERTIES and
> GET_TARGET_PROPERTY.
> 
> If I am setting a target-specific property like this
> 
> SET_TARGET_PROPERTIES(myproject1 PROPERTIES myprop1 myvalue1)
> 
> I would like to read this property from another target myproject2 like this
> 
> GET_TARGET_PROPERTY(PROPVAR1 myproject1 myprop1)
> 
> Unfortunately this does not work like I have expected it. Can setting and
> getting target properties be used this way? Can I expect to have a target
> property be set for a target myproject1 if I want to read it during
> processing of an arbitrary target myproject2?

This should work in CMake 2.4 as long as both projects are under the 
same top-level source directory and that the property is set before it 
is read.

-Brad


More information about the CMake mailing list