From 11d01dbc9fb9e3d0cd76ffe0ff318e7573c17dc4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Do=C4=9Fan=20=C3=87e=C3=A7en?= Date: Mon, 21 Oct 2024 19:33:21 +0200 Subject: [PATCH] Fix actorcompiler target in CMake add_flow_target This also fixes #11595 - if Unix Makefiles is chosen for CMake builds, build was failing with: ``` make[2]: *** No rule to make target 'actorcompiler.exe', needed by 'flow/ActorCollection.actor.g.cpp'. Stop. ``` I suspect it could have been a problem for Ninja as well since the issue was due to race condition, but probably it didn't happened so far for other unknown factors. See this example in CMake add_custom_command documentation: https://cmake.org/cmake/help/latest/command/add_custom_command.html#example-generating-files-for-multiple-targets The correct target to depend on is `actorcompiler` for CMake to generate the right dependency order, `${actor_exe}` is just a string that points to the location of the actor compiler. See here: https://github.com/apple/foundationdb/blob/4260bbb3c2e81531e1ec1493424544a2bea0c867/cmake/CompileActorCompiler.cmake#L26-L27 --- cmake/CompileActorCompiler.cmake | 2 +- cmake/FlowCommands.cmake | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/cmake/CompileActorCompiler.cmake b/cmake/CompileActorCompiler.cmake index 2f737b61791..992e80f4657 100644 --- a/cmake/CompileActorCompiler.cmake +++ b/cmake/CompileActorCompiler.cmake @@ -19,7 +19,7 @@ else() set(ACTOR_COMPILER_REFERENCES "-r:System,System.Core,System.Xml.Linq,System.Data.DataSetExtensions,Microsoft.CSharp,System.Data,System.Xml") - add_custom_command(OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/actorcompiler.exe + add_custom_command(OUTPUT actorcompiler.exe COMMAND ${MCS_EXECUTABLE} ARGS ${ACTOR_COMPILER_REFERENCES} ${ACTORCOMPILER_SRCS} "-target:exe" "-out:actorcompiler.exe" DEPENDS ${ACTORCOMPILER_SRCS} COMMENT "Compile actor compiler" VERBATIM) diff --git a/cmake/FlowCommands.cmake b/cmake/FlowCommands.cmake index c5299c8d572..9fcd5011836 100644 --- a/cmake/FlowCommands.cmake +++ b/cmake/FlowCommands.cmake @@ -237,12 +237,12 @@ function(add_flow_target) if(WIN32) add_custom_command(OUTPUT "${out_file}" COMMAND $ "${in_file}" "${out_file}" ${actor_compiler_flags} - DEPENDS "${in_file}" ${actor_exe} + DEPENDS "${in_file}" actorcompiler COMMENT "Compile actor: ${src}") else() add_custom_command(OUTPUT "${out_file}" COMMAND ${MONO_EXECUTABLE} ${actor_exe} "${in_file}" "${out_file}" ${actor_compiler_flags} > /dev/null - DEPENDS "${in_file}" ${actor_exe} + DEPENDS "${in_file}" actorcompiler COMMENT "Compile actor: ${src}") endif() endif()