Skip to content
This repository has been archived by the owner on Jun 23, 2022. It is now read-only.

Commit

Permalink
fix cmake
Browse files Browse the repository at this point in the history
  • Loading branch information
neverchanje committed Feb 14, 2021
1 parent 94251dc commit c19bbbd
Showing 1 changed file with 10 additions and 5 deletions.
15 changes: 10 additions & 5 deletions bin/thrift_utils.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -37,11 +37,14 @@ include_directories(${THRIFT_GENERATED_FILE_PATH})
#
# Example:
#
# include(thrift_utils)
# thrift_generate_cpp(RPC_META_THRIFT_SRCS RPC_META_THRIFT_HDRS rpc_meta.thrift)
# thrift_generate_cpp(
# REQUEST_META_THRIFT_SRCS
# REQUEST_META_THRIFT_HDRS
# ${CMAKE_CURRENT_SOURCE_DIR}/request_meta.thrift
# )
# add_library(
# dsn_rpc
# ${RPC_META_THRIFT_SRCS}
# ${REQUEST_META_THRIFT_SRCS}
# ...
# )
function(THRIFT_GENERATE_CPP SRCS HDRS thrift_file)
Expand All @@ -60,10 +63,12 @@ function(THRIFT_GENERATE_CPP SRCS HDRS thrift_file)
message(FATAL_ERROR "thrift-compiler exits with " ${THRIFT_RETURN} ": " ${__thrift_OUT})
endif()

get_filename_component(__thrift_name ${thrift_file} NAME_WE)

set(${SRCS})
set(${HDRS})
file(GLOB_RECURSE __result_src "${CMAKE_BINARY_DIR}/${_target_dir}/*.cpp")
file(GLOB_RECURSE __result_hdr "${CMAKE_BINARY_DIR}/${_target_dir}/*.h")
file(GLOB_RECURSE __result_src "${THRIFT_GENERATED_FILE_PATH}/${__thrift_name}*.cpp")
file(GLOB_RECURSE __result_hdr "${THRIFT_GENERATED_FILE_PATH}/${__thrift_name}*.h")
list(APPEND ${SRCS} ${__result_src})
list(APPEND ${HDRS} ${__result_hdr})
# Sets the variables in global scope.
Expand Down

0 comments on commit c19bbbd

Please sign in to comment.