Ben Taylor
Ben Taylor

Reputation: 515

Cmake/Msbuild fails to build VCTargetsPath.vcxproj

I am upgrading my build machine to Windows 10 (previously Windows Server 2008) and my build uses Jenkins to run cmake, which builds using Visual Studio (msbuild). It worked on the old machine using Visual Studio 2012. However, on the new one using Visual Studio 2019 (Build Tools only, no IDE), it fails:

CMake Error at CMakeLists.txt:3 (project):

  Failed to run MSBuild command:


  C:/Program Files (x86)/Microsoft Visual Studio/2019/BuildTools/MSBuild/Current/Bin/MSBuild.exe


  to get the value of VCTargetsPath:


Microsoft (R) Build Engine version 16.6.0+5ff7b0c9e for .NET Framework

Copyright (C) Microsoft Corporation. All rights reserved.



Build started 17/06/2020 16:58:51.

C:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools\MSBuild\Microsoft\VC\v160\Microsoft.Cpp.ToolsetLocation.props(52,3): warning MSB4011: "C:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools\MSBuild\Microsoft\VC\v160\Microsoft.Cpp.props" cannot be imported again. It was already imported at "E:\JenkinsMIDEBLD\workspace\btaylor-new_build_node_CYC-268_2\CyclopsInstall\build\polyphemus_build_tmp\CMakeFiles\3.15.4\VCTargetsPath.vcxproj (24,2)". This is most likely a build authoring error. This subsequent import will be ignored. 

Project "E:\JenkinsMIDEBLD\workspace\btaylor-new_build_node_CYC-268_2\CyclopsInstall\build\polyphemus_build_tmp\CMakeFiles\3.15.4\VCTargetsPath.vcxproj" on node 1 (default targets).

C:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools\MSBuild\Current\Bin\Microsoft.Common.CurrentVersion.targets(777,5): error : The OutputPath property is not set for project 'VCTargetsPath.vcxproj'.  Please check to make sure that you have specified a valid combination of Configuration and Platform for this project.  Configuration='Debug'  Platform='x64'.  You may be seeing this message because you are trying to build a project without a solution file, and have specified a non-default Configuration or Platform that doesn't exist for this project. [E:\JenkinsMIDEBLD\workspace\btaylor-new_build_node_CYC-268_2\CyclopsInstall\build\polyphemus_build_tmp\CMakeFiles\3.15.4\VCTargetsPath.vcxproj]

The error says that the combination of Configuration and Platform (Debug|x64) may not be correct, but it looks like it should be correct because that's the only combination present in the vcxproj file. It's not even my build settings building VCTargetsPath.vcxproj, that seems to be a subsidiary build that Visual Studio 2019 has added because it feels like it - it's not there in my VS 2012 build. If I change my configuration to Debug|x64 it has no effect.

The cmake command making the call looks like this:

set RELEASE_TYPE=Release
%CMAKE_ROOT%\bin\cmake.exe ^
    %POLYPHEMUS_SOURCE% ^
    -DCMAKE_BUILD_TYPE=%RELEASE_TYPE% ^
    -DCMAKE_WINDOWS_EXPORT_ALL_SYMBOLS=TRUE ^
    -DCMAKE_INSTALL_PREFIX=%INSTALL_PREFIX%/polyphemus ^
    -DBOOST_ROOT=%BOOST_ROOT% ^
    -DBoost_USE_STATIC_LIBS=ON ^
    -DNANOMSG_INCLUDE_PATH=%NANOMSG_ROOT%/build/include/nanomsg ^
    -DNANOMSG_LIB=%NANOMSG_ROOT%/build/lib/nanomsg.lib ^
    -DFLATBUFFERS_INCLUDE_PATH=%FLATBUFFERS_ROOT%/include ^
    -DFLATBUFFERS_SOURCE_PATH=%FLATBUFFERS_ROOT%/src 2>&1 || goto BUILDFAIL

I've tried various things (-A x64, setting to Debug configuration, installing UWP components of Visual Studio) but nothing's worked so far. Looking around the web I get the impression that this problem occurs only with Visual Studio 2019, so maybe I could fix it by downgrading, but I'd rather use the most recent version if I can.

Anyone got any thoughts?

Upvotes: 2

Views: 3564

Answers (1)

ehambright
ehambright

Reputation: 1593

Just ran into this. I had -A win64 (as that is the architecture I specified with the -G command for previous versions of visual studio). Turns out it needs -A x64. Once I used x64 it worked.

Upvotes: 4

Related Questions