0

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.

I created a test project to pinpoint the problem. In it is a main.cpp

#include <iostream>

int main() {
    std::cout << "Hello, World!" << std::endl;
    return 0;
}

and a CMakeLists.txt

cmake_minimum_required(VERSION 3.14)
project(untitled)

set(CMAKE_CXX_STANDARD 11)

add_executable(untitled main.cpp)

The in a build subdirectory I run

>>> 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 "../Test/build/CMakeFiles/CMakeOutput.log".
See also "../Test/build/CMakeFiles/CMakeError.log".

I have tried resetting the env variables CC and CXX which were set to x86_64-apple-darwin13.4.0-clang and x86_64-apple-darwin13.4.0-clang++. This was not successful and seems kluge.

I have tried sudo xcode-select --reset as suggested in other posts. This has no effect.

The beginning of CMakeFiles/CMakeError.log is:

Compiling the C compiler identification source file "CMakeCCompilerId.c" 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

.
.
.
RBM
  • 31
  • 4
  • I have tried ```sudo xcode-select --reset``` as is suggested in CMake error no CMAKE_C_COMPILER could be found using Xcode and GLFW and elsewhere. This has not effect. – RBM Oct 08 '21 at 22:13

0 Answers0