I’m writing a toolchain file and want to use the MSVC_IDE variable. However it doesn’t work.
This will not work.
This will work
if (CMAKE_GENERATOR MATCHES "Visual Studio")
Is there a reason why?
Hmm. That is set in
Modules/Platform/Windows-MSVC.cmake using the same conditional as you have here. Are you, perhaps, using
This problem isn’t exclusive to toolchains it’s any logic executed before the first project call.
Oh! I missed the “toolchain” part, sorry . Yes, the file I linked to is only run at compiler detection time, so yes, it is unavailable to toolchain files. That said, I don’t know how much more work that variable is going to carry, so the
CMAKE_GENERATOR-based detection is likely the way to go.
Hm gotcha. That’s fine for me. I’d just suggest adding some documentation to clarify this. In case someone runs into this again.