Swift/Ninja: Build regression with CMP0157; cannot open input file 'OBJECTS'
When trying to build a Swift project under CMP0157 NEW
that includes SwiftCollections as a dependency, I'm seeing the following error:
[1/4] Building Swift object swift\OrderedCollections.swift...urces\OrderedCollections\Utilities\_UnsafeBitset.swift.obj
<snip; some swiftc compile warnings> [2/4] Linking Swift static library lib\OrderedCollections.lib FAILED: lib/OrderedCollections.lib C:\Windows\system32\cmd.exe /C "cd . && C:\Users\JeremyDay\AppData\Local\Programs\Swift\Toolchains\0.0.0+Asserts\usr\bin\swiftc.exe -emit-library -static -o lib\OrderedCollections.lib OBJECTS && cd ." LINK : fatal error LNK1181: cannot open input file 'OBJECTS'
It looks like where OBJECTS
is there should be a list of object files, and this is the behavior I see for other dependencies. I've discovered a few libraries which reliably fail to link under the new policy.
I've produced a somewhat minimal repro here:
With cmake_policy(SET CMP0157 NEW)
commented out, I am able to build successfully:
$> cmake -S ./ -B ./build -G Ninja
<snip>
$> cmake --build ./build
<snip>
MyProject build succeeded.
But with the policy enabled, I hit the above error.
I'm building on Windows and have not tested this on other platforms. I did some investigation and couldn't see any obvious issues in the build folder under the new policy. I'm happy to provide build folders with and without the new policy, especially if this issue is specific to Windows. I'm continuing to investigate this myself.
I'm running a very recent CMake build, which includes !9095 (merged) and !9076 (merged)