diff --git a/cmake/ActsCodegen.cmake b/cmake/ActsCodegen.cmake index 371b9c79162..3f99dc2258f 100644 --- a/cmake/ActsCodegen.cmake +++ b/cmake/ActsCodegen.cmake @@ -220,6 +220,11 @@ function(acts_code_generation) ${ARGS_ADD_TO_TARGET} INTERFACE $ ) + + # Use the CMake 3.19 functionality of attaching private sources to + # interface targets to create an explicit dependency between the target + # and the output file. + target_sources(${ARGS_ADD_TO_TARGET} PRIVATE ${_output_file}) else() target_include_directories( ${ARGS_ADD_TO_TARGET}