[CMake] add_executable created file name

Michael Wild themiwi at gmail.com
Tue Dec 28 09:23:30 EST 2010


On 12/28/2010 02:39 PM, Mika.Rajala at patria.fi wrote:
> 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

This has been addressed in
http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=f0cdb600, but that
hasn't made it into any official release yet. Until then, you can use
the CMAKE_CFG_INTDIR variable (refer to the docs for the details).

Michael


More information about the CMake mailing list