Fails To Build With CMake 4.0
Introduction
CMake 4.0 has been released, and it has dropped support for "old" policies before 3.5. This means that any CMake build script with cmake_minimum_version(<version>)
where <version>
is less than 3.5 fails to build. In this article, we will explore the issue, its implications, and provide a step-by-step guide to resolving it.
What is the Issue?
CMake 4.0 has been released, and it drops support for "old" policies before 3.5. This means that any CMake build script with cmake_minimum_version(<version>)
where <version>
is less than 3.5 fails to build. Transmission's main CMakeFile defines 3.12 and thus still works with CMake 4.0. However, under third-party/
there are many bundled dependencies, many of which define a version that does not work.
Causes of the Issue
The issue arises from the fact that CMake 4.0 has dropped support for "old" policies before 3.5. This means that any CMake build script with cmake_minimum_version(<version>)
where <version>
is less than 3.5 fails to build. The main CMakeFile of Transmission defines 3.12, which is still compatible with CMake 4.0. However, the bundled dependencies under third-party/
define versions that are not compatible with CMake 4.0.
Implications of the Issue
The issue has significant implications for users who are trying to build Transmission with CMake 4.0. If the CMake build script is not updated to specify a version that is compatible with CMake 4.0, the build will fail. This can be frustrating for users who are trying to build Transmission with the latest version of CMake.
Resolving the Issue
Fortunately, resolving the issue is relatively straightforward. The solution is to update the CMake build script to specify a version that is compatible with CMake 4.0. This can be done by updating the cmake_minimum_version
directive to specify a version that is greater than or equal to 3.5.
Updating the CMake Build Script
To update the CMake build script, you need to modify the CMakeFiles.txt
files under third-party/
to specify the same version as the main CMakeFiles.txt
does. This can be done by updating the cmake_minimum_version
directive to specify a version that is greater than or equal to 3.5.
Alternative Solution
Instead of updating the required minimum version, you can also set the allowed maximum policy version like cmake_minimum_version(2.8.11 ... 3.12)
. This approach can be taken if you consider building the bundled deps with really old CMake versions worthwhile. However, this approach may not be useful if you find it highly unlikely that the bundled dependencies are used anywhere else than in this repo, which already cannot be built with version older than 3.12.
Conclusion
In conclusion, the issue of failing to build with CMake 4. is a significant problem that can be frustrating for users who are trying to build Transmission with the latest version of CMake. However, resolving the issue is relatively straightforward. By updating the CMake build script to specify a version that is compatible with CMake 4.0, users can resolve the issue and build Transmission successfully.
Additional Information
Which application of Transmission?
None
Which version of Transmission?
4.0.6
Related Links
Introduction
In our previous article, we discussed the issue of failing to build with CMake 4.0 and provided a step-by-step guide to resolving it. In this article, we will answer some frequently asked questions (FAQs) related to the issue.
Q: What is the issue with CMake 4.0?
A: CMake 4.0 has dropped support for "old" policies before 3.5. This means that any CMake build script with cmake_minimum_version(<version>)
where <version>
is less than 3.5 fails to build.
Q: Why is this issue a problem?
A: This issue is a problem because it can cause CMake builds to fail, which can be frustrating for users who are trying to build Transmission with the latest version of CMake.
Q: How can I resolve the issue?
A: To resolve the issue, you need to update the CMake build script to specify a version that is compatible with CMake 4.0. This can be done by updating the cmake_minimum_version
directive to specify a version that is greater than or equal to 3.5.
Q: What if I don't want to update the CMake build script?
A: If you don't want to update the CMake build script, you can set the allowed maximum policy version like cmake_minimum_version(2.8.11 ... 3.12)
. However, this approach may not be useful if you find it highly unlikely that the bundled dependencies are used anywhere else than in this repo, which already cannot be built with version older than 3.12.
Q: What are the implications of this issue?
A: The implications of this issue are that users who are trying to build Transmission with CMake 4.0 may experience build failures. This can be frustrating for users who are trying to build Transmission with the latest version of CMake.
Q: How can I prevent this issue in the future?
A: To prevent this issue in the future, you can update the CMake build script to specify a version that is compatible with CMake 4.0. This can be done by updating the cmake_minimum_version
directive to specify a version that is greater than or equal to 3.5.
Q: What if I'm using a version of CMake that is older than 4.0?
A: If you're using a version of CMake that is older than 4.0, you may need to update to a newer version of CMake to resolve the issue.
Q: Can I still build Transmission with CMake 4.0?
A: Yes, you can still build Transmission with CMake 4.0, but you may need to update the CMake build script to specify a version that is compatible with CMake 4.0.
Conclusion
In conclusion, the issue of failing to build with CMake 4.0 is a significant problem that can be frustrating for users who are trying to build Transmission with the latest version of CMake. However, resolving the issue relatively straightforward. By updating the CMake build script to specify a version that is compatible with CMake 4.0, users can resolve the issue and build Transmission successfully.
Additional Information
Which application of Transmission?
None
Which version of Transmission?
4.0.6