Hi folks, we're looking at bumping the minimum required CMake version for building the compiler. There are currently two parallel PRs posted for bumping the version to 3.24 and 3.29.
The motivation for bumping to 3.24 is to fix an issue with cmake -E env. Parsing -- as a separator between the environment settings and the command was added in CMake 3.24. Prior to this, if the filepath to a command contained an equals sign (=), it would be interpreted as an environment variable assignment instead of as a command. e.g. /Library/Caches/\<sandbox-with-base-64\>==/usr/local/bin/python3 would assign =/usr/local/bin/python3 to an oddly named environment variable, and then proceed to fail because it's trying to call the arguments to the python interpreter. With 3.24 and later, passing cmake -E env -- ensures that we actually get the command we are interested in.
The motivation for bumping to 3.29 is to get use of newer Swift features going into CMake. Specifically, CMP0157 improves how CMake handles Swift compilation, also allowing CMake to emit the compile-commands file. These changes improve build performance and enable semantic editing in the parts of the compiler using the CMake-native add_library support for Swift (not the custom add_swift_compiler_modules_library in SwiftCompilerSources), like in the ASTGen portions of the compiler.
For comparison, the LLVM minimum required CMake version is CMake 3.20.
For folks compiling the toolchain with build-script, the tooling will compile the appropriate version of CMake if one is not compiled. If you are running on an older Linux distro for example, the build will produce a new enough CMake to support the compiler build if one is not already on your $PATH.
Are there any preferences between the two versions? Is there a strong reason to delay bumping the version? Thanks.
I should add that we are likely to adopt 4.4.0 on Windows - there are meaningful improvements that we want to capitalize on to reduce some of the build times.
I'm referring to the compiler build here, not the runtime builds. Since most of the compiler is still using the custom commands to compile the Swift, I don't think you'll see a meaningful perf improvement from enabling CMP0215 or bumping the minimum required version on the compiler build.
That said, on the runtime side, I'm also not quite ready to jump to 4.4. 4.4 is still in release-candidate, and I'd very much like a .3 or .4 release before we start requiring it. Spanning minimum versions across the 4.1 boundary will present some challenges since 4.1+ moves to building the nested swiftmodule directory structure instead of the flat form. I would be fine if you want to enable CMP0215 conditionally and/or enabling CMAKE_Swift_SEPARATE_MODULE_EMISSION.
We can bump it further later if we need to, but I think we should support at least a year back. v3.30.2 is a bit further than that, but also gives folks a chance to migrate since 4.0 dropped support for many older policies and made a pretty big un-guarded change to how Apple SDK and toolchain tool resolution happens (that was quite breaking).