[CMake] multiple executables

Alan W. Irwin irwin at beluga.phys.uvic.ca
Sun Jun 1 18:42:18 EDT 2008


On 2008-06-01 23:17+0200 PCJohn wrote:

>> [...] if you instead set the OUTPUT_NAME property of the target
>> using set_target_properties, I believe you will get the result
>> you want.
>
> I guess, that would be the option if I would need just one
> executable. But I need ten executables - each one of different name.

How about invoking add_executable ten different times with the same source
code but different target names and different OUTPUT_NAME's?  Sure, that is
inefficient, but sometimes you have to make compromises to get stuff to work
with CMake, and you may not even notice the 9 extra compilation and link times.

> Simlinks, etc. are not an option because this is used on Windows only.

Actually, that might be a better idea if you don't like the above
inefficieny.  I have no windows experience, but there is a cmake -E
create_symlink subcommand which I presume emulates symlinks on windows
(using copy or whatever).  So all you would have to do is to create 10
different custom targets using

COMMAND ${CMAKE_COMMAND} -E create_symlink old new

then run install (TARGET ...) for each of those targets.

There might also be some possibilities with the install(SCRIPT ...) or
install(CODE ...) signatures of the cmake install command.

Anyhow, I am just trying to give you some ideas here, and you will have to
experiment a little to see what is right for your needs.

Alan
__________________________
Alan W. Irwin

Astronomical research affiliation with Department of Physics and Astronomy,
University of Victoria (astrowww.phys.uvic.ca).

Programming affiliations with the FreeEOS equation-of-state implementation
for stellar interiors (freeeos.sf.net); PLplot scientific plotting software
package (plplot.org); the libLASi project (unifont.org/lasi); the Loads of
Linux Links project (loll.sf.net); and the Linux Brochure Project
(lbproject.sf.net).
__________________________

Linux-powered Science
__________________________


More information about the CMake mailing list