[英]Error When Configuring Microsoft Identity Platform inside Visual Studio 2019
[英]Configuring CMake and Microsoft Visual Studio 2019 for Use with Intel Compilers
我试图确定 CMake 是否是简化我正在研究的 c++ 库的跨平台开发的一个选项。 Linux 完成。 现在,我正在尝试在 windows 上使用 CMake。 使用 CMake 的 Visual Studio 生成器设置 CMake 也不是问题。 我还在一个简单的程序“hello_world.cpp”上对其进行了测试。
mkdir build
cd build
cmake ..
msbuild hello_world.sln
当我尝试使用 Intel 编译器为 Microsoft Visual Studio 配置 CMake 时出现问题,正如Intel所解释的那样。 按照Intel的简单程序“hello_world.cpp”,我在 power-shell 中执行了以下操作
mkdir build
cd build
cmd.exe "/K" '"C:\Program Files (x86)\Intel\oneAPI\setvars.bat" && powershell'
cmake -T "Intel(R) oneAPI DPC++ Compiler" -DCMAKE_CXX_COMPILER="dpcpp" ..
output 是
:: initializing oneAPI environment...
Initializing Visual Studio command-line environment...
Visual Studio version 16.11.19 environment configured.
"C:\Program Files (x86)\Microsoft Visual Studio\2019\Professional\"
Visual Studio command-line environment initialized for: 'x64'
: advisor -- latest
: compiler -- latest
: dal -- latest
: debugger -- latest
: dev-utilities -- latest
: dnnl -- latest
: dpcpp-ct -- latest
: dpl -- latest
: inspector -- latest
: intelpython -- latest
: ipp -- latest
: ippcp -- latest
: itac -- latest
: mkl -- latest
: mpi -- latest
: tbb -- latest
: vpl -- latest
: vtune -- latest
:: oneAPI environment initialized ::
Windows PowerShell
Copyright (C) Microsoft Corporation. All rights reserved.
Install the latest PowerShell for new features and improvements! https://aka.ms/PSWindows
-- Building for: Visual Studio 16 2019
CMake Error at CMakeLists.txt:1 (project):
Failed to run MSBuild command:
C:/Program Files (x86)/Microsoft Visual Studio/2019/Professional/MSBuild/Current/Bin/MSBuild.exe
to get the value of VCTargetsPath:
Microsoft (R) Build Engine version 16.11.2+f32259642 for .NET Framework
Copyright (C) Microsoft Corporation. All rights reserved.
Build started 21/09/2022 15:52:09.
Project "C:\Users\RaphaelSchiedung\source\hello_world\build\CMakeFiles\3.24.2\VCTargetsPath.vcxproj" on node 1 (default targets).
C:\Program Files (x86)\Microsoft Visual Studio\2019\Professional\MSBuild\Microsoft\VC\v160\Microsoft.CppBuild.targets(439,5): error MSB8020: The build tools for Intel(R) oneAPI DPC++ Compiler (Platform Toolset = 'Intel(R) oneAPI DPC++ Compiler') cannot be found. To build using the Intel(R) oneAPI DPC++ Compiler build tools, please install Intel(R) oneAPI DPC++ Compiler 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 "Retarget solution". [C:\Users\RaphaelSchiedung\source\hello_world\build\CMakeFiles\3.24.2\VCTargetsPath.vcxproj]
Done Building Project "C:\Users\RaphaelSchiedung\source\hello_world\build\CMakeFiles\3.24.2\VCTargetsPath.vcxproj" (default targets) -- FAILED.
Build FAILED.
"C:\Users\RaphaelSchiedung\source\hello_world\build\CMakeFiles\3.24.2\VCTargetsPath.vcxproj" (default target) (1) ->
(PrepareForBuild target) ->
C:\Program Files (x86)\Microsoft Visual Studio\2019\Professional\MSBuild\Microsoft\VC\v160\Microsoft.CppBuild.targets(439,5): error MSB8020: The build tools for Intel(R) oneAPI DPC++ Compiler (Platform Toolset = 'Intel(R) oneAPI DPC++ Compiler') cannot be found. To build using the Intel(R) oneAPI DPC++ Compiler build tools, please install Intel(R) oneAPI DPC++ Compiler 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 "Retarget solution". [C:\Users\RaphaelSchiedung\source\hello_world\build\CMakeFiles\3.24.2\VCTargetsPath.vcxproj]
0 Warning(s)
1 Error(s)
Time Elapsed 00:00:00.21
Exit code: 1
-- Configuring incomplete, errors occurred!
问题似乎是 VCTargetsPath。 Microsoft将其称为引用 %VSINSTALLDIR%MSBuild\Microsoft\VC<version>\ 的宏。 在这一点上,谷歌在回答我关于检查 VCTargetPah 是否设置正确的问题方面没有多大帮助。 它在哪里定义? 注册表、系统变量,还是在 VisualStudio 的某些项目文件中? 我不太了解这一点,我对 windows 编程了解不多。
它是一个错误吗? VCTagetsPath 是问题所在吗? 我能做点什么吗? 任何有关如何进行的帮助将不胜感激。
hello_world.cpp:
#include<iostream>
int main(){std::cout << "Hello World\n"; return 0;}
CMakeLists.txt:
project(hello_world)
add_executable(hello_world hello_world.cpp)
window 11
视觉工作室 16 2019
CMake 版本 3.24.2
Intel(R) oneAPI DPC++/C++ 编译器 2022.1.0 (2022.1.0.20220316)
你可以试试这个:
cmake -DCMAKE_CXX_COMPILER=icx ..
而不是这个:
cmake -T "Intel(R) oneAPI DPC++ Compiler" -DCMAKE_CXX_COMPILER="dpcpp" ..
仅供参考,我认为您正在查看旧文档,我认为这是 2022.1 的最新文档。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.