[CMake] build executable with custom command?

Mathieu Malaterre mathieu.malaterre at gmail.com
Mon Jun 11 12:44:37 EDT 2007


On 6/11/07, Jens.M.Hoffmann at bahn.de <Jens.M.Hoffmann at bahn.de> wrote:
>
>
>
>
> Hi,
> is there a way to create a executable target with a custom command?
> I need this to build Tuxedo clients and servers.
>
> The command would be something like
>
> buildserver -o myexe -f myexe.o
>

Yup. Should work out of the box.

  ADD_CUSTOM_COMMAND(
    OUTPUT    /full/path/to/myexe
    COMMAND   buildserver
    ARGS      -o myexe -f myexe.o
    DEPENDS   /full/path/to/myexe.o
    COMMENT   "Generating exe"
  )


The only issue with that those target are marked UTILITIES (read only
property) and thus you have to use INSTALL(PROGRAMS to be able to
install them

HTH
-Mathieu


More information about the CMake mailing list