Skip to content

[CMake] Check target, not host, for Info.plist #5160

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged

Conversation

modocache
Copy link
Contributor

The CMake variable APPLE is set to true when building on a macOS host, which means that logic to include linker flags for application extensions, etc., will be enabled on a macOS host. That is, they will be enabled even when cross-compiling the standard library to a non-Apple platform, such as Android.

Instead of using APPLE to check the host OS, check whether the target is an Apple platform.

This was pulled out of the larger pull request #4972, which addresses SR-1362.

The CMake variable `APPLE` is set to true when building on a macOS
host, which means that logic to include linker flags for application
extensions, etc., will be enabled on a macOS host. That is, they will
be enabled even when cross-compiling the standard library to a
non-Apple platform, such as Android.

Instead of using `APPLE` to check the host OS, check whether the target
is an Apple platform.
@modocache
Copy link
Contributor Author

@swift-ci Please test

@modocache modocache merged commit 1c90753 into swiftlang:master Oct 6, 2016
@modocache modocache deleted the cmake-plist-info-apple-platforms branch October 6, 2016 22:26
@gottesmm
Copy link
Contributor

gottesmm commented Oct 9, 2016

Looks reasonable.

@llvm-beanz
Copy link
Contributor

Sorry for the late comment, but I wanted to point out that this is actually a situation where Swift's use of CMake is problematic.

In CMake APPLE is defined if you are targeting an Apple platform (or at least if CMake thinks you are). If your host is an Apple platform CMake defines CMAKE_HOST_APPLE. Since Swift's build is rolling its own cross-compiling support it would probably be best if any checks like APPLE, UNIX, LINUX or WIN32 were rewritten in terms of CMAKE_HOST_* variables.

@modocache
Copy link
Contributor Author

I only found two APPLE checks, and no checks for UNIX, LINUX, or others. Addressed in #5231.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants