MantisBT - CMake
View Issue Details
0015986CMakeCMakepublic2016-02-24 11:242016-06-10 14:21
Gregor Jasny 
Brad King 
highmajoralways
closedfixed 
CMake 3.5 
CMake 3.5CMake 3.5 
0015986: Visual Studio 2015 does not work with v120 toolset
Hello,

today I tried to use Visual Studio 2015 to build with the VS2013 (v120) toolset.

Unfortunately I get the following error:

-- The C compiler identification is MSVC 18.0.40629.0
-- The CXX compiler identification is MSVC 18.0.40629.0
-- Check for working C compiler using: Visual Studio 14 2015
-- Check for working C compiler using: Visual Studio 14 2015 -- broken
CMake Error at C:/Program Files (x86)/CMake/share/cmake-3.5/Modules/CMakeTestCCompiler.cmake:61 (message):
  The C compiler "C:/Program Files (x86)/Microsoft Visual Studio
  12.0/VC/bin/cl.exe" is not able to compile a simple test program.

It properly works in the "same" toolchain pairing:
-G "Visual Studio 12 2013" -T v120
-G "Visual Studio 14 2015" -T v140

Thanks,
Gregor
CMakeLists.txt containing just:
  project(VS2015Test C CXX)

Configure:
"c:\Program Files (x86)\CMake\bin\cmake.exe" -G "Visual Studio 14 2015" -T v120 ..

C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\V120\Microsoft.CppCommon.targets(639,9): error MSB4030: "Debug" is an invalid value for the "GenerateDebugInformation" parameter of the "Link" task. The "GenerateDebugInformation" parameter is of type "System.Boolean". [C:\Users\gregorj\devtrees\vs2015test\_build\CMakeFiles\CMakeTmp\cmTC_05d1a.vcxproj]
No tags attached.
related to 0015894closed Brad King Visual C++ 2015 Generator wrong output for debug information 
log CMakeError.log (3,141) 2016-02-24 11:24
https://public.kitware.com/Bug/file/5632/CMakeError.log
Issue History
2016-02-24 11:24Gregor JasnyNew Issue
2016-02-24 11:24Gregor JasnyFile Added: CMakeError.log
2016-02-24 11:30Gregor JasnyRelationship addedrelated to 0015894
2016-02-24 11:35Brad KingNote Added: 0040533
2016-02-24 11:36Brad KingTarget Version => CMake 3.5
2016-02-24 12:36Brad KingNote Added: 0040534
2016-02-24 12:49Brad KingNote Added: 0040535
2016-02-24 12:49Brad KingAssigned To => Brad King
2016-02-24 12:49Brad KingStatusnew => resolved
2016-02-24 12:49Brad KingResolutionopen => fixed
2016-02-24 12:49Brad KingFixed in Version => CMake 3.5
2016-02-25 03:34Gregor JasnyNote Added: 0040545
2016-02-25 04:37Gregor JasnyNote Added: 0040547
2016-02-25 08:52Brad KingNote Added: 0040548
2016-03-04 10:50PaulwNote Added: 0040597
2016-03-07 10:33Brad KingNote Added: 0040635
2016-03-08 08:42Brad KingNote Added: 0040647
2016-06-10 14:21Kitware RobotNote Added: 0041232
2016-06-10 14:21Kitware RobotStatusresolved => closed

Notes
(0040533)
Brad King   
2016-02-24 11:35   
Yes, the change linked in 0015894:0040163:

 VS: Fix VS 2015 .vcxproj file value for GenerateDebugInformation
 https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=f086c665 [^]

appears to be responsible for this. It seems that the proper choice depends on the toolset rather than the version of VS. Unfortunately this may mean we now have to memorize information about each toolset value.
(0040534)
Brad King   
2016-02-24 12:36   
Here is a hack to fix this particular use case:

 VS: Fix VS 2015 .vcxproj debug setting for older toolsets
 https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=dc422d27 [^]

More work will be needed to fix this properly by making flag map selection be based on the toolset.
(0040535)
Brad King   
2016-02-24 12:49   
I've queued this for merge to 'release' for inclusion in 3.5. Meanwhile place check that the fix linked in 0015986:0040534 works. It should be included in the next nightly binary to appear:

 https://cmake.org/files/dev/?C=M;O=D [^]
(0040545)
Gregor Jasny   
2016-02-25 03:34   
Seems the nightly Windows build fails since February 22nd.
(0040547)
Gregor Jasny   
2016-02-25 04:37   
The fix seems to work properly:
C:\Users\gregorj\devtrees\vs2015test\_bp>c:\Users\gregorj\devtrees\cmake\_build\bin\Debug\cmake.exe 
-G "Visual Studio 14 2015" -T v120 ..
-- The C compiler identification is MSVC 18.0.40629.0
-- The CXX compiler identification is MSVC 18.0.40629.0
-- Check for working C compiler using: Visual Studio 14 2015
-- Check for working C compiler using: Visual Studio 14 2015 -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working CXX compiler using: Visual Studio 14 2015
-- Check for working CXX compiler using: Visual Studio 14 2015 -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- C compiler C:/Program Files (x86)/Microsoft Visual Studio 12.0/VC/bin/cl.exe
-- C++ compiler C:/Program Files (x86)/Microsoft Visual Studio 12.0/VC/bin/cl.exe
-- Configuring done
-- Generating done
-- Build files have been written to: C:/Users/gregorj/devtrees/vs2015test/_bp


But I find the "Check for working C compiler using: Visual Studio 14 2015" line confusing. Maybe you could add the used toolset in brackets behind.
(0040548)
Brad King   
2016-02-25 08:52   
Re 0015986:0040547: Great, thanks for testing.

> But I find the "Check for working C compiler using: Visual Studio 14 2015" line confusing. Maybe you could add the used toolset in brackets behind.

That is historical behavior left from when we didn't detect the full path to the compiler on VS generators and VS only had one compiler per version. Updated:

 Improve compiler check message on non-Make generators
 https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=f3ac0651 [^]
(0040597)
Paulw   
2016-03-04 10:50   
Same issue with the vs 2010 (v100) toolset. Can you please add it you your hack (I saw only v110 and v120 in your code). Also, note that Microsoft has the same problem so it may be worth talking to them. If I have a solution compiled in 2015 and I switch the toolset to 2010 using the VS GUI, it puts an invalid value in the linker DEBUG option, so build fails with exactly the same notification as when CMAKE tries to build with 2010. Maybe the final fix should reside in Visual Studio??
(0040635)
Brad King   
2016-03-07 10:33   
Re 0015986:0040597: Thanks. I extended the fix for v100:

 VS: Fix VS 2015 .vcxproj debug setting for v100 toolset
 https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=3f15665a [^]
(0040647)
Brad King   
2016-03-08 08:42   
Combined fix backported to 'release' branch:

 VS: Fix VS 2015 .vcxproj debug setting for older toolsets
 https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=3aa6fea6 [^]
(0041232)
Kitware Robot   
2016-06-10 14:21   
This issue tracker is no longer used. Further discussion of this issue may take place in the current CMake Issues page linked in the banner at the top of this page.