[Scons-users] detecting Visual Studio Commandline

Gary Oberbrunner garyo at oberbrunner.com
Sat Aug 11 11:28:04 EDT 2012


On Sat, Aug 11, 2012 at 11:21 AM, Kraus Philipp
<philipp.kraus at flashpixx.de> wrote:

> Hello,

>

> I'm using platform scripts for getting the different environmental information.

> If call a scons subscript on the result of env["platform"], this works with darwin (OSX), posix and cygwin

> very well, but can I detect if the script is run under the Visual Studio Command Line?

>

> If I run my scons script on the VS CLI the platform returns "win32" so is there an option something like "msvc" ?

> I need an information about the "toolkit".


All the VS command line does is start cmd.exe with a bat script. The
bat script sets up various env vars, so you can probably just check
for something in os.environ(...).

But note that unless you change something, SCons does not import the
user's OS environment and pass it to the executed commands -- this is
to ensure builds are reproducible by anyone. SCons insteads finds the
VS bat scripts and runs them itself to get the proper OS environment
to pass to cl, link.exe and so on. This means any SConstruct should
work the same in a VS CLI or a simple cmd.exe window, so perhaps
you're asking the wrong question above. (If you want to import the
incoming environment, of course you can do that -- see the man page.)

--
Gary


More information about the Scons-users mailing list