MantisBT - CMake
View Issue Details
0015228CMakeCMakepublic2014-10-29 17:322015-05-04 09:05
Remi 
Gilles Khouzam 
normalblockalways
closedfixed 
WindowsWindowsWindows 8.1
CMake 3.1 
CMake 3.1CMake 3.1 
0015228: Compiler identification fails with -DCMAKE_SYSTEM_NAME=WindowsStore
cmake version 3.1.0-rc1

I tried to generate a project with the command line below:

cmake -G "Visual Studio 12 2013" -DCMAKE_SYSTEM_NAME=WindowsStore -DCMAKE_SYSTEM_VERSION=8.0

and it fails with:

-- The C compiler identification is unknown
-- The CXX compiler identification is unknown
CMake Error at CMakeLists.txt:3 (project):
  No CMAKE_C_COMPILER could be found.



CMake Error at CMakeLists.txt:3 (project):
  No CMAKE_CXX_COMPILER could be found.



-- Configuring incomplete, errors occurred!
See also "[censored]/CMakeFiles/CMakeOutput.log".
See also "[censored]/CMakeFiles/CMakeError.log".

I checked the files to understand the error.

 C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\V120\Microsoft.Cpp.Platform.targets(64,5): error MSB8020: The build tools for Visual Studio 2012 (Platform Toolset = 'v110') cannot be found. To build using the v110 build tools, please install Visual Studio 2012 build tools. Alternatively, you may upgrade to the current Visual Studio tools by selecting the Project menu or right-click the solution, and then selecting "Upgrade Solution...".

I believe the error is that 'v110' in the project file should be 'v120'.
cmake -G "Visual Studio 12 2013" -DCMAKE_SYSTEM_NAME=WindowsStore -DCMAKE_SYSTEM_VERSION=8.0

Installed on my machine:
 VS Express 2013 for Desktop
 VS Express 2013 for Windows
Visual Studio 2013
patch 15228.patch (17,067) 2014-11-13 15:01
https://public.kitware.com/Bug/file/5298/15228.patch
patch 15228-2.patch (1,405) 2014-11-13 15:58
https://public.kitware.com/Bug/file/5299/15228-2.patch
bz2 cmake_obj_lib.tar.bz2 (521) 2014-11-15 04:50
https://public.kitware.com/Bug/file/5301/cmake_obj_lib.tar.bz2
patch 15228-3.patch (1,027) 2014-11-16 17:32
https://public.kitware.com/Bug/file/5302/15228-3.patch
Issue History
2014-10-29 17:32RemiNew Issue
2014-10-29 17:33RemiTag Attached: Visual Studio 2013
2014-10-29 19:00RemiNote Added: 0037106
2014-10-30 08:34Brad KingAssigned To => Gilles Khouzam
2014-10-30 08:34Brad KingStatusnew => assigned
2014-10-30 08:35Brad KingProduct Version => CMake 3.1
2014-10-30 08:35Brad KingTarget Version => CMake 3.2
2014-11-13 15:01Gilles KhouzamFile Added: 15228.patch
2014-11-13 15:04Gilles KhouzamNote Added: 0037209
2014-11-13 15:27Brad KingNote Added: 0037210
2014-11-13 15:58Gilles KhouzamFile Added: 15228-2.patch
2014-11-13 15:58Gilles KhouzamNote Added: 0037212
2014-11-13 16:04Brad KingNote Added: 0037214
2014-11-14 15:00Brad KingNote Added: 0037224
2014-11-14 19:34Gilles KhouzamNote Added: 0037226
2014-11-15 04:50RemiFile Added: cmake_obj_lib.tar.bz2
2014-11-15 04:55RemiNote Added: 0037227
2014-11-16 17:32Gilles KhouzamNote Added: 0037228
2014-11-16 17:32Gilles KhouzamFile Added: 15228-3.patch
2014-11-17 08:59Brad KingNote Added: 0037229
2014-12-01 14:29Brad KingNote Added: 0037338
2014-12-01 14:29Brad KingStatusassigned => resolved
2014-12-01 14:29Brad KingResolutionopen => fixed
2014-12-01 14:29Brad KingFixed in Version => CMake 3.1
2014-12-01 14:29Brad KingTarget VersionCMake 3.2 => CMake 3.1
2015-05-04 09:05Robert MaynardNote Added: 0038684
2015-05-04 09:05Robert MaynardStatusresolved => closed

