Commit a35a5f9a authored by Adam Simpkins's avatar Adam Simpkins Committed by Facebook Github Bot

fbcode_builder: minor style cleanup in ThriftCppLibrary.cmake

Summary:
Add explicit double quotes around arguments that are intended to be exactly a
single parameter.  Also line wrap to 80 characters.

Reviewed By: wez

Differential Revision: D16738443

fbshipit-source-id: b8c9b6d50da72b44e23eaf5effbc384b6cbbc1c0
parent abc21143
...@@ -17,7 +17,11 @@ function(add_thrift_cpp2_library LIB_NAME THRIFT_FILE) ...@@ -17,7 +17,11 @@ function(add_thrift_cpp2_library LIB_NAME THRIFT_FILE)
) )
# Generate relative paths in #includes # Generate relative paths in #includes
file(RELATIVE_PATH include_prefix ${CMAKE_SOURCE_DIR} ${CMAKE_CURRENT_SOURCE_DIR}/${THRIFT_FILE}) file(
RELATIVE_PATH include_prefix
"${CMAKE_SOURCE_DIR}"
"${CMAKE_CURRENT_SOURCE_DIR}/${THRIFT_FILE}"
)
get_filename_component(include_prefix ${include_prefix} DIRECTORY) get_filename_component(include_prefix ${include_prefix} DIRECTORY)
if (NOT "${include_prefix}" STREQUAL "") if (NOT "${include_prefix}" STREQUAL "")
...@@ -29,33 +33,33 @@ function(add_thrift_cpp2_library LIB_NAME THRIFT_FILE) ...@@ -29,33 +33,33 @@ function(add_thrift_cpp2_library LIB_NAME THRIFT_FILE)
# Compute the list of generated files # Compute the list of generated files
list(APPEND generated_headers list(APPEND generated_headers
${output_dir}/gen-cpp2/${base}_constants.h "${output_dir}/gen-cpp2/${base}_constants.h"
${output_dir}/gen-cpp2/${base}_constants.cpp "${output_dir}/gen-cpp2/${base}_constants.cpp"
${output_dir}/gen-cpp2/${base}_types.h "${output_dir}/gen-cpp2/${base}_types.h"
${output_dir}/gen-cpp2/${base}_types.tcc "${output_dir}/gen-cpp2/${base}_types.tcc"
${output_dir}/gen-cpp2/${base}_types_custom_protocol.h "${output_dir}/gen-cpp2/${base}_types_custom_protocol.h"
) )
list(APPEND generated_sources list(APPEND generated_sources
${output_dir}/gen-cpp2/${base}_data.h "${output_dir}/gen-cpp2/${base}_data.h"
${output_dir}/gen-cpp2/${base}_data.cpp "${output_dir}/gen-cpp2/${base}_data.cpp"
${output_dir}/gen-cpp2/${base}_types.cpp "${output_dir}/gen-cpp2/${base}_types.cpp"
) )
foreach(service IN LISTS ARG_SERVICES) foreach(service IN LISTS ARG_SERVICES)
list(APPEND generated_headers list(APPEND generated_headers
${output_dir}/gen-cpp2/${service}.h "${output_dir}/gen-cpp2/${service}.h"
${output_dir}/gen-cpp2/${service}.tcc "${output_dir}/gen-cpp2/${service}.tcc"
${output_dir}/gen-cpp2/${service}AsyncClient.h "${output_dir}/gen-cpp2/${service}AsyncClient.h"
${output_dir}/gen-cpp2/${service}_custom_protocol.h "${output_dir}/gen-cpp2/${service}_custom_protocol.h"
) )
list(APPEND generated_sources list(APPEND generated_sources
${output_dir}/gen-cpp2/${service}.cpp "${output_dir}/gen-cpp2/${service}.cpp"
${output_dir}/gen-cpp2/${service}AsyncClient.cpp "${output_dir}/gen-cpp2/${service}AsyncClient.cpp"
${output_dir}/gen-cpp2/${service}_processmap_binary.cpp "${output_dir}/gen-cpp2/${service}_processmap_binary.cpp"
${output_dir}/gen-cpp2/${service}_processmap_compact.cpp "${output_dir}/gen-cpp2/${service}_processmap_compact.cpp"
) )
endforeach() endforeach()
list(APPEND thrift_include_options -I ${CMAKE_SOURCE_DIR}) list(APPEND thrift_include_options -I "${CMAKE_SOURCE_DIR}")
foreach(depends IN LISTS ARG_DEPENDS) foreach(depends IN LISTS ARG_DEPENDS)
get_property(thrift_include_directory get_property(thrift_include_directory
TARGET ${depends} TARGET ${depends}
...@@ -64,14 +68,17 @@ function(add_thrift_cpp2_library LIB_NAME THRIFT_FILE) ...@@ -64,14 +68,17 @@ function(add_thrift_cpp2_library LIB_NAME THRIFT_FILE)
if (thrift_include_directory STREQUAL "") if (thrift_include_directory STREQUAL "")
message(STATUS "No thrift dependency found for ${depends}") message(STATUS "No thrift dependency found for ${depends}")
else() else()
list(APPEND thrift_include_options -I list(
${thrift_include_directory}) APPEND thrift_include_options
-I "${thrift_include_directory}"
)
endif() endif()
endforeach() endforeach()
file( file(
GLOB_RECURSE THRIFT_TEMPLATE_FILES GLOB_RECURSE THRIFT_TEMPLATE_FILES
FOLLOW_SYMLINKS ${FBTHRIFT_TEMPLATES_DIR}/*.mustache) FOLLOW_SYMLINKS "${FBTHRIFT_TEMPLATES_DIR}/*.mustache"
)
# Emit the rule to run the thrift compiler # Emit the rule to run the thrift compiler
add_custom_command( add_custom_command(
...@@ -79,25 +86,26 @@ function(add_thrift_cpp2_library LIB_NAME THRIFT_FILE) ...@@ -79,25 +86,26 @@ function(add_thrift_cpp2_library LIB_NAME THRIFT_FILE)
${generated_headers} ${generated_headers}
${generated_sources} ${generated_sources}
COMMAND COMMAND
${CMAKE_COMMAND} -E make_directory ${output_dir} "${CMAKE_COMMAND}" -E make_directory "${output_dir}"
COMMAND COMMAND
${FBTHRIFT_COMPILER} "${FBTHRIFT_COMPILER}"
--strict --strict
--templates ${FBTHRIFT_TEMPLATES_DIR} --templates "${FBTHRIFT_TEMPLATES_DIR}"
--gen "mstch_cpp2:${GEN_ARG_STR}" --gen "mstch_cpp2:${GEN_ARG_STR}"
${thrift_include_options} ${thrift_include_options}
-o ${output_dir} -o "${output_dir}"
${CMAKE_CURRENT_SOURCE_DIR}/${THRIFT_FILE} "${CMAKE_CURRENT_SOURCE_DIR}/${THRIFT_FILE}"
WORKING_DIRECTORY WORKING_DIRECTORY
${CMAKE_BINARY_DIR} "${CMAKE_BINARY_DIR}"
MAIN_DEPENDENCY MAIN_DEPENDENCY
${THRIFT_FILE} "${THRIFT_FILE}"
DEPENDS DEPENDS
${ARG_DEPENDS} ${ARG_DEPENDS}
) )
# Now emit the library rule to compile the sources # Now emit the library rule to compile the sources
add_library(${LIB_NAME} STATIC add_library(
"${LIB_NAME}" STATIC
${generated_sources} ${generated_sources}
) )
...@@ -107,7 +115,7 @@ function(add_thrift_cpp2_library LIB_NAME THRIFT_FILE) ...@@ -107,7 +115,7 @@ function(add_thrift_cpp2_library LIB_NAME THRIFT_FILE)
) )
target_include_directories( target_include_directories(
${LIB_NAME} "${LIB_NAME}"
PRIVATE PRIVATE
${CMAKE_SOURCE_DIR} ${CMAKE_SOURCE_DIR}
${CMAKE_BINARY_DIR} ${CMAKE_BINARY_DIR}
...@@ -116,7 +124,7 @@ function(add_thrift_cpp2_library LIB_NAME THRIFT_FILE) ...@@ -116,7 +124,7 @@ function(add_thrift_cpp2_library LIB_NAME THRIFT_FILE)
${FBTHRIFT_INCLUDE_DIR} ${FBTHRIFT_INCLUDE_DIR}
) )
target_link_libraries( target_link_libraries(
${LIB_NAME} "${LIB_NAME}"
PUBLIC PUBLIC
${ARG_DEPENDS} ${ARG_DEPENDS}
FBThrift::thriftcpp2 FBThrift::thriftcpp2
...@@ -124,13 +132,13 @@ function(add_thrift_cpp2_library LIB_NAME THRIFT_FILE) ...@@ -124,13 +132,13 @@ function(add_thrift_cpp2_library LIB_NAME THRIFT_FILE)
) )
set_target_properties( set_target_properties(
${LIB_NAME} "${LIB_NAME}"
PROPERTIES PROPERTIES
EXPORT_PROPERTIES "THRIFT_INCLUDE_DIRECTORY" EXPORT_PROPERTIES "THRIFT_INCLUDE_DIRECTORY"
THRIFT_INCLUDE_DIRECTORY ${CMAKE_SOURCE_DIR} THRIFT_INCLUDE_DIRECTORY "${CMAKE_SOURCE_DIR}"
) )
get_property(thrift_include_directory get_property(thrift_include_directory
TARGET ${LIB_NAME} TARGET "${LIB_NAME}"
PROPERTY THRIFT_INCLUDE_DIRECTORY) PROPERTY THRIFT_INCLUDE_DIRECTORY)
endfunction() endfunction()
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment