MantisBT - CMake
View Issue Details
0014378CMakeCMakepublic2013-08-27 10:582014-04-24 13:26
Mateusz Loskot 
Brad King 
normalminoralways
closedfixed 
Windows 64-bitMicrosoft Windows 7 Professional6.1
CMake 2.8.11.2 
CMake 3.0CMake 3.0 
0014378: ZERO_CHECK.vcxproj referenced despite CMAKE_SUPPRESS_REGENERATION set to FALSE
I have a collection of predefined .vcxproj files and I use CMake to generate .sln file gathering all the projects.

In my CMakeLists.txt I set CMAKE_SUPPRESS_REGENERATION to FALSE to prevent generating of ZERO_CHECK.vcxproj, but GUID of the ZERO_CHECK is still referenced.

It is, the generated .sln file still gets this postProject section generated

Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "cmake_test", "cmake_test.vcxproj", "{A4C50E61-87B4-44A9-975E-CDC1649CB0DC}"
    ProjectSection(ProjectDependencies) = postProject
        {AB7E8FC6-757B-400A-AC2A-E4192A4C124E} = {AB7E8FC6-757B-400A-AC2A-E4192A4C124E}
    EndProjectSection
EndProject


where cmake_test is predefiend (not generated) project and AB7E8FC6-757B-400A-AC2A-E4192A4C124E is GUID of non-existent ZERO_CHECK project.
1. Create "Win32 Console Application" using VS IDE (name used below: cmake_test)

2. Create CMakeLists.txt file:

cmake_minimum_required(VERSION 2.8)
project(cmake_test_gen NONE)
set(CMAKE_SUPPRESS_REGENERATION TRUE)
include_external_msproject(cmake_test cmake_test.vcxproj)

3. Try to build using the generated .sln file:

> msbuild cmake_test_gen.sln
Microsoft (R) Build Engine version 4.0.30319.17929
[Microsoft .NET Framework, version 4.0.30319.18052]
Copyright (C) Microsoft Corporation. All rights reserved.

Building the projects in this solution one at a time. To enable parallel build, please add the "/m" switch.
Build started 27/08/2013 15:46:41.
D:\tmp\cmake_test\cmake_test_gen.sln : Solution file error MSB4051: Project {A4C50E61-87B4-44A9-975E-CDC1649CB0DC} is referencing
 a project with GUID {AB7E8FC6-757B-400A-AC2A-E4192A4C124E}, but a project with this GUID was not found in the .SLN file.

Build FAILED.

  D:\tmp\cmake_test\cmake_test_gen.sln : Solution file error MSB4051: Project {A4C50E61-87B4-44A9-975E-CDC1649CB0DC} is referenci
ng a project with GUID {AB7E8FC6-757B-400A-AC2A-E4192A4C124E}, but a project with this GUID was not found in the .SLN file.

    0 Warning(s)
    1 Error(s)

Time Elapsed 00:00:00.02
    
D:\tmp\cmake_test>


4. Remove set(CMAKE_SUPPRESS_REGENERATION TRUE) from CMakeLists.txt

5. Re-generate the .sln file and re-build

cmake .
msbuild cmake_test_gen.sln


Observe the build in step 5 succeeds.
I use Visual Studio 2012.
No tags attached.
has duplicate 0014482closed  Dependency on missing ZERO_CHECK target 
related to 0014897closed  Wrong reference of ZERO_CHECK.vcxproj if project is included with INCLUDE_EXTERNAL_MSPROJECT(...) 
patch v2.8.11.2+0001-VS-Fix-CMAKE_SUPPRESS_REGENERATION-bad-ZERO_CHECK-de.patch (3,166) 2013-08-27 14:21
https://public.kitware.com/Bug/file/4860/v2.8.11.2%2B0001-VS-Fix-CMAKE_SUPPRESS_REGENERATION-bad-ZERO_CHECK-de.patch
log cmake_test_patched.log (2,884) 2013-08-28 04:33
https://public.kitware.com/Bug/file/4861/cmake_test_patched.log
Issue History
2013-08-27 10:58Mateusz LoskotNew Issue
2013-08-27 14:21Brad KingFile Added: v2.8.11.2+0001-VS-Fix-CMAKE_SUPPRESS_REGENERATION-bad-ZERO_CHECK-de.patch
2013-08-27 14:22Brad KingNote Added: 0033750
2013-08-27 14:22Brad KingAssigned To => Brad King
2013-08-27 14:22Brad KingStatusnew => assigned
2013-08-27 14:22Brad KingTarget Version => CMake 3.0
2013-08-28 04:33Mateusz LoskotFile Added: cmake_test_patched.log
2013-08-28 04:41Mateusz LoskotNote Added: 0033753
2013-08-28 04:42Mateusz LoskotNote Edited: 0033753bug_revision_view_page.php?bugnote_id=33753#r1247
2013-08-28 09:01Brad KingNote Added: 0033754
2013-08-28 09:01Brad KingStatusassigned => resolved
2013-08-28 09:01Brad KingResolutionopen => fixed
2013-08-28 09:01Brad KingFixed in Version => CMake 3.0
2013-10-15 09:05Brad KingRelationship addedhas duplicate 0014482
2014-03-05 09:58Robert MaynardNote Added: 0035281
2014-03-05 09:58Robert MaynardStatusresolved => closed
2014-04-24 13:26Brad KingRelationship addedrelated to 0014897

Notes
(0033750)
Brad King   
2013-08-27 14:22   
Please try attached v2.8.11.2+0001-VS-Fix-CMAKE_SUPPRESS_REGENERATION-bad-ZERO_CHECK-de.patch on top of 2.8.11.2.
(0033753)
Mateusz Loskot   
2013-08-28 04:41   
(edited on: 2013-08-28 04:42)
Brad,

I've applied your patch to my clone of https://github.com/Kitware/CMake [^]

-----
commit 5b773669289fe9467dd7385686d12d1996038628
Author: Brad King <brad.king@kitware.com>
Date: Tue Aug 27 14:15:49 2013 -0400

    VS: Fix CMAKE_SUPPRESS_REGENERATION bad ZERO_CHECK dependency (0014378)

    When CMAKE_SUPPRESS_REGENERATION tells us not to create the ZERO_CHECK
    target we should not add dependencies on it from other targets either.

    Signed-off-by: Mateusz Loskot <mateusz@loskot.net>
-----

Then, I built CMake 32-bit binaries using VS2012 on Windows 7 64-bit.

I can confirm the patched cmake.exe works for me, see attached cmake_test_patched.log for complete log.

Thanks!

(0033754)
Brad King   
2013-08-28 09:01   
Great, thanks for testing. Applied:

http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=e478f034 [^]
(0035281)
Robert Maynard   
2014-03-05 09:58   
Closing resolved issues that have not been updated in more than 4 months