CMake no CMAKE_C_COMPILER error can be found using Xcode and GLFW

I am trying to follow this guide to get started with OpenGL: http://www.learnopengl.com/#!Getting-started/Creating-a-window, and it requires glfw and CMake to load. I set the downloaded glfw folder as the source folder, and I created another folder inside this folder called assembly, which I then set as the assembly for the binaries, as the tutorial asks. I click "Customize" and choose Xcode as the generator since I'm on a Mac. The problem is that when I try to set up a project, CMake gives me this error:

C compiler id unknown. CMake Error in CMakeLists.txt: 3 (project): CMAKE_C_COMPILER not found.

Incomplete configuration, errors occurred! See also "/Users/standard/Desktop/glfw-3.2.1/build/CMakeFiles/CMakeOutput.log".

See also "/Users/standard/Desktop/glfw-3.2.1/build/CMakeFiles/CMakeError.log".

I have already read this question, but as far as I understand, it does not have what I need: CMake Error at CMakeLists.txt: 30 (project): CMAKE_C_COMPILER could not be found

Thank.

+6
source share
7 answers

If you installed Xcode, try the following:

sudo xcode-select --reset
+32
source

Have you installed the Xcode and Xcode command line tools?

xcode-select --install

If you have Xcode command line tools installed, you should no longer receive an error message xcrun.

Cmake? , , Xcode Commandline Tools , Cmake . . , , .

, Xcode, hstdt :

sudo xcode-select --reset
+8

Xcode EULA, . :

sudo xcodebuild -license
+4

, CMake C/++, , . C/++ :

xcrun -find c++
xcrun -find cc

, , gui. , -

cmake -D CMAKE_C_COMPILER="/path/to/your/c/compiler/executable" -D CMAKE_CXX_COMPILER "/path/to/your/cpp/compiler/executable" .....
+3

, , Xcode 10 CMake. , CMake 2.2, (2.13) . Xcode 9, . ( ), CMake .

0

Xcode10/Cmake 3.12 Homebrew. sudo xcode-select --reset .

0

, ccache. ccache .

, ccache, CC CXX:

echo $CC
echo $CXX

- : ccache clang -Qunused-arguments -fcolor-diagnostics. (CC CXX .bashrc .zshrc.)

ccache, :

CC=clang
CXX=clang++

cmake:

cmake -G Xcode <path/to/CMakeLists.txt>

, CMake Xcode ccache, . .

0

Source: https://habr.com/ru/post/1665235/


All Articles