[CMake] Build Library from Thrift generated files

Eric Noulard eric.noulard at gmail.com
Thu Sep 5 02:23:49 EDT 2013


2013/9/4 Pascal Bach <pasci.bach at gmail.com>:
> Hello Eric
>
>>
>> Unknown source file name is just painful.
>>
>> Can't the thrift generator tell you the name of the files he will generate?
>> Something like:
>> thrift --generated-file-list Service.thrift
>>
>> or may be you can teach him the name of the flie you want?
>
> Currently there is no way toget just a list of the generated output
> file. One idea that I had was to just run the
> process once to get a list of the generated output files and then
> throw the files away. If I wrap this in a function
> it would be similar to the generated-file-list. But it seems like a waste to me.
>
> Because the output of the generator is dependent on the content of the
> file it is not possible to specify an output file, only an output
> directory.

How wouldn't the output depend on the content of the input :-]... just kidding.

The "not predictable output"  is is a biased point of view :-)

Even if thrift needs to generate several classes, functions whatever
nothing prevent the tool of putting that in 2 (possibly) big files, like:

Services.thrift
-->
Services.hh
Services.cpp

I do use a (home made) source generator which does just that.
Generating 1 file per class is a convention not an obligation.
At least in C, C++ and Python.

Moroever in the end you build a library which contains all the generated code
so what the point of having dozens of files?



-- 
Erk
L'élection n'est pas la démocratie -- http://www.le-message.org


More information about the CMake mailing list