[CMake] Project name differs from exec name in VS

Bill Hoffman bill.hoffman at kitware.com
Thu Apr 16 19:51:13 EDT 2009


Michael Gerenrot wrote:
> Hello!
> 
>  
> 
> We use CMake to generate C++ projects for Visual Studio, and this works 
> fine. But now I need the compiled executable to be named different from 
> the project. I.e. project myFoo should generate not myFoo.exe, but 
> yourFoo.exe. In VS I would set the name in 
> Project\Properties\Configuration Properties\Linker\General\Output File, 
> but we need CMake to generate the project this way.
> 
>  

add_executable(yourFoo foo.c)

The name of the executable comes from the first argument to the 
add_executable command.  If for some reason that is not enough, you can 
uses the OUTPUT_NAME property on the executable to change that.

Documentation is here:

http://www.cmake.org/cmake/help/cmake2.6docs.html#command:add_executable
http://www.cmake.org/cmake/help/cmake2.6docs.html#prop_tgt:OUTPUT_NAME

-Bill



More information about the CMake mailing list