问题
I am running into the problem of easily switching between Debug and Release builds of my projects in CLion. After looking around, I found that in 2016, the system was changed and many users ran into trouble. However, none of the fixes that were suggested helped me.
Under Settings / Cmake, I entered two profiles, Release and Debug. However, in both the configuration selection at the top right of the editor and the context selection at the bottom right of the editor, only the first of the two profiles is available.
Also, the first profile seems to work fine with CMake, whereas for the second one I get an error message:
Cannot generate 'Debug' into /home/foo/code/cmake-build-debug
CMakeCache.txt is found in the project dir, only in-source generation will be performed.
[Failed to reload]
回答1:
!! please backup your project before applying my instructions !!
I have got the same problem after adding new target to the CMakeLists.txt
To solve this error:
Cannot generate 'Release' into .....
<path>..... CMakeCache.txt is found in the project dir, only in-source generation will be performed.
I delete folders cmake-build-* and CMakeCache.txt
After it I have got next error (or something like this):
Error cmake cache
To solve this error I just restart the clion.
Also sometimes I press File -> Reload CMake Project, but visually nothing happends.
As result I have got workable project.
来源:https://stackoverflow.com/questions/49656740/clion-contexts-and-cmakecache