VS: CMake generated solution/projects files always get modified
After genereating a solution/projects via cmake-gui and working on it inside VSC2019(16.9.6), it always complaints "Solution has been modified outside of the environment". After reloads the solution/projects, we will find out a bad projects settings.
My environment:
- Windows 10 x64, either 2020H2 or 2021H1
- Visual Studion Community 2019 (16.9.5/6)
- CMake 3.19.3 / 3.20.2
Here are steps to reproduce it:
- Opens "cmake" and configures/generates the VSC solution/projects(P1). Here are the cmake file(CMakeLists.txt).
- Opens the solution in Visual Studio Community 2019
- Edits some src files and builds the solution, waits.
- Visual Studion will complains solution modified outside of then environment.
- After reloads the solution/projects, we will find out that the solution does changed and we lose other configurations(Only 'Debug' remained, in previous cmake V3.19.3, I even notice a bad configuration name ' Release')
Here are two unexpected behaviors:
- Solution files should not be regenerated if we don't modify the CMakefile.txt
- Regenerated solution/projects files should not be changed(Only 'Debug' configuration left).
I am not sure whether the werid Visual Studio configuration name (" Release" with a space before it) is an 3rd issue because it not reproduces after updated to 3.20.2.
Here are ProcMon snapshot that confirms the solution file() is updated by cmake. After removing the ALL_BUILD/ZERO_CHECK projects and overriding the solution file, Visual Studion will stop complaining.
Edited by Brad King