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
main v2022.02.14.00 v2022.02.07.00 v2022.01.31.00 v2022.01.24.00 v2022.01.17.00 v2022.01.10.00 v2022.01.03.00 v2021.12.27.00 v2021.12.20.00 v2021.12.13.00 v2021.12.06.00 v2021.11.29.00 v2021.11.15.00 v2021.11.08.00 v2021.11.01.00 v2021.10.25.00 v2021.10.18.00 v2021.10.11.00 v2021.10.04.00 v2021.09.27.00 v2021.09.20.00 v2021.09.13.00 v2021.09.06.00 v2021.08.30.00 v2021.08.23.00 v2021.08.02.00 v2021.07.22.00 v2021.07.20.01 v2021.07.20.00 v2021.06.28.00 v2021.06.14.00 v2021.06.07.00 v2021.05.31.00 v2021.05.24.00 v2021.05.17.00 v2021.05.10.00 v2021.05.03.00 v2021.04.26.00 v2021.04.19.00 v2021.04.12.00 v2021.04.05.00 v2021.03.29.00 v2021.03.22.00 v2021.03.15.00 v2021.03.08.00 v2021.03.01.00 v2021.02.22.00 v2021.02.15.00 v2021.02.08.00 v2021.02.01.00 v2021.01.25.00 v2021.01.18.01 v2021.01.18.00 v2021.01.11.00 v2021.01.04.00 v2020.12.28.00 v2020.12.21.00 v2020.12.14.00 v2020.12.07.00 v2020.11.30.00 v2020.11.23.00 v2020.11.16.00 v2020.11.09.00 v2020.11.02.00 v2020.10.26.00 v2020.10.19.00 v2020.10.12.00 v2020.10.05.00 v2020.09.28.00 v2020.09.21.00 v2020.09.14.00 v2020.09.07.00 v2020.08.31.00 v2020.08.24.00 v2020.08.17.00 v2020.08.10.00 v2020.08.03.00 v2020.07.27.00 v2020.07.20.00 v2020.07.13.00 v2020.07.06.00 v2020.06.29.00 v2020.06.15.00 v2020.06.08.00 v2020.06.01.00 v2020.05.25.00 v2020.05.18.00 v2020.05.11.00 v2020.05.04.00 v2020.04.27.00 v2020.04.20.00 v2020.04.13.00 v2020.04.06.00 v2020.03.30.00 v2020.03.23.00 v2020.03.16.00 v2020.03.09.00 v2020.03.02.00 v2020.02.24.00 v2020.02.17.00 v2020.02.10.00 v2020.02.03.00 v2020.01.27.00 v2020.01.20.00 v2020.01.13.00 v2020.01.06.00 v2019.12.30.00 v2019.12.23.00 v2019.12.16.00 v2019.12.09.00 v2019.12.06.00 v2019.12.02.00 v2019.11.11.00 v2019.11.04.00 v2019.10.28.00 v2019.10.21.00 v2019.10.14.00 v2019.10.07.00 v2019.09.30.00 v2019.09.23.00 v2019.09.16.00 v2019.09.09.00 v2019.09.02.00 v2019.08.26.00
No related merge requests found
...@@ -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