[CMake] How to get target binary name?

Robert Dailey rcdailey.lists at gmail.com
Wed Jun 20 14:33:00 EDT 2012


If I were to try to do this *after* calling add_executable() or
add_library(), would it be easier to obtain?

On Wed, Jun 20, 2012 at 12:54 PM, Thompson, K T <kgt at lanl.gov> wrote:

>  Robert,****
>
> ** **
>
> I’m not sure this is exactly what you are looking for, but you may be able
> to use “generator expressions.”  See the documentation for
> add_custom_command for more details, but basically you can use the
> expression $<TARGET_FILE:foo> to retrieve the executable name generated by
> target ‘foo’.  I think this only works after you use add_executable( foo
> ${src} ).****
>
> ** **
>
> -kt****
>
> ** **
>
> ** **
>
> ** **
>
> *From:* cmake-bounces at cmake.org [mailto:cmake-bounces at cmake.org] *On
> Behalf Of *Robert Dailey
> *Sent:* Wednesday, June 20, 2012 11:41 AM
> *To:* CMake ML
> *Subject:* Re: [CMake] How to get target binary name?****
>
> ** **
>
> Another note: This has to work the same for both release and debug, and
> for both visual studio and makefile generators.****
>
> On Wed, Jun 20, 2012 at 12:40 PM, Robert Dailey <rcdailey.lists at gmail.com>
> wrote:****
>
> I'm looking for the quickest and most natural way to get the final binary
> name of a target, ideally before add_executable() or add_library() is
> called (not sure if this is possible).****
>
> ** **
>
> For example, if my executable target's output is fubar.exe, I want to get
> "fubar.exe" in a variable.****
>
> ** **
>
> Any examples? Thanks.****
>
> ** **
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.cmake.org/pipermail/cmake/attachments/20120620/7909edcf/attachment.htm>


More information about the CMake mailing list