The CXX compiler identification is unknown: xcode
I had the same problem, but I solved it with:
sudo xcode-select --reset
Before doing the above, xcode-select -p
reported the path was /Library/Developer/CommandLineTools
.
After the reset, the path was /Applications/Xcode.app/Contents/Developer
.
The error you have with the SDK can usually be solved by clearing the CMake build cache and adding the following to your CMakeLists.txt
before project():
SET(MACOSX_DEPLOYMENT_TARGET ${DARWIN_MAJOR_SDK_VERSION}.${DARWIN_MINOR_SDK_VERSION})
SET(CMAKE_CXX_FLAGS "--sysroot ${CMAKE_OSX_SYSROOT} ${CMAKE_CXX_FLAGS}")
MESSAGE("Setting MACOSX_DEPLOYMENT_TARGET to '${MACOSX_DEPLOYMENT_TARGET}'.")
If you find that doesn't solve the issue then you should check the version of Xcode is current and has the SDK installed you are specifying. Generally Homebrew and Macports CMake both should have the latest stable build of Xcode installed.
↳ https://github.com/Homebrew/homebrew/issues/23074
I had the same output and could solve it by agreeing to the apple license.
sudo xcodebuild -license accept