Using CMake Xcode Generator: No CMAKE_C_COMPILER could be found.
Hi,
I have been using XCode for some time and wanted to give CLion a Go.
So I tested building the project I am working on, and everything goes alright.
But as soon as I try to use the XCode generator using the CMake argument "-G Xcode" (I set in inside the "CMake options")
I run into issues:
-- The C compiler identification is AppleClang 12.0.0.12000032
-- The CXX compiler identification is AppleClang 12.0.0.12000032
CMake Error at CMakeLists.txt:
No CMAKE_C_COMPILER could be found.
CMake Error at CMakeLists.txt:
No CMAKE_CXX_COMPILER could be found.
More information, using the parameter with the command line is working fine.
Is there a demo project to test the CMake Xcode Generate that is proven to be working with CLion that I could test on my side to detect any issues in my configuration?
I am using the Default Toolchain :
I am using the latest version of CLion: 2020.3
macOS 10.15.7
DrX
EDIT: if I setup C and CXX paths manually into the "CMakeLists.txt" the build process goes a bit further:
By adding to the "CMakeLists.txt":
set(CMAKE_C_COMPILER "/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/cc")
set(CMAKE_CXX_COMPILER "/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/c++")
Then later in the build process the same errors "No CMAKE_C_COMPILER could be found."/"No CMAKE_CXX_COMPILER could be found." pop out.
So I am thinking since the complete build is working with the command line, is this issue related to the Environment variable and maybe the interactive shall I am using.
As said before I am running macOS, and I was using bash, but since an apple system update, the default interactive shell is no longer bash due to license it is now replaced by default by zsh.
I haven't updated my default interactive shell to zsh yet. Is Clion using user default interactive shell environment variables?
The message that the terminal output at launch:
The default interactive shell is now zsh.
To update your account to use zsh, please run `chsh -s /bin/zsh`.
For more details, please visit https://support.apple.com/kb/HT208050.
请先登录再写评论。
Hello!
Please see https://stackoverflow.com/a/17980786/11988753. Executing "sudo xcode-select -s /Applications/Xcode.app/Contents/Developer" and reloading the project (Tools | CMake | Reset Cache and Reload Project) should help.
Hi Anna Falevskaya,
thanks for the help but this apparently wasn't the issue, for the moment I am building without the XCode Generator but this exact issue is what currently is refraining me to say goodbye to XCode and fully embrace CLion, I can't understand this issue. Do you have any other ideas?
the xcode-select path is correctly setup:
$ xcode-select -p
/Applications/Xcode.app/Contents/Developer
Thanks in advance,
Cheers,
DrX
I get the same errors in Terminal:
So the issue seems to be related to CMake + Xcode generator, not to CLion.
Yes, I indeed come across the same conclusion, but the "problem" is that the current highest version of cmake compatible with Clion is the 3.17.5 when using cmake from the command line with a newer version like the 3.19.2 the "-G Xcode" option do work fine on my side, have you tested?
Will the Clion bundled version of cmake be updated soon? If yes, to which version?
Thanks for your time, if you have a workaround to use another version of cmake from within CLion I would be interested. (I understand that I could call from the terminal inside Clion but, would prefer to be using the integrated Toolchains configurations etc.)
Cheers,
DrX
CMake 3.19 will be bundled in CLion 2021.1 EAP builds - https://youtrack.jetbrains.com/issue/CPP-23091.
So far you can try specifying your custom CMake in the toolchain settings (https://www.jetbrains.com/help/clion/quick-tutorial-on-configuring-clion-on-macos.html#toolchain-1-chapter) and ignore the warning, it still might work.
Great, but, the warning message stoped me, I wanted the things to be working "sure" and "as expected" like when using the command line, I really want to use Clion to reduce problems and rely on a simplified workflow and not add a layer of "might work" in it, it seemed to be counter intuitive in my point of view to use "unsupported" version of cmake within Clion.
All in all the 2021.1 version will be my go to (I already bought a year of subscription to Clion ;-) ), is there an approximate release date already known?
Thanks for the good work.
Cheers,
DrX
The first CLion 2021.1 EAP build is scheduled for late January - early February.
The CLion 2021.1 stable release is scheduled for late March - early April.
You can subscribe to our blog https://blog.jetbrains.com/clion/ to get notified when the 2021.1 Early Access Program starts.
Thanks Anna Falevskaya, will wait till April then, have a good day. Cheers