**********************************************************************
** Visual Studio 2022 Developer Command Prompt v17.1.0
** Copyright (c) 2021 Microsoft Corporation
**********************************************************************
C:\Program Files\Microsoft Visual Studio\2022\Professional>rc.exe /?
'rc.exe' is not recognized as an internal or external command,
operable program or batch file.
Seems like it’s not putting it in my PATH I just repaired my VS2022 installation as well.
Normally I’d chalk this down to a (it’s just me) issue. But I’ve had coworkers contact me with the exact same problem. Perhaps this is a VS issue.
Oh! It might not be the SDK. There’s a “build tools” component that is needed. I think you might need the “Latest” version (with that label, not the highest number).
I think there was one that was just “latest build tools” (without a toolchain version). That may be what you need (I think the right tools still get used, but this is what hooks in wherever that is needed).
I’m able to build a project that takes advantage of the resource compiler via the visual studio generator but not via the ninja generator.
As mentioned by @brad.king I end up finding RC.exe via the SDK:
PS C:\Program Files (x86)\Windows Kits\10\bin\10.0.19041.0\x64> .\rc.exe /?
Microsoft (R) Windows (R) Resource Compiler Version 10.0.10011.16384
Copyright (C) Microsoft Corporation. All rights reserved.
However, that path is NOT getting added to the path in developer command prompts.
Looks like Microsoft isn’t interested in fixing the issue from their side.
As a developer not having access to the registry is an uncommon scenario, it is suggested that the effected developers modify [VisualStudio Install Directory]\Common7\Tools\vsdevcmd\core\winsdk.bat.
By manually changing “set WindowsSdkDir=” to "set WindowsSdkDir=[path to windows sdk] IE: “C:\Program Files (x86)\Windows Kits\10” you should restore functionality for the command line. Note that depending on your project you may have to manually set additional variables in this file.
@brad.king / @ben.boeckel would a CMake side change be appropriate? I can make a PR for it.
IIRC we do support -DCMAKE_RC_COMPILER=rc, and may not always convert that to an absolute path. In that case we’d assume rc is going to be in the PATH, but if(EXISTS) won’t work. Maybe we need to always convert CMAKE_RC_COMPILER to an absolute path as we do for other language compilers. If it fails to be found, then we can produce the nicer error.
It’s not really related to the actual issue of the original post, but I ended up here with the same symptoms after a rather fresh installation of a new developer machine.
on the command line finally revealed that the Python3 installer inserted the python/scripts folder at the very beginning of the PATH environment variable, resulting in reg.py being executed instead of the reg command line tool when CMake was trying to query the registry for the path to the WindowsSDK… Moving the python folders further back in PATH fixed it immediately.
So maybe this helps other people ending up here to figure out what’s wrong more quickly.