CMake: path of CXX Compiler in Visual Studio 2019?

Viewed 1901

I am on Windows and I try to compile a C/C++ program using CMake-gui.

I have Visual Studio 2019 installed on my PC.

I set as Windows environment variable for CXX the following path:

C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.29.30133\bin\Hostx64\x64

But when I click on 'Configure' in CMake-gui, I get the following error:

The C compiler identification is unknown
CMake Error at C:/Users/user1/mylibs/cmake-3.22.0-rc1-windows-x86_64/share/cmake-3.22/Modules/CMakeDetermineCXXCompiler.cmake:48 (message):
  Could not find compiler set in environment variable CXX:

  C:\Program Files (x86)\Microsoft Visual
  Studio\2019\Community\VC\Tools\MSVC\14.29.30133\bin\Hostx64\x64.

Call Stack (most recent call first):
  CMakeLists.txt:56 (PROJECT)


CMake Error: CMAKE_CXX_COMPILER not set, after EnableLanguage
Configuring incomplete, errors occurred!
See also "C:/Users/user1/mylibs/assimp-master_build/CMakeFiles/CMakeOutput.log".
See also "C:/Users/user1/mylibs/assimp-master_build/CMakeFiles/CMakeError.log".

Any idea how to solve this issue?

Thanks

1 Answers

Most likely you need to execute C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Auxiliary\Build\vcvarsall.bat a batch file that sets all related environment variables.

You can also try opening from the Start menu "Developer Command Prompt for VS 2019" and executing vcvarsall.bat directly.

Related