summaryrefslogtreecommitdiffstats
path: root/Modules/FindProtobuf.cmake
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2017-10-02 12:04:24 (GMT)
committerBrad King <brad.king@kitware.com>2017-10-02 12:04:24 (GMT)
commit4e91be95323fa869a82ea59e733a706a5fd3867b (patch)
tree516bcb73a20b761b5ce98cd3250013305979e86a /Modules/FindProtobuf.cmake
parent46f7a6707bd11f277a11ad7cc59adcbb1077407c (diff)
downloadCMake-4e91be95323fa869a82ea59e733a706a5fd3867b.zip
CMake-4e91be95323fa869a82ea59e733a706a5fd3867b.tar.gz
CMake-4e91be95323fa869a82ea59e733a706a5fd3867b.tar.bz2
FindProtobuf: Refactor custom command output listing
Reduce duplication by storing the custom command outputs in variables. Also, since custom command outputs are automatically marked as generated we do not need to do so explicitly.
Diffstat (limited to 'Modules/FindProtobuf.cmake')
-rw-r--r--Modules/FindProtobuf.cmake15
1 files changed, 8 insertions, 7 deletions
diff --git a/Modules/FindProtobuf.cmake b/Modules/FindProtobuf.cmake
index 90f7a2e..c1444a1 100644
--- a/Modules/FindProtobuf.cmake
+++ b/Modules/FindProtobuf.cmake
@@ -168,12 +168,14 @@ function(PROTOBUF_GENERATE_CPP SRCS HDRS)
endif()
endif()
- list(APPEND ${SRCS} "${CMAKE_CURRENT_BINARY_DIR}/${FIL_WE}.pb.cc")
- list(APPEND ${HDRS} "${CMAKE_CURRENT_BINARY_DIR}/${FIL_WE}.pb.h")
+ set(_protobuf_protoc_src "${CMAKE_CURRENT_BINARY_DIR}/${FIL_WE}.pb.cc")
+ set(_protobuf_protoc_hdr "${CMAKE_CURRENT_BINARY_DIR}/${FIL_WE}.pb.h")
+ list(APPEND ${SRCS} "${_protobuf_protoc_src}")
+ list(APPEND ${HDRS} "${_protobuf_protoc_hdr}")
add_custom_command(
- OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/${FIL_WE}.pb.cc"
- "${CMAKE_CURRENT_BINARY_DIR}/${FIL_WE}.pb.h"
+ OUTPUT "${_protobuf_protoc_src}"
+ "${_protobuf_protoc_hdr}"
COMMAND protobuf::protoc
ARGS "--cpp_out=${DLL_EXPORT_DECL}${CMAKE_CURRENT_BINARY_DIR}" ${_protobuf_include_path} ${ABS_FIL}
DEPENDS ${ABS_FIL} protobuf::protoc
@@ -181,9 +183,8 @@ function(PROTOBUF_GENERATE_CPP SRCS HDRS)
VERBATIM )
endforeach()
- set_source_files_properties(${${SRCS}} ${${HDRS}} PROPERTIES GENERATED TRUE)
- set(${SRCS} ${${SRCS}} PARENT_SCOPE)
- set(${HDRS} ${${HDRS}} PARENT_SCOPE)
+ set(${SRCS} "${${SRCS}}" PARENT_SCOPE)
+ set(${HDRS} "${${HDRS}}" PARENT_SCOPE)
endfunction()
function(PROTOBUF_GENERATE_PYTHON SRCS)