[CMake] Renaming output of EXECUTABLE

Reggie Burnett reggie at bytefx.com
Thu Dec 1 10:02:36 EST 2005


Gregor

Thanks for the reply.  I was thinking of this approach as well but wasn't
sure how to implement.  I'll use your suggestion for now.  I'm still
wondering about dynamic source lists.

If I have a build of a project that has 10 sources however, based on some
configuration option, there needs to be a couple of additional files also
included can I do this?  Is there a way to add these source files to the
target based on a define?

Reggie

> -----Original Message-----
> From: Gregor Berginc [mailto:gregor.berginc at gmail.com]
> Sent: Thursday, December 01, 2005 6:37 AM
> To: Reggie Burnett
> Cc: cmake at cmake.org
> Subject: Re: [CMake] Renaming output of EXECUTABLE
> 
> Dear Reggie,
> 
> > Our project has several binaries some of which have different names
> based on
> > project settings.
> >
> > <basename>-debug, <basename>-pro, for example.  Since I want to use the
> same
> > source file list how would I go about renaming the output?
> 
> Don't know if I understand you correctly, but this is how I use
> different build configurations (release, debug). My directory
> structure is as follows:
> 
> VisualCortex/
>     .debug
>     .release
>     src
>     ...
> 
> In the src/CMakelists.txt, I have the following custom command:
> 
> ADD_CUSTOM_COMMAND(
> 		TARGET VisualCortex
> 		POST_BUILD
> 		COMMAND ${CMAKE_COMMAND}
> 		ARGS -E copy ${TARGET_DIR}/VisualCortex ${CMAKE_SOURCE_DIR})
> 
> Here, VisualCortex is the name of the target built by the cmake. The
> result of this command is that the target from
> VisualCortex/<current_build_type>/src is copied to VisualCortex/.
> 
> If you wish to rename the target, you might first use the copy and
> then the remove command, i.e., put one more command in the
> CMakelists.txt and replace the "copy" with "remove" cmake command:
> 
> ADD_CUSTOM_COMMAND(
> 		TARGET VisualCortex
> 		POST_BUILD
> 		COMMAND ${CMAKE_COMMAND}
> 		ARGS -E remove ${TARGET_DIR}/VisualCortex)
> 
> Just make sure, you put them in the right order ;)
> 
> Best,
> Gregor
> --
> Gregor Berginc, Ph.D. Student
> University of Ljubljana, Faculty of CIS
> Trzaska 25, SI-1001 Ljubljana, Slovenia
> tel: +386 1 4776630, fax: +386 1 4264647
> www: http://vicos.fri.uni-lj.si/gregor




More information about the CMake mailing list