[cmake-developers] [CMake 0015640]: CMake converts generator from Visual Studio 9 2008 to Visual Studio 10 2010 if ZERO_CHECK fails

Mantis Bug Tracker mantis at public.kitware.com
Tue Jul 7 11:04:29 EDT 2015


The following issue has been SUBMITTED. 
====================================================================== 
http://public.kitware.com/Bug/view.php?id=15640 
====================================================================== 
Reported By:                James Johnston
Assigned To:                
====================================================================== 
Project:                    CMake
Issue ID:                   15640
Category:                   CMake
Reproducibility:            always
Severity:                   major
Priority:                   normal
Status:                     new
====================================================================== 
Date Submitted:             2015-07-07 11:04 EDT
Last Modified:              2015-07-07 11:04 EDT
====================================================================== 
Summary:                    CMake converts generator from Visual Studio 9 2008
to Visual Studio 10 2010 if ZERO_CHECK fails
Description: 
When using CMake with the Visual Studio 9 2008 generator, if the ZERO_CHECK
"project" fails (e.g. due to a FATAL_ERROR or whatever in the CMakeLists.txt
file), the entire CMake project is converted to Visual Studio 10 2010!

Since the build tree is now in who-knows-what corrupted state, I have no choice
but to delete the whole build tree and start over.  It's quite time-consuming.

The issue doesn't seem to be easily reproduced outside of the ZERO_CHECK project
- e.g. I couldn't figure out how to reproduce it with cmake-gui.exe or
cmake.exe.

Steps to Reproduce: 
1.  Make a new source tree with the following CMakeLists.txt file:

cmake_minimum_required(VERSION 3.3.0 FATAL_ERROR)
project(TestProject)
#message(FATAL_ERROR "Error")

2.  Create empty build tree directory as normal, cd to it, and run:

cmake "-GVisual Studio 9 2008" <path to source tree>

3.  Open the generated Visual Studio solution in Visual C++ 2008.  (I used
Express version).

4.  Edit the CMakeLists.txt and remove the comment on "message" so that the
CMake configure will fail now.

5.  Build the ZERO_CHECK project; note that it fails as expected.

6.  Remark out the "message" from CMakeLists.txt so that CMake once again will
configure ok.

7.  Build the ZERO_CHECK project again.  This time, ZERO_CHECK will convert
everything over to Visual Studio 2010:
 * The CMake output shown in Visual Studio "Output" pane says "Building for
Visual Studio 10 2010".
 * The CMakeCache.txt holds: CMAKE_GENERATOR:INTERNAL=Visual Studio 10 2010
 * Visual Studio 2008 refuses to reload the solution ("created by a newer
version of this application and cannot be opened")
 * Examination of the build tree shows a VS2010 solution and VCPROJ/VCXPROJ
files side-by-side...

Additional Information: 
The problem has been successfully reproduced with both CMake 3.3.0-rc1 and the
nightly cmake-3.3.20150706-g32b76-win32-x86 build.
====================================================================== 

Issue History 
Date Modified    Username       Field                    Change               
====================================================================== 
2015-07-07 11:04 James Johnston New Issue                                    
======================================================================



More information about the cmake-developers mailing list