[CMake] Running custom executable

Daniel Dilts diltsman at gmail.com
Tue Apr 7 16:22:30 EDT 2015


>
> > > I have a custom executable that does some codegen to produce an
>> > > enumeration and a couple of tables.  I need this to be run against
>> each
>> > > source file before actual compilation.  It needs include directories
>> and
>> > > macro definitions from the build system.
>> > >
>> > > Is there a way to do this with a CMake build system?
>> add_custom_command
>> > > seems like it might work, but I need all runs of the custom
>> executable to
>> > > run before compilation begins.
>> >
>> > execute_process() might be what you want:
>> > http://www.cmake.org/cmake/help/v3.2/command/execute_process.html
>>
>>
>> Hmmm, probably add_custom_command() or add_custom_target() is what he
>> wants.
>> Why does it have to run before the compilation begins ?
>>
>
The program will run once per source file, scan them, and generate a header
file that is necessary for compilation to succeed.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/cmake/attachments/20150407/76add4fd/attachment.html>


More information about the CMake mailing list