Notes
(0037106)
Remi   
2014-10-29 19:00   
I now understand that I should use -DCMAKE_SYSTEM_VERSION=8.1 with Visual Studio 12, and -DCMAKE_SYSTEM_VERSION=8.0 does not work. Still I'd expect cmake to fail with an error message that is easier to understand.

Also, it seems that OBJECT libraries don't work. For every OBJECT library, I get an error message: error MSB3030: Could not copy the file [...].winmd because it was not found. I will investigate tomorrow. Maybe I should open another report for that problem.

In addition, the ALL_BUILD and ZERO_CHECK projects are marked as incompatible.
(0037209)
Gilles Khouzam   
2014-11-13 15:04   
I've attached the patch to help with this issue. CMake requires both the Desktop SDK and the platform SDK that you are targeting and this patch will try to make sure that the right SDKs are installed.

If you're missing an SDK, you will get an error message like the following one.

CMake Error at CMakeLists.txt:2 (project):
  A Windows Phone component with CMake requires both the Windows Desktop SDK
  as well as the Windows Phone '8.1' SDK. Please make sure that you have
  both installed

For the issue with the ALL_BUILD and ZERO_CHECK projects, the express editions can only target the projects that they are designed for (even if you have multiple of them installed). This is unfortunate and hopefully with the recent announcement that the new VS 2013 Free edition will be able to target all platforms this hopefully will make things easier.
(0037210)
Brad King   
2014-11-13 15:27   
Re 0015228:0037209: Thanks. I've applied the patch and merged for testing:

 VS: Improve error messages when compiler is not detected
 http://www.cmake.org/gitweb?p=cmake.git;a=commitdiff;h=1f601591 [^]
(0037212)
Gilles Khouzam   
2014-11-13 15:58   
Missed a detection case on VS2013.

Attached patch 2.

Now all tests pass.
(0037214)
Brad King   
2014-11-13 16:04   
Re 0015228:0037212: Thanks, I squashed that in:

 VS: Improve error messages when compiler is not detected
 http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=e8d1f0c6 [^]
(0037224)
Brad King   
2014-11-14 15:00   
Does having both the Desktop SDK and Platform SDK also solve the problem with OBJECT libraries reported in 0015228:0037106?
(0037226)
Gilles Khouzam   
2014-11-14 19:34   
The object libraries issue is most likely similar to something I saw with static libraries that would default to adding a WinMD file.

I'll try to get a repro unless Remi can provide one.
(0037227)
Remi   
2014-11-15 04:55   
Thanks for your efforts to fix this problem. I attached a minimal project that illustrates the problem with an object library. Visual Studio Express for Windows fails to compile the project generated by:
cmake -G "Visual Studio 12 2013" -DCMAKE_SYSTEM_NAME=WindowsStore -DCMAKE_SYSTEM_VERSION=8.1
with the MSB3030 error regarding a .winmd file. I did not apply any patch: this is with 3.1.0-rc1.
(0037228)
Gilles Khouzam   
2014-11-16 17:32   
Thanks Remi.

This is indeed what I thought it was. I've got a patch, for the object library issue. Since for Windows a object library is the same as a static library, we had a special clause to not produce windows metadata on static libraries, I added the same thing for object libraries.

Remi, you could change to a static library until the fix makes it through.
(0037229)
Brad King   
2014-11-17 08:59   
Re 0015228:0037228: Thanks. Patch applied here:

 VS: Do not produce WinMD file for OBJECT libraries
 http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=689cd0d4 [^]
(0037338)
Brad King   
2014-12-01 14:29   
Both fixes here have been merged to the 'release' branch in preparation for the next 3.1 release candidate.
(0038684)
Robert Maynard   
2015-05-04 09:05   
Closing resolved issues that have not been updated in more than 4 months.