Hi,

I'm porting build configuration based on GNU Autotools to CMake
and I have to deal with C preprocessing to generate a file.

The input for preprocessor is SQL file with C preprocessor directives
used, like #include "another.sql", etc.

Currently, Makefile uses the following rule to generate plain SQL file
as output:

myfile.sql: myfile.sql.in.c
    cpp -I../common $< | grep -v '^#' > $@

So, the myfile.sql is meant to be one of products of the build process,
similar to share libraries or executables.

What CMake tools should I use to achieve the same effect?

It's unclear to me if I should use add_custom_command,
add_custom_target or combine both.

Obviously, I'm looking for a portable solution that would work at least
with GNU GCC and Visual Studio toolsets. I presume I will have to define
platform-specific custom commands, one for cpp preprocessor, one for cl.exe.
Or, does CMake provide some kind of abstraction for C-preprocessing?

I scanned the archives, but I only found preprocessing of fortran files
or solutions based on make capabilities (make myfile.i).
So, it's not quite what I'm looking for.

Could anyone help me with this?

Best regards,
-- 
Mateusz Loskot, http://mateusz.loskot.net
--

Powered by www.kitware.com

Visit other Kitware open-source projects at 
http://www.kitware.com/opensource/opensource.html

Please keep messages on-topic and check the CMake FAQ at: 
http://www.cmake.org/Wiki/CMake_FAQ

Follow this link to subscribe/unsubscribe:
http://www.cmake.org/mailman/listinfo/cmake

Reply via email to