add shared library support to add_fbthrift_cpp_library

Summary:
`add_fbthrift_cpp_library` should honor `BUILD_SHARED_LIBS`, and call
`add_library` with the right setting (`SHARED` if enabled, `STATIC` otherwise)

Reviewed By: yns88

Differential Revision: D24911124

fbshipit-source-id: 79df7640a758a592a3df3e9e79bb129dd57f2d47
This commit is contained in:
Michel Salim 2020-11-12 10:55:11 -08:00 committed by Facebook GitHub Bot
parent 375b1b1cf0
commit a00ee9ffee

View File

@ -127,8 +127,14 @@ function(add_fbthrift_cpp_library LIB_NAME THRIFT_FILE)
)
# Now emit the library rule to compile the sources
if (BUILD_SHARED_LIBS)
set(LIB_TYPE SHARED)
else ()
set(LIB_TYPE STATIC)
endif ()
add_library(
"${LIB_NAME}" STATIC
"${LIB_NAME}" ${LIB_TYPE}
${generated_sources}
)