[cmake-developers] [CMake 0012095]: DetermineVSServicePack() does not properly sense service pack for vc100
Mantis Bug Tracker
mantis at public.kitware.com
Fri Apr 15 18:09:45 EDT 2011
The following issue has been SUBMITTED.
======================================================================
http://public.kitware.com/Bug/view.php?id=12095
======================================================================
Reported By: Doug Barbieri
Assigned To:
======================================================================
Project: CMake
Issue ID: 12095
Category: CMake
Reproducibility: always
Severity: minor
Priority: normal
Status: new
======================================================================
Date Submitted: 2011-04-15 18:09 EDT
Last Modified: 2011-04-15 18:09 EDT
======================================================================
Summary: DetermineVSServicePack() does not properly sense
service pack for vc100
Description:
During 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 Reproduce:
Under 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.
======================================================================
Issue History
Date Modified Username Field Change
======================================================================
2011-04-15 18:09 Doug Barbieri New Issue
======================================================================
More information about the cmake-developers
mailing list