Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Cmake to autogenerate thrift code

So the only decent example I've found for this is http://grokbase.com/t/thrift/user/1162hvgrdn/recommended-way-to-incorporate-thrift-to-the-build-system , however it seems to be quite buggy, for example the if statement is missing ${THRIFT_FILE} .

That said I'm getting caught up on execute prcoess command returning: "execute_process given uknown argument - "STUFF" where stuff is what looks tobe a proper thrift command.

Any suggestions and what's wrong here?

like image 206
yodafan86 Avatar asked Sep 27 '12 14:09

yodafan86


1 Answers

Better late then never. Use add_custom_command

add_custom_command(
OUTPUT
    ${GEN_FILES_PATH}/DebugProtoTest_types.cpp
    ${GEN_FILES_PATH}/DebugProtoTest_types.h
COMMAND
    $<TARGET_FILE:compiler> --gen cpp:dense ${TEST_PATH}/DebugProtoTest.thrift
DEPENDS
    compiler
WORKING_DIRECTORY
    ${CMAKE_BINARY_DIR}
)

I use it to generate test-related stuff for Apache thrift here

like image 75
Sergei Nikulov Avatar answered Oct 21 '22 05:10

Sergei Nikulov