Xcode project generator omits `$(EFFECTIVE_PLATFORM_NAME)` from some paths when generating project that supports multiple Apple platforms
When generating an Xcode project intended to build for multiple Apple platforms (e.g., iOS and OS X), CMake omits
$(EFFECTIVE_PLATFORM_NAME) from some paths in the project file. See the test project at https://github.com/bdash/cmake-xcode-multiplatform for a minimal test case demonstrating this, where CMake generates a project that is unable to build for the iPhone simulator, and may attempt to link a library built for OS X if the project is first built for that platform.
The underlying issue is that
cmGeneratorTarget::ComputeOutputDir keys off
cmMakefile::PlatformIsAppleIos to determine whether
$(EFFECTIVE_PLATFORM_NAME) should be included in the path. This checks whether
CMAKE_OSX_SYSROOT has a value that matches one of the known iOS platform names (iphoneos, iphonesimulator, etc). If
CMAKE_OSX_SYSROOT is not explicitly specified, or has some other value,
$(EFFECTIVE_PLATFORM_NAME) is omitted. Since the path to the output directory depends on the effective platform rather than a single SDK,
$(EFFECTIVE_PLATFORM_NAME) should be included whenever the Xcode project generator is used.