[CMake] add_executable created file name

Mika.Rajala at patria.fi Mika.Rajala at patria.fi
Tue Dec 28 08:39:22 EST 2010


Hello

I'd need to get the filepath of a created executable file, so that i can 
use the filepath on a custom command.

add_executable(Program ...)

add_custom_command(TARGET Program POST_BUILD COMMAND ${ProgramToRun} 
${Program} ...)

To clarify, i'd like to run the executable "ProgramToRun" with a command 
line argument that is a path to the executable created by add_executable.

the problem i'm facing is that with visual studio, the path is something 
like

<some_path>/build/Program/debug/Program.exe

or with release

<some_path>/build/Program/release/Program.exe

I have tried messing around with some variables such as:
- RUNTIME_OUTPUT_DIRECTORY
- BUILD_TYPE
Possibly others i can't remember, and undo wont show on my editor for some 
odd reason.

I think there has to be a way, since how would 

INSTALL(TARGETS Program)

know what files to copy.

i'd like to get my hands on that very information.

-mika
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.cmake.org/pipermail/cmake/attachments/20101228/848f56e7/attachment.htm>


More information about the CMake mailing list