[CMake] custom build

Lev leventelist at gmail.com
Fri Jul 29 09:50:53 EDT 2016


On Fri, 29 Jul 2016 08:50:13 -0400
Guillaume Dumont <dumont.guillaume at gmail.com> wrote:

> add_custom_command(OUTPUT foo.sqlite
>                                                 MAIN_DEPENDENCY
> foo.sql COMMAND "cat foo.sql |
> sqlite3 -batch foo.sqlite")
> 
> add_custom_target(foo_sqlite
>                             DEPENDS foo.sqlite)

Thanks, that helps.

It works somehow. Minor issue, that the double quotes is not necessary.

However, the target builds only if I explicitly say 'make foo_sqlite'. So far
so good. Is there any way I can make it build if I just say 'make'?

And, there are more then one sqlite database to build, how can I make the
rule to be generic? Can I say *.sql, *.sqlite?

Thanks,
Levente

-- 
73 de HA5OGL
Op.: Levente


More information about the CMake mailing list