MantisBT - CMake
View Issue Details
0011594CMakeCMakepublic2010-12-10 11:342011-01-12 07:57
Petr Petrov 
Brad King 
urgentmajoralways
closedfixed 
MSVC 2010Windows VistaWindows Vista
CMake 2.8.3 
CMake 2.8.4CMake 2.8.4 
0011594: Incorrect generator for VC2010
I have created a small Cmake\C++ project which shows this error\issue.

It is a simple Cmake project.

It contains 1 static C++ library and 1 executable C++ project, which uses the static library.

I am specifying to build these two projects into Release configuration.
But the static library is being built into DEBUG configuration also!

I have tried to reproduce this example for VC2008 generator - and it works fine - only Release version of binaries were created!

It causes problem in my big project build!

Any ideas?

Thank you very much,
Petr
1) Unpack the attached CMake project;
2) Generate solution and VC2010 project files into xxx\build folder by using VC2010 (32-bit) generator;
3) run "msbuild TestPetrPetrov.sln /m:1 /p:Configuration=Release /p:Platform=Win32" in xxx\build folder from command line
4) see in "xxx\build\Debug\" folder. Here are Lib1.lib and lib1.pdb!!! It is an error! I specified to compile only "RELEASE" configuration, *NOT* debug!
5) see in "xxx\build\Release\" folder. Here are Example1.exe and Lib1.lib. It is correct behavior.

P.S. Also I see messages that DEBUG version of Lib1 is being built:

Lib:
  C:\Program Files\Microsoft Visual Studio 10.0\VC\bin\Lib.exe /OUT:"D:\cmake_test3\build\Debug\Lib1.lib" /NOLOGO Lib1.
  dir\Debug\lib.obj
  Lib1.vcxproj -> D:\cmake_test3\build\Debug\Lib1.lib
No tags attached.
related to 0011633closed Brad King Incorrect generator for VC2008 
zip cmake_test_petr_petrov.zip (891) 2010-12-10 11:34
https://public.kitware.com/Bug/file/3563/cmake_test_petr_petrov.zip
zip cmake-issue-11594-min.zip (4,880) 2010-12-10 14:05
https://public.kitware.com/Bug/file/3564/cmake-issue-11594-min.zip
Issue History
2010-12-10 11:34Petr PetrovNew Issue
2010-12-10 11:34Petr PetrovFile Added: cmake_test_petr_petrov.zip
2010-12-10 14:04Brad KingAssigned To => Brad King
2010-12-10 14:04Brad KingStatusnew => assigned
2010-12-10 14:05Brad KingFile Added: cmake-issue-11594-min.zip
2010-12-10 14:08Brad KingNote Added: 0023882
2010-12-10 16:39Brad KingNote Added: 0023890
2010-12-10 16:39Brad KingStatusassigned => closed
2010-12-10 16:39Brad KingResolutionopen => fixed
2010-12-20 11:13Brad KingRelationship addedrelated to 0011633
2010-12-20 11:35Brad KingNote Added: 0024284
2010-12-20 11:35Brad KingStatusclosed => feedback
2010-12-20 11:35Brad KingResolutionfixed => reopened
2010-12-20 12:43Brad KingNote Added: 0024287
2010-12-20 12:43Brad KingStatusfeedback => closed
2010-12-20 12:43Brad KingResolutionreopened => fixed
2011-01-12 07:57David ColeFixed in Version => CMake 2.8.4
2011-01-12 07:57David ColeTarget Version => CMake 2.8.4

Notes
(0023882)
Brad King   
2010-12-10 14:08   
Wow, that is really strange. I reproduced it independently from CMake (just msbuild) in the file "cmake-issue-11594-min.zip". A diff between "bug.sln" and "fix.sln" reveals a subtle change. The broken version refers to

  ".\bug_lib.vcxproj"

while the fixed version refers to

  "bug_lib.vcxproj"

I also tested more complicated examples where the library is in a subdirectory. Again, a difference between ".\sub\bug_lib.vcxproj" and "sub\bug_lib.vcxproj" is the difference between broken and working.

Clearly this is a subtle msbuild idiosyncrasy that we'll have to work around.
(0023890)
Brad King   
2010-12-10 16:39   
Fixed:

  http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=57e71533 [^]
(0024284)
Brad King   
2010-12-20 11:35   
Issue 0011633 reports that this fix works for VS 2010 but breaks VS 2008 and below.

Building through "devenv" works in both cases so this did not show up in our nightly testing.
(0024287)
Brad King   
2010-12-20 12:43   
Fixed in a new way that does not trigger issue 0011633:

http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=e1442ac9 [^]