[CMake] custom build

Guillaume Dumont dumont.guillaume at gmail.com
Fri Jul 29 08:50:13 EDT 2016


As per CMake documentation your custom target should depend on the output
of the custom command. So it should look more like this:

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)

HTH

Guillaume

On Fri, Jul 29, 2016 at 6:45 AM, Lev <leventelist at gmail.com> wrote:

> Dear cmake users,
>
>
> Could you please help me how to make cmake to produce a generic build
> system?
>
> What I want to do is running simple shell command on files. Namely, I want
> to
> generate sqlite database from a sql file. It all works from the command
> line,
> I just can't figure out how to make cmake to do the right thing.
>
> I started to do something like this:
>
> add_custom_target(foo.sqlite foo.sql)
>
> add_custom_command(OUTPUT foo.sqlite
>                                                 MAIN_DEPENDENCY foo.sql
>                                                 COMMAND "cat foo.sql |
> sqlite3 -batch foo.sqlite")
>
> but it doesn't do anything when I issue "make".
>
> Any help appreciated.
>
> Levente
>
> --
> 73 de HA5OGL
> Op.: Levente
> --
>
> Powered by www.kitware.com
>
> Please keep messages on-topic and check the CMake FAQ at:
> http://www.cmake.org/Wiki/CMake_FAQ
>
> Kitware offers various services to support the CMake community. For more
> information on each offering, please visit:
>
> CMake Support: http://cmake.org/cmake/help/support.html
> CMake Consulting: http://cmake.org/cmake/help/consulting.html
> CMake Training Courses: http://cmake.org/cmake/help/training.html
>
> Visit other Kitware open-source projects at
> http://www.kitware.com/opensource/opensource.html
>
> Follow this link to subscribe/unsubscribe:
> http://public.kitware.com/mailman/listinfo/cmake
>



-- 
Guillaume Dumont
=========================
dumont.guillaume at gmail.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/cmake/attachments/20160729/9e129762/attachment.html>


More information about the CMake mailing list