Skip to content

[scripts/get_cmake_vars][scripts/ports.cmake] fix CMake4 on OSX#44712

Merged
BillyONeal merged 3 commits into
microsoft:masterfrom
strega-nil:cmake4
Apr 2, 2025
Merged

[scripts/get_cmake_vars][scripts/ports.cmake] fix CMake4 on OSX#44712
BillyONeal merged 3 commits into
microsoft:masterfrom
strega-nil:cmake4

Conversation

@strega-nil-re
Copy link
Copy Markdown
Contributor

@strega-nil-re strega-nil-re commented Mar 31, 2025

It looks like CMake 4 may not always initialise CMAKE_OSX_SYSROOT, and get_cmake_vars/z_vcpkg_get_cmake_vars would fail if that happened. I simply fixed it the same way that the port vcpkg_cmake_get_vars does.

This additionally sets the environment variable CMAKE_POLICY_VERSION_MINIMUM to 4.0 when using CMake 4.0, so that any ports that use an ancient cmake_minimum_required are taken care of.

Fixes #44697

It looks like CMake 4 may not always initialise CMAKE_OSX_SYSROOT, and
`get_cmake_vars`/`z_vcpkg_get_cmake_vars` would fail if that happened.
I simply fixed it the same way that the port `vcpkg_cmake_get_vars`
does.

Fixes microsoft#44697
@strega-nil-re
Copy link
Copy Markdown
Contributor Author

@microsoft-github-policy-service terminate

@strega-nil-re
Copy link
Copy Markdown
Contributor Author

@microsoft-github-policy-service agree company="reMarkable AS"

@strega-nil-re
Copy link
Copy Markdown
Contributor Author

(I think I accidentally agreed on this account for myself, rather than as a paid contributor from reMarkable, so redoing the agreement)

@Cheney-W Cheney-W added the category:tool-update The issue is with build tool or build script, which requires update or should be executed correctly label Mar 31, 2025
Comment thread ports/crc32c/fix_cmake4.patch Outdated
@strega-nil-re strega-nil-re changed the title [scripts/get_cmake_vars] fix CMake4 on OSX [scripts/get_cmake_vars, many ports] fix CMake4 on OSX Mar 31, 2025
@strega-nil-re strega-nil-re marked this pull request as ready for review March 31, 2025 11:54
CMake 4 broke compatiblity with CMake pre-3.5, so we need to set this variable
to avoid ports which have an earlier cmake_minimum_required(VERSION) breaking.
@strega-nil-re strega-nil-re changed the title [scripts/get_cmake_vars, many ports] fix CMake4 on OSX [scripts/get_cmake_vars][scripts/ports.cmake] fix CMake4 on OSX Mar 31, 2025
Cheney-W
Cheney-W previously approved these changes Apr 1, 2025
@Cheney-W
Copy link
Copy Markdown
Contributor

Cheney-W commented Apr 1, 2025

The failure of proxygen:x64-linux is unrelated to this PR.

@ADKaster
Copy link
Copy Markdown
Contributor

ADKaster commented Apr 1, 2025

It looks like this PR would also partially address #44726 ? At least, the second commit will hide the error from vcpkg users.

Comment thread scripts/ports.cmake Outdated
Comment thread scripts/ports.cmake Outdated
@BillyONeal
Copy link
Copy Markdown
Member

Thanks for the fix! Related: #44273 has other fixes for 4.x but I think we should take this more targeted change to put out the current fire drill.

@BillyONeal BillyONeal merged commit a1aebfa into microsoft:master Apr 2, 2025
@Cheney-W Cheney-W added the info:needs-maintainer-attention Lets the current 'on rotation' vcpkg maintainer know they need to look at this. label Apr 3, 2025
@Cheney-W Cheney-W mentioned this pull request Apr 3, 2025
This was referenced Apr 3, 2025
@strega-nil-re strega-nil-re deleted the cmake4 branch April 3, 2025 06:33
@BillyONeal BillyONeal mentioned this pull request Apr 7, 2025
7 tasks
kotori2 added a commit to kotori2/vcpkg that referenced this pull request Apr 30, 2025
hebasto added a commit to hebasto/bitcoin that referenced this pull request Mar 20, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

category:tool-update The issue is with build tool or build script, which requires update or should be executed correctly info:needs-maintainer-attention Lets the current 'on rotation' vcpkg maintainer know they need to look at this.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[openssl] Build failure using CMake4

7 participants