View Issue Details Jump to Notes ] Print ]
IDProjectCategoryView StatusDate SubmittedLast Update
0012095CMakeModulespublic2011-04-15 18:092012-10-04 01:56
ReporterDoug Barbieri 
Assigned ToPhilip Lowman 
PrioritynormalSeverityminorReproducibilityalways
StatusclosedResolutionfixed 
PlatformMicrosoftOSWindowsOS VersionXP+
Product VersionCMake 2.8.4 
Target VersionFixed in Version 
Summary0012095: DetermineVSServicePack() does not properly sense service pack for vc100
DescriptionDuring configuration, the function DetermineVSServicePack() does not properly sense the presence of vc100 (Visual Studio 2010) service pack 1. This is because the try_compile() CMake builtin runs "cl.exe" with the "/nologo" flag turned on. This completely suppresses the version of the compiler in the output.

I wrote work around code so I could manually test the output:
   file(WRITE "${CMAKE_BINARY_DIR}/return0.cc"
      "int main() { return 0; }\n")
   execute_process( COMMAND cl.exe return0.cc
      OUTPUT_VARIABLE _output
      ERROR_VARIABLE _error
      WORKING_DIRECTORY ${CMAKE_BINARY_DIR}
      )
   file( REMOVE "${CMAKE_BINARY_DIR}/return0.cc" )
   string(REGEX MATCH "Compiler Version [0-9]+.[0-9]+.[0-9]+.[0-9]+ for"
      _cl_version "${_error}")

This works, but notice that there is an inconsistency between the command line compiler (cl.exe) and the linker (linker.exe). The compiler outputs the version string to stderr:

Microsoft (R) 32-bit C/C++ Optimizing Compiler Version 16.00.40219.01 for 80x86
Copyright (C) Microsoft Corporation. All rights reserved.

...and the linker outputs to stdout:
Microsoft (R) Incremental Linker Version 10.00.40219.01
Copyright (C) Microsoft Corporation. All rights reserved.

I didn't test earlier versions of the compiler to see if this was the case, but there you go. You have to REGEX from stderr, not stdout in order to see the version string.

Also, in the _DetermineVSServicePackFromCompiler() internal function, it tries to match against "16.00.30319.01" instead of what vc100sp1 reports: "16.00.40219.01". And when it finds the match, the _version string is set to "vc100", not "vc100sp1".

The way to solve this problem would be, I think, allow try_compile() to have an option where the "/nologo" is suppressed for certain cases. Or use execute_process() in the special case of vc100 (not preferable, I realize).
Steps To ReproduceUnder Microsoft Windows (XP+), Install Visual Studio C++ 2010 (vc100) Service Pack 1.

Create a very simple CMakeLists.txt file. Call DetermineVSServicePack( var ). Notice that var remains unset after the call.
TagsNo tags attached.
Attached Files

 Relationships

  Notes
(0031175)
Philip Lowman (developer)
2012-10-04 01:56

I suspect this was resolved by the commit on 2011-06-15.
 
http://cmake.org/gitweb?p=cmake.git;a=history;f=Modules/CMakeDetermineVSServicePack.cmake;h=98e5bb8734deac343a9c6b7a09dd9f5ac37aaea7;hb=HEAD [^]

If this is still not working please reopen this issue.

 Issue History
Date Modified Username Field Change
2011-04-15 18:09 Doug Barbieri New Issue
2012-02-11 11:21 Rolf Eike Beer Assigned To => Philip Lowman
2012-02-11 11:21 Rolf Eike Beer Status new => assigned
2012-02-11 11:21 Rolf Eike Beer Category CMake => Modules
2012-10-04 01:56 Philip Lowman Note Added: 0031175
2012-10-04 01:56 Philip Lowman Status assigned => closed
2012-10-04 01:56 Philip Lowman Resolution open => fixed


Copyright © 2000 - 2018 MantisBT Team