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 0690165 commit 013412b
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 8 deletions.
7 changes: 5 additions & 2 deletions bin/thrift_utils.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,11 @@ find_program(THRIFT_COMPILER
bin
)

set(THRIFT_GENERATED_FILE_PATH ${CMAKE_BINARY_DIR}/thrift-gen)
set(THRIFT_GENERATED_FILE_PATH ${CMAKE_BINARY_DIR}/thrift-gen CACHE INTERNAL "Where the thrift generated sources locate")
if(NOT EXISTS ${THRIFT_GENERATED_FILE_PATH})
file(MAKE_DIRECTORY ${THRIFT_GENERATED_FILE_PATH})
endif()
message(STATUS "THRIFT_GENERATED_FILE_PATH=${THRIFT_GENERATED_FILE_PATH}")
include_directories(${THRIFT_GENERATED_FILE_PATH})

# THRIFT_GENERATE_CPP is used to generate sources using the thrift compiler.
Expand All @@ -51,10 +52,11 @@ function(THRIFT_GENERATE_CPP SRCS HDRS thrift_file)
message(STATUS "THRIFT_GENERATE_CPP: ${thrift_file}")

exec_program(${THRIFT_COMPILER}
ARGS --out "${THRIFT_GENERATED_FILE_PATH}" --gen cpp ${thrift_file}
ARGS --out ${THRIFT_GENERATED_FILE_PATH} --gen cpp ${thrift_file}
OUTPUT_VARIABLE __thrift_OUT
RETURN_VALUE THRIFT_RETURN)
if(NOT ${THRIFT_RETURN} EQUAL "0")
message(STATUS "COMMAND: ${THRIFT_COMPILER} --out ${THRIFT_GENERATED_FILE_PATH} --gen cpp ${thrift_file}")
message(FATAL_ERROR "thrift-compiler exits with " ${THRIFT_RETURN} ": " ${__thrift_OUT})
endif()

Expand All @@ -64,6 +66,7 @@ function(THRIFT_GENERATE_CPP SRCS HDRS thrift_file)
file(GLOB_RECURSE __result_hdr "${CMAKE_BINARY_DIR}/${_target_dir}/*.h")
list(APPEND ${SRCS} ${__result_src})
list(APPEND ${HDRS} ${__result_hdr})
# Sets the variables in global scope.
set(${SRCS} ${${SRCS}} PARENT_SCOPE)
set(${HDRS} ${${HDRS}} PARENT_SCOPE)
endfunction()
6 changes: 0 additions & 6 deletions src/nfs/nfs.thrift
Original file line number Diff line number Diff line change
Expand Up @@ -37,9 +37,3 @@ struct get_file_size_response
2: list<string> file_list;
3: list<i64> size_list;
}

service nfs
{
copy_response copy(1: copy_request request);
get_file_size_response get_file_size(1: get_file_size_request request);
}

0 comments on commit 013412b

Please sign in to comment.