[CMake] How to read and compile dynamically-generated list of cpp files

J Decker d3ck0r at gmail.com
Mon Feb 3 12:29:31 EST 2014


generate a cmake script and include said script?
use FILE() command and open the file to read it?

On Mon, Feb 3, 2014 at 8:44 AM, gimmeamilk gimmeamilk
<gimmeamilkbttf at googlemail.com> wrote:
> Hi all,
>
> I have a custom tool that processes a given list of IDL files and
> produces a number of .cpp and .h files as output. I want to add those
> files to the list of things to compile in my CMakeLists, and also
> model the dependencies those files have on the IDL. To keep things
> simple, I will state that any change to any of the IDL files should
> trigger a regeneration of all cpp/h.
>
> I have a custom command that takes care of running the generator tool
> and listing all the IDL files as dependencies.
>
> My issue is getting the subsequent list of cpp/h files into cmake at
> build-time. It is not possible to infer from the name of the IDL files
> what cpp files will be generated. My generator tool will, however,
> output the list of generated files to a text file.
>
> So my question is: how do I instruct cmake to "read from this text
> file and add the contents as extra source and header files to be
> compiled", also bearing in mind that the said text file only exists
> during a certain point of the build?
>
> Many thanks
> --
>
> 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://www.cmake.org/mailman/listinfo/cmake


More information about the CMake mailing list