Intel® oneAPI DPC++/C++ Compiler
Talk to fellow users of Intel® oneAPI DPC++/C++ Compiler and companion tools like Intel® oneAPI DPC++ Library, Intel® DPC++ Compatibility Tool, and Intel® Distribution for GDB*
655 Discussions

Intel C++ compiler with Visual Studio CMake project

dkasianov
Novice
593 Views

Hi,

 

I have simple CMake project and trying to build it using Intel C++. It is build ok if I use from Intel One API Command Prompt without any issues, but I open this project in visual studio icx-cl is not found. It is explainable because it looks like OneAPI is not integrates compilers into Visual Studio Developer Command Line.

So the question is, does it supported CMake Project in Visual Studio or CMake is supported only from One API Command Prompt?

 

Thanks,

Daniil

0 Kudos
1 Solution
dkasianov
Novice
418 Views

HI, 

 

I found solution this is covered in 

Automate the setvars.bat Script with Microsoft Visual Studio* (intel.com)

 

I found this article from by googling that, but it would be great to have it inside using Visual Studio

 

Thanks,

Daniil

View solution in original post

0 Kudos
5 Replies
yzh_intel
Moderator
576 Views

Hi @dkasianov , can you be more specific about the error you saw ?  Did you see the error from Visual studio GUI or the command line prompt ?

0 Kudos
dkasianov
Novice
569 Views

It is just a cmake output.

1> [CMake] -- The C compiler identification is unknown
1> [CMake] -- The CXX compiler identification is unknown

1> [CMake] The CMAKE_C_COMPILER:
1> [CMake]
1> [CMake] icx-cl
1> [CMake]
1> [CMake] is not a full path and was not found in the PATH.

 

It is looks like Visual Studio does not setup environment and doesn't see compilers.

 

And FYI, if I choose Developer PowerShell in Tools->Command Line, intel's compilers are also not there. 

 

Thanks,

Daniil

 

0 Kudos
yzh_intel
Moderator
506 Views

Hi @dkasianov, so you're trying to open a CMake project in Visual studio, do you mind sharing the CMakeLists.txt file or the steps to reproduce the issue ? 

In visual studio developer command line, you may need to execute the script, C:\Program Files (x86)\Intel\oneAPI\setvars.bat in order to see Intel compilers. 

0 Kudos
dkasianov
Novice
483 Views

Hi,

 

Yes, to run for command line I need to run *.bat file, but I expected in visual studio it was by default. But is ok, looks like it is a feature.

 

My example is just simple hello world example. I use presets. I commented out all deps. So you should be able to build it using msvc or intel's (from command line). Try it out.

 

Thanks,

Daniil

0 Kudos
dkasianov
Novice
419 Views

HI, 

 

I found solution this is covered in 

Automate the setvars.bat Script with Microsoft Visual Studio* (intel.com)

 

I found this article from by googling that, but it would be great to have it inside using Visual Studio

 

Thanks,

Daniil

0 Kudos
Reply