Skip to content

Xcode: Fix PCH support with Swift & C++

Mikko Lehtonen requested to merge scoopr/cmake:fix-pch into master

Previously, when a mixed language target ends up with Swift as the LINKER_LANGUAGE, the PCH file was not set for the target at all.

Original Description

The workaround for forcing LINKER_LANGAUGE back to CXX worked, but then it seemed that it needed to be bubbled down to all the dependants, which is inconvenient. And there didn't seem to be a way to override for the "interface" of the library.

Ninja generator had a releated issue where it would pass the compiled pch file to the linker, and it did not understand what to do with it. I couldn't quite figure out how to fix it, but just as I was about to give up, by happenstance I noticed the CMP0157 that was added recently, and setting it would seemed to fix it, though I don't quite know why.

Fixes: #21224 (closed)
Topic-rename: xcode-pch-swift-cxx

Edited by Brad King

Merge request reports