Search code examples
c++cmakemsbuildninja

CMake MSBUILD : error MSB1009: Project file does not exist


I need to build my CMake based project under MSVC 2013 and MSVC 2019.

With MSVC 2019 using Ninja generator I build it successfully with following commands:

cmake -S . -B build -GNinja "-DCMAKE_BUILD_TYPE:STRING=Release"
cmake --build build --target all

On MSVC 2013 I have no Ninja available, so I tried the following:

cmake -S . -B build -DCMAKE_BUILD_TYPE:STRING=Release
cmake --build build --target all

Anyway I am getting following error and nothing is built:

MSBUILD : error MSB1009: Project file does not exist.
Switch: all.vcxproj

Any idea how to build it without ninja? (I cannot install it, since I am building it on a build server.)


Solution

  • In contrast to other generators (like Makefiles or Ninja) CMake does not generate an all target for Visual Studio solution but an ALL_BUILD target.

    So cmake --build build --target ALL_BUILD --config Release should succeed.