title: Problem with compilers when using cmake to build a Xcode project
body: <p>I have been using CMake for years to build my Xcode projects. Suddenly, maybe after upgrading the OSX (11.6) or maybe after upgrading the Xcode (13.0, commandline tools 13.0), cmake does not work anymore.</p>
  <p>First let me give some of the things I have already tried so I am just not referred to an answered question and forgotten:</p>
  <p><code>sudo xcode-select --reset</code> This has no effect.</p>
  <p>I have tried resetting the cmake variable manually with
  <code>cmake .. -DCMAKE_C_COMPILER=&quot;/usr/bin/cc&quot;</code> and to other paths.  It still gives a &quot;Compiling the C compiler identification source file &quot;CMakeCCompilerId.c&quot; failed.&quot; in the CMakeError.log.  No c compiler that I can find in my system seems to work including clang in various locations.</p>
  <p>I have tried reseting the environmental variables CC, CXX, CLANG, etc to different paths.</p>
  <p>This might have something to do with Anaconda which I have installed.</p>
  <p>I created a test project to pinpoint the problem. In it is a main.cpp</p>
  <pre><code>#include &lt;iostream&gt;
  
  int main() {
      std::cout &lt;&lt; &quot;Hello, World!&quot; &lt;&lt; std::endl;
      return 0;
  }
  </code></pre>
  <p>and a CMakeLists.txt</p>
  <pre><code>cmake_minimum_required(VERSION 3.14)
  project(untitled)
  
  set(CMAKE_CXX_STANDARD 11)
  
  add_executable(untitled main.cpp)
  </code></pre>
  <p>The in a build subdirectory I run</p>
  <pre><code>&gt;&gt;&gt; cmake .. -G Xcode
  -- The C compiler identification is unknown
  -- The CXX compiler identification is unknown
  CMake Error at CMakeLists.txt:2 (project):
    No CMAKE_C_COMPILER could be found.
  
  
  
  CMake Error at CMakeLists.txt:2 (project):
    No CMAKE_CXX_COMPILER could be found.
  
  
  
  -- Configuring incomplete, errors occurred!
  See also &quot;../Test/build/CMakeFiles/CMakeOutput.log&quot;.
  See also &quot;../Test/build/CMakeFiles/CMakeError.log&quot;.
  </code></pre>
  <p>The beginning of CMakeFiles/CMakeError.log is:</p>
  <pre><code>Compiling the C compiler identification source file &quot;CMakeCCompilerId.c&quot; failed.
  Compiler:  
  Build flags: -march=core2;-mtune=haswell;-mssse3;-ftree-vectorize;-fPIC;-fPIE;-fstack-protector-strong;-O2;-pipe;-isystem;/opt/anaconda3/include
  Id flags:  
  
  The output was:
  65
  Command line invocation:
      /Applications/Xcode.app/Contents/Developer/usr/bin/xcodebuild
  
  User defaults from command line:
      IDEPackageSupportUseBuiltinSCM = YES
  
  note: Using new build system
  note: Planning
  Analyze workspace
  
  .
  .
  .
     clang-10: error: invalid Darwin version number: macos11.3
      clang-10: error: invalid version number in '-target x86_64-apple-macos11.3'
   
  .
  .
  .
  </code></pre>