Ninja generator creates dependency on non-existent .swiftmodule file of executable
Check out the cmake-bug-dependency-on-swiftmodule-of-executable
tag of https://github.com/hylo-lang/hylo, and have a cmake-compatible LLVM for your platform (you can download one from https://github.com/hylo-lang/llvm-build). Now build for testing, passing a suitable LLVM_DIR
to CMake. The command I use is
cmake -D CMAKE_BUILD_TYPE=Debug \
-D LLVM_DIR=~/Downloads/llvm-17.0.6-arm64-apple-darwin23.3.0-MinSizeRel/lib/cmake/llvm -D BUILD_TESTING=1 \
-G Ninja -S . -B .ninja-build && cmake --build .ninja-build
The result is:
ninja: error: 'Tests/GenerateHyloFileTests.swiftmodule', needed by 'Tests/CMakeFiles/HyloTests.dir/HyloTests/ASTTests.swift.o', missing and no known rule to make it
GenerateHyloFileTests
is an executable target; there's no reason for it to have a .swiftmodule
, and as far as I know I'm not doing anything to prompt it to be treated as a library. The dependency chain gets created here. Without "${generated_swift_file}"
in that last line, the build succeeds. Also, removing the dependency on GenerateHyloFileTests
here has no effect on the problem.
Edited by Dave Abrahams