VS2019 generator fails in vcvarsall amd64_x86 environment
After switching from VS 2017 to VS 2019 generator CMake cannot determine compiler ID while configuring 32-bit app.
Logs from Appveyor using Visual Studio 2019 image with CMake 3.15.5
**********************************************************************
** Visual Studio 2019 Developer Command Prompt v16.3.8
** Copyright (c) 2019 Microsoft Corporation
**********************************************************************
[vcvarsall.bat] Environment initialized for: 'x64_x86'
cmake -T v142,host=x64 -G "Visual Studio 16 2019" -A Win32 ..
CMake Error at CMakeLists.txt:41 (project):
Failed to run MSBuild command:
C:/Program Files (x86)/Microsoft Visual Studio/2019/Community/MSBuild/Current/Bin/MSBuild.exe
to get the value of VCTargetsPath:
Microsoft (R) Build Engine version 16.3.2+e481bbf88 for .NET Framework
Copyright (C) Microsoft Corporation. All rights reserved.
Build started 11/10/2019 8:07:58 PM.
Project "C:\projects\m\build\CMakeFiles\3.15.5\VCTargetsPath.vcxproj" on node 1 (default targets).
C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\MSBuild\Microsoft\VC\v160\Microsoft.CppBuild.targets(376,5): error MSB8013: This project doesn't contain the Configuration and Platform combination of Debug|Win32. [C:\projects\m\build\CMakeFiles\3.15.5\VCTargetsPath.vcxproj]
Done Building Project "C:\projects\m\build\CMakeFiles\3.15.5\VCTargetsPath.vcxproj" (default targets) -- FAILED.
Build FAILED.
"C:\projects\m\build\CMakeFiles\3.15.5\VCTargetsPath.vcxproj" (default target) (1) ->
(PrepareForBuild target) ->
C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\MSBuild\Microsoft\VC\v160\Microsoft.CppBuild.targets(376,5): error MSB8013: This project doesn't contain the Configuration and Platform combination of Debug|Win32. [C:\projects\m\build\CMakeFiles\3.15.5\VCTargetsPath.vcxproj]
0 Warning(s)
1 Error(s)
Time Elapsed 00:00:00.64
Exit code: 1
-- Configuring incomplete, errors occurred!
See also "C:/projects/m/build/CMakeFiles/CMakeOutput.log".
But generated build\CMakeFiles\3.15.5\VCTargetsPath.vcxproj
file contains Debug|x86
and not Debug|Win32
:
<?xml version="1.0" encoding="UTF-8"?>
<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup Label="ProjectConfigurations">
<ProjectConfiguration Include="Debug|x86">
<Configuration>Debug</Configuration>
<Platform>x86</Platform>
</ProjectConfiguration>
</ItemGroup>
<PropertyGroup Label="Globals">
<ProjectGuid>{F3FC6D86-508D-3FB1-96D2-995F08B142EC}</ProjectGuid>
<Keyword>Win32Proj</Keyword>
<Platform>x86</Platform>
<WindowsTargetPlatformVersion>10.0.17763.0</WindowsTargetPlatformVersion>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props"/>
<PropertyGroup>
<PreferredToolArchitecture>x64</PreferredToolArchitecture>
</PropertyGroup>
<PropertyGroup Label="Configuration">
<ConfigurationType>Utility</ConfigurationType>
<CharacterSet>MultiByte</CharacterSet>
<PlatformToolset>v142</PlatformToolset>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props"/>
<ItemDefinitionGroup>
<PostBuildEvent>
<Command>echo VCTargetsPath=$(VCTargetsPath)</Command>
</PostBuildEvent>
</ItemDefinitionGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets"/>
</Project>
Platform string is set from GetPlatformName()
at https://gitlab.kitware.com/cmake/cmake/blob/v3.15.5/Source/cmGlobalVisualStudio10Generator.cxx#L773 but MSBuild.exe
expects Win32
there.
I cannot find place where Win32
is changed to x86
...
Edited by slodki