场景:在win10下面想通过CMakelist.txt生成.sln文件

 

CMake Error at C:/opt/ros/melodic/x64/share/catkin/cmake/all.cmake:116 (project):
  Failed to run MSBuild command:

    MSBuild.exe

  to get the value of VCTargetsPath:

    Microsoft (R) Build Engine Version 2.0.50727.9031

    [Microsoft .NET Framework, Version 2.0.50727.9044]

    Copyright (C) Microsoft Corporation 2005. All rights reserved.

    

    E:\Work\share\CMakeFiles\3.10.0\VCTargetsPath.vcxproj(3,13): error MSB4066: 无法识别元素 <ItemGroup> 中的属性“Label”。

解法 添加环境变量
C:\Program Files (x86)\Microsoft Visual Studio\2017\Professional\MSBuild\15.0\Bin