Get the BINARY_DIR for a target?

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

Get the BINARY_DIR for a target?

braden
Are there any properties on a target that I can query to get whatever
was the CMAKE_CURRENT_BINARY_DIR when the target was defined?

I'm aware of the LOCATION property; however, its generator-specific
nature makes teasing the non-generator-specific part out of it rather
challenging (without some other information about the target
definition's location in the source tree, which is specifically what I'm
trying to avoid).  FWIW, I'm writing a function that takes a list of
targets as input.

--
Braden McDaniel <[hidden email]>

--

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:
http://public.kitware.com/mailman/listinfo/cmake
--
Braden McDaniel <braden@endoframe.com>
Reply | Threaded
Open this post in threaded view
|

Re: Get the BINARY_DIR for a target?

braden
On Tue, 2015-01-06 at 12:34 -0500, Braden McDaniel wrote:
> Are there any properties on a target that I can query to get whatever
> was the CMAKE_CURRENT_BINARY_DIR when the target was defined?
>
> I'm aware of the LOCATION property; however, its generator-specific
> nature makes teasing the non-generator-specific part out of it rather
> challenging (without some other information about the target
> definition's location in the source tree, which is specifically what I'm
> trying to avoid).  FWIW, I'm writing a function that takes a list of
> targets as input.

It looks like I can add my own arbitrary property for this.  So, my
current solution is to wrap add_library with my own function that calls
add_library and then sets MY_SPECIAL_PROPERTY on the target to the
current value of CMAKE_CURRENT_BINARY_DIR.

Later, I get the value of MY_SPECIAL_PROPERTY inside the function I
described in my previous message.

If someone knows of a better way, do tell.

--
Braden McDaniel <[hidden email]>

--

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:
http://public.kitware.com/mailman/listinfo/cmake
--
Braden McDaniel <braden@endoframe.com>