Doe we fail to generate buffer includes before compiling in parallel builds?
Closed, ResolvedPublic

Description

It was suggested that we might fail to generate the flatbuffer includes before compiling when doing parallel builds (which would be a bug).
We currently generate the includes like this, and according to my understanding target_sources should take care of the dependency.

function(generate_flatbuffers _target)
    foreach(fbs ${ARGN})
        #Necessary because we can get relative paths as name, e.g. commands/create_entity
        get_filename_component(filename ${fbs} NAME)
        #We first generate into a temporary directory to avoid changing the timestamp of the actual dependency unnecessarily.
        #Otherwise we'd end up unnecessarily rebuilding the target.
        add_custom_command(
            OUTPUT  ${CMAKE_CURRENT_BINARY_DIR}/${fbs}_generated.h
            COMMAND ${FLATBUFFERS_FLATC_EXECUTABLE} -c -b -o ${CMAKE_CURRENT_BINARY_DIR}/flatbufferstmp ${CMAKE_CURRENT_SOURCE_DIR}/${fbs}.fbs
            COMMAND ${CMAKE_COMMAND} -E copy_if_different
                ${CMAKE_CURRENT_BINARY_DIR}/flatbufferstmp/${filename}_generated.h
                ${CMAKE_CURRENT_BINARY_DIR}/${filename}_generated.h
            DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/${fbs}.fbs

        )
        target_sources(${_target} PRIVATE ${CMAKE_CURRENT_BINARY_DIR}/${fbs}_generated.h)
        set_property(SOURCE ${fbs}_generated.h PROPERTY SKIP_AUTOMOC ON)
    endforeach(fbs)
endfunction(generate_flatbuffers)
cmollekopf triaged this task as Normal priority.
cmollekopf moved this task from New to Triaged on the Kube: Bugs board.
cmollekopf closed this task as Resolved.Apr 9 2018, 2:40 PM
cmollekopf claimed this task.

I think this was caused by the newly added webdavcommon library. It lacked a dependency on sink_common, but depended on the generated headers.