remove ThriftCppLibrary.cmake as getdeps provides it

Summary: ThriftCppLibrary.cmake is a duplicate of the getdeps/opensource copy of the file. To avoid issues with keeping them in sync, remove Eden's.

Reviewed By: simpkins

Differential Revision: D15750453

fbshipit-source-id: 7f95d01c4ed6ce3af86f0215ef16b88dc2c61027
This commit is contained in:
Chad Austin 2019-06-17 11:07:13 -07:00 committed by Facebook Github Bot
parent c19834d673
commit 8925b1dcb8

View File

@ -1,121 +0,0 @@
# Copyright (c) 2016-present, Facebook, Inc.
# All rights reserved.
#
# This source code is licensed under the BSD-style license found in the
# LICENSE file in the root directory of this source tree. An additional grant
# of patent rights can be found in the PATENTS file in the same directory.
function(add_thrift_cpp2_library LIB_NAME THRIFT_FILE)
# Parse the arguments
set(SERVICES)
set(DEPENDS)
set(GEN_ARGS)
set(mode "UNSET")
foreach(arg IN LISTS ARGN)
if("${arg}" STREQUAL "SERVICES")
set(mode "SERVICES")
elseif("${arg}" STREQUAL "DEPENDS")
set(mode "DEPENDS")
elseif("${arg}" STREQUAL "OPTIONS")
set(mode "OPTIONS")
else()
if("${mode}" STREQUAL "SERVICES")
list(APPEND SERVICES "${arg}")
elseif("${mode}" STREQUAL "DEPENDS")
list(APPEND DEPENDS "${arg}")
elseif("${mode}" STREQUAL "OPTIONS")
list(APPEND GEN_ARGS "${arg}")
else()
message(
FATAL_ERROR
"expected SERVICES, DEPENDS, or OPTIONS argument, found ${arg}"
)
endif()
endif()
endforeach()
get_filename_component(base ${THRIFT_FILE} NAME_WE)
get_filename_component(
output_dir
${CMAKE_CURRENT_BINARY_DIR}/${THRIFT_FILE}
DIRECTORY
)
list(APPEND GEN_ARGS "include_prefix=${output_dir}")
# CMake 3.12 is finally getting a list(JOIN) function, but until then
# treating the list as a string and replacing the semicolons is good enough.
string(REPLACE ";" "," GEN_ARG_STR "${GEN_ARGS}")
# Compute the list of generated files
list(APPEND generated_headers
${output_dir}/gen-cpp2/${base}_constants.h
${output_dir}/gen-cpp2/${base}_constants.cpp
${output_dir}/gen-cpp2/${base}_types.h
${output_dir}/gen-cpp2/${base}_types.tcc
${output_dir}/gen-cpp2/${base}_types_custom_protocol.h
)
list(APPEND generated_sources
${output_dir}/gen-cpp2/${base}_data.h
${output_dir}/gen-cpp2/${base}_data.cpp
${output_dir}/gen-cpp2/${base}_types.cpp
)
foreach(service IN LISTS SERVICES)
list(APPEND generated_headers
${output_dir}/gen-cpp2/${service}.h
${output_dir}/gen-cpp2/${service}.tcc
${output_dir}/gen-cpp2/${service}AsyncClient.h
${output_dir}/gen-cpp2/${service}_custom_protocol.h
)
list(APPEND generated_sources
${output_dir}/gen-cpp2/${service}.cpp
${output_dir}/gen-cpp2/${service}AsyncClient.cpp
${output_dir}/gen-cpp2/${service}_processmap_binary.cpp
${output_dir}/gen-cpp2/${service}_processmap_compact.cpp
)
endforeach()
# Emit the rule to run the thrift compiler
add_custom_command(
OUTPUT
${generated_headers}
${generated_sources}
COMMAND
${CMAKE_COMMAND} -E make_directory ${output_dir}
COMMAND
${FBTHRIFT_COMPILER}
--strict
--templates ${FBTHRIFT_TEMPLATES_DIR}
--gen "mstch_cpp2:${GEN_ARG_STR}"
-I ${CMAKE_SOURCE_DIR}
-o ${output_dir}
${CMAKE_CURRENT_SOURCE_DIR}/${THRIFT_FILE}
WORKING_DIRECTORY
${CMAKE_BINARY_DIR}
MAIN_DEPENDENCY
${THRIFT_FILE}
DEPENDS
${DEPENDS}
)
# Now emit the library rule to compile the sources
add_library(${LIB_NAME} STATIC
${generated_sources}
)
set_property(
TARGET ${LIB_NAME}
PROPERTY PUBLIC_HEADER
${generated_headers}
)
target_include_directories(
${LIB_NAME}
PUBLIC
${CMAKE_SOURCE_DIR}
${CMAKE_BINARY_DIR}
)
target_link_libraries(
${LIB_NAME}
PUBLIC
${DEPENDS}
FBThrift::thriftcpp2
)
endfunction()