Have you tried using something like this yet? if you need an example with make 
let me know

Jake
 

SET( THRIFT_FILE "something.thrift" )
SET( THRIFT_OUTDIR ${CMAKE_CURRENT_LIST_DIR})
SET(THRIFT_FLAGS "-r --gen-cpp:pure_enums -o ${CMAKE_CURRENT_LIST_DIR}")

FIND_PROGRAM(THIRFT_BIN thrift /bin /usr/bin /usr/local/bin)
IF (THIRFT_BIN)
  SET( THRIFT_COMMAND "${THIRFT_BIN} ${THRIFT_FLAGS} ${THRIFT_FILE}")
  IF(EXISTS THRIFT_FILE)
    MESSAGE("Generating ${THRIFT_COMMAND}")
    execute_process(THRIFT_COMMAND . RESULT_VARIABLE result)
    MESSAGE("Result: ${result}")
    SET_DIRECTORY_PROPERTIES(${CMAKE_CURRENT_LIST_DIR} 
ADDITIONAL_MAKE_CLEAN_FILES ${THRIFT_OUTDIR}) 
  ENDIF(EXISTS THRIFT_FILE)
ELSE(THIRFT_BIN)
    MESSAGE(SEND_ERROR "Cannot find thrift in your path.")
ENDIF(THIRFT_BIN)





On Jun 2, 2011, at 1:27 PM, jeeyoung kim wrote:

> Hey guys.
> 
> I was wondering what is the recommended way to incorporate thrift into to
> the build system. Right now, for the build system @ work, we just compile
> the *.thrift file, and commit them in the source repository. This works, but
> it doesn't feel very comfortable committing automatically generated files.
> 
> For other builds @ work, we're using CMake to compile the c++ project. Any
> solution that uses make / cmake / some other build system would be
> appreciated. thanks.
> 
> -Jee

Reply via email to