catkin export cmake definitions/variables to depending packages
Is there a way to set cmake variables in one package and export them to all depending packages?
For clarity:
If I set a cmake variable in one packages CMakeLists.txt like:
set( My_Var "Hello World" )
I can it now has the value in this package, I can e. g. echo it like
message( "My_Var = ${My_Var}" )
which will result in the output:
My_Var = Hello World
However, if I put the same output in another package (which depends on the previous one), the result is empty:
message( "My_Var = ${My_Var}" )
Resulting output:
My_Var =
Apparently, both packages have separate cmake namespaces. Now Is there a way to set a variable in one package, the mark it in some kind of way to be exported into depending packages and access its value in the depending packages?