facebook / fbthrift

Facebook's branch of Apache Thrift, including a new C++ server.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

ThriftLibrary.cmake is invalid

CJCombrink opened this issue · comments

commented

I can't get the ThriftLibrary.cmake to work as expected.

I have set the following:

find_program(THRIFT1    NAMES thrift1    HINTS /opt/fbthrift/fbthrift/bin)
find_library(THRIFTCPP2 NAMES thriftcpp2 HINTS /opt/fbthrift/fbthrift/lib)
message(WARNING "THRIFT1   : ${THRIFT1}")
message(WARNING "THRIFTCPP2: ${THRIFTCPP2}")

And it produces

CMake Warning at CMakeLists.txt:23 (message):
  THRIFT1 : /opt/fbthrift/fbthrift/bin/thrift1
CMake Warning at CMakeLists.txt:24 (message):
  THRIFTCPP2: /opt/fbthrift/fbthrift/lib/libthriftcpp2.a

Calling thrift_library(...) with generator cpp2 does not have any affect and no files are generated.
From searching I found I must specify the generator as mstch_cpp2 then files are generated, but the library are not building with the following error

c++: error: /my/path/build_fbthrift/common/gen-mstch_cpp2/all_includes_constants.cpp: No such file or directory

On further inspection I see that the generated folder on disk is correctly called gen-cpp2 and not (gen-mstch_cpp2 as expected by ThriftLibrary.cmake):

$ ls common/
gen-cpp2
commented

@thedavekwon

I went back to double check. I see my original post was incorrect.
When using cpp2 it works as expected, I was starting out with cpp as commented in the CMake file

@language  - The generator to use (cpp, cpp2 or py3)

Then during the struggles I switched to mstch_cpp2 as the language which broke things.
Using cpp2 is correct.

thrift1 does not seem to support a cpp generator.

glad you figured it out! Good catch! Closing the issue.