Files
apple-foundationdb/cmake/CompileActorCompiler.cmake
Doğan Çeçen 83d919e9a9 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:

4260bbb3c2/cmake/CompileActorCompiler.cmake (L26-L27)
2024-10-22 22:54:22 +08:00

29 lines
1.2 KiB
CMake

set(ACTORCOMPILER_SRCS
${CMAKE_CURRENT_SOURCE_DIR}/flow/actorcompiler/ActorCompiler.cs
${CMAKE_CURRENT_SOURCE_DIR}/flow/actorcompiler/ActorParser.cs
${CMAKE_CURRENT_SOURCE_DIR}/flow/actorcompiler/ParseTree.cs
${CMAKE_CURRENT_SOURCE_DIR}/flow/actorcompiler/Program.cs
${CMAKE_CURRENT_SOURCE_DIR}/flow/actorcompiler/Properties/AssemblyInfo.cs)
if(WIN32)
add_executable(actorcompiler ${ACTORCOMPILER_SRCS})
target_compile_options(actorcompiler PRIVATE "/langversion:6")
set_property(TARGET actorcompiler PROPERTY VS_DOTNET_REFERENCES
"System"
"System.Core"
"System.Xml.Linq"
"System.Data.DataSetExtensions"
"Microsoft.CSharp"
"System.Data"
"System.Xml")
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 actorcompiler.exe
COMMAND ${MCS_EXECUTABLE} ARGS ${ACTOR_COMPILER_REFERENCES} ${ACTORCOMPILER_SRCS} "-target:exe" "-out:actorcompiler.exe"
DEPENDS ${ACTORCOMPILER_SRCS}
COMMENT "Compile actor compiler" VERBATIM)
add_custom_target(actorcompiler DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/actorcompiler.exe)
set(actor_exe "${CMAKE_CURRENT_BINARY_DIR}/actorcompiler.exe")
endif()