Hopefully better cross-compiling support with Python #1684
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
CMake historically has had issues with finding dependencies for the target system and the host system in the same project. vcpkg has its own concept of host dependencies, but that doesn't generalize to the rest of CMake.
In Plasma's case, the only host dependency that is causing is pain is the Python interpreter, to run the resources.dat building step on the host at compile time.
CMake 4 introduces the idea of Python artifact prefixes, to allow finding Python multiple times. They give cross-compiling and needing the host interpreter as an example of where this is useful (although it's unclear to me how exactly it's told to find the host interpreter vs the target interpreter).
This change should allow us to opt-in to the prefixed behaviour on CMake 4, while retaining the existing behaviour on CMake 3 with a conditional assignment to the prefixed executable variable. In my testing with cross-compiling for Windows, it does seem to actually find the right values when using CMake 4.
Note: We can't adopt CMake 4 in CI until vcpkg properly supports it. They seem to be doing a bunch of work around that right now.