How to set PATH to cmake in Visual Studio terminal ?

Hi,

I think this must be a simple question.
When using cmake with Visual Studio from the command line, it is recommended to run cmake from the Visual Studio terminal, where all environment variables are already set up correctly for the compiler etc.

Now the issues is, I have a recent version of cmake installed to e.g. c:\cmake-current\ and have put this at the beginning of my user PATH.
But in the Visual Studio terminal, the directories from Visual Studio are put before that, including the directory where the cmake which is coming with Visual Studio is located, which is version 3.12 I think.

So, in the Visual Studio terminal, the cmake which is found is automatically the old one coming with Visual Studio, and not the current one I’d like to use.

Is there a good way to keep “my” current cmake at the beginning of the PATH ?

Thanks
Alex

If you’re using the VS generator, there’s no need to use the VS prompt. That is for Ninja or NMake generators which run the compiler “naked” and need the environment for it to work. VS (well, MSBuild), on the other hand, knows how to execute the compiler itself directly without any helper environment.

That said, I don’t know how to control where VS prompts puts its entries into PATH… You can use c:\cmake-current\bin\cmake … explicitly though.