Problem with building project by CMake I have installed gcc and g++ instead of clang compilers from Xcode, so now I have problem with compiling with cmake. After running cmake I have got error:

-- The C compiler identification is unknown
-- The CXX compiler identification is unknown
-- Check for working C compiler: /usr/bin/gcc
-- Check for working C compiler: /usr/bin/gcc -- broken
CMake Error at /usr/local/Cellar/cmake/3.15.3/share/cmake/Modules/CMakeTestCCompiler.cmake:60 (message):
  The C compiler

    "/usr/bin/gcc"

  is not able to compile a simple test program.

  It fails with the following output:

    Change Dir: /Users/yuriy/Projects/SublimeProjects/AgingAlgorithm/build/CMakeFiles/CMakeTmp

    Run Build Command(s):/usr/bin/make cmTC_d5a2e/fast &amp;&amp; xcrun: error: active developer path ("/Applications/Xcode.app/Contents/Developer") does not exist
    Use `sudo xcode-select --switch path/to/Xcode.app` to specify the Xcode that you wish to use for command line developer tools, or use `xcode-select --install` to install the standalone command line developer tools.
    See `man xcode-select` for more details.





  CMake will not be able to correctly generate this project.
Call Stack (most recent call first):
  CMakeLists.txt:6 (project)


-- Configuring incomplete, errors occurred!
See also "/Users/yuriy/Projects/SublimeProjects/AgingAlgorithm/build/CMakeFiles/CMakeOutput.log".
See also "/Users/yuriy/Projects/SublimeProjects/AgingAlgorithm/build/CMakeFiles/CMakeError.log".


Problem have been appeared after deleting clang compilers and Xcode and changing links cc, c++, gcc and g++.
In terminal macOS can run utilities gcc, cc, g++, c++, but it still doesn't work for cmake.

Can I fix it without installation of basic clang compilers from Xcode? If I can, so how?
Assuming you installed gcc using brew, run brew info gcc. Find the path similar to /usr/local/Cellar/gcc/9.2.0. Go the that directory and find gcc file in bin. Copy the path name and paste it in Cmake (assuming GUI) as follows.

After cleaning cache in File -> Delete cache, start afresh in Tools -> Configure. Specify "Unix Makefiles" instead of Xcode and select "Specify native compilers."



In the compilers for C and C++, copy the full path found above. Similar to /usr/local/Cellar/gcc/9.2.0/bin/gcc-9. 



And then try configuring. And update me with the log afterwards.