Browse Source

Xcode: Work around xcodebuild spurious hangs in try_compile

`xcodebuild` occasionally hangs on some macOS machines (and can be
reproduced independent of CMake).  It only happens a few times in 1000
runs, but configuration of a large project calls `try_compile` many
times and therefore frequently hangs due to this problem.  I've been
unable to reproduce the hang when using a scheme to build, so always
generate a scheme in `try_compile` projects to work around the problem.

Issue: #16752
Brad King 8 years ago
parent
commit
c608000a2a
1 changed files with 2 additions and 1 deletions
  1. 2 1
      Source/cmGlobalXCodeGenerator.cxx

+ 2 - 1
Source/cmGlobalXCodeGenerator.cxx

@@ -3280,7 +3280,8 @@ void cmGlobalXCodeGenerator::OutputXCodeProject(
   // Since the lowest available Xcode version for testing was 7.0,
   // Since the lowest available Xcode version for testing was 7.0,
   // I'm setting this as a limit then
   // I'm setting this as a limit then
   if (this->XcodeVersion >= 70) {
   if (this->XcodeVersion >= 70) {
-    if (root->GetMakefile()->IsOn("CMAKE_XCODE_GENERATE_SCHEME")) {
+    if (root->GetMakefile()->GetCMakeInstance()->GetIsInTryCompile() ||
+        root->GetMakefile()->IsOn("CMAKE_XCODE_GENERATE_SCHEME")) {
       this->OutputXCodeSharedSchemes(xcodeDir);
       this->OutputXCodeSharedSchemes(xcodeDir);
       this->OutputXCodeWorkspaceSettings(xcodeDir);
       this->OutputXCodeWorkspaceSettings(xcodeDir);
     }
     }