[cmake-developers] Python extension to FindProtobuf
Brad King
brad.king at kitware.com
Fri Sep 11 14:33:18 EDT 2015
On 09/11/2015 11:11 AM, Andreas Bergmeier wrote:
> Here is the commit.
Thanks. Please revise the patch to also update the documentation
of the module to mention the new API.
> + list(APPEND ${SRCS} "${CMAKE_CURRENT_BINARY_DIR}/${FIL_WE}.pb.py")
> + add_custom_command(
> + OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/${FIL_WE}.pb.py"
> + COMMAND ${PROTOBUF_PROTOC_EXECUTABLE}
> + ARGS --python_out ${CMAKE_CURRENT_BINARY_DIR} ${_protobuf_include_path} ${ABS_FIL}
The ARGS option can be dropped. It is silently ignored anyway.
The arguments after it will be collected by COMMAND already.
> + DEPENDS ${ABS_FIL} ${PROTOBUF_PROTOC_EXECUTABLE}
> + COMMENT "Running Python protocol buffer compiler on ${FIL}"
> + VERBATIM )
> + endforeach()
> +
> + set_source_files_properties(${${SRCS}} PROPERTIES GENERATED TRUE)
We do not need to explicitly set the GENERATED property. That
convention has been outdated for years. The add_custom_command
call automatically sets this on the OUTPUT.
Thanks,
-Brad
More information about the cmake-developers
mailing list