Author Topic: How to run a .bat at CB start-up to define env variables in CB scope?  (Read 2873 times)

Offline J.

  • Multiple posting newcomer
  • *
  • Posts: 47
I want to apply that to where MSVC's vcvars32.bat is called to define env variables required for compilation with Microsoft's cl.exe / link.exe.

Currently I am working with a .bat wrapper calling vcvars32.bat each time cl.exe or link.exe is called ... very time inefficient.

Living on Win10 with CB16.01.

Thanks,
J.

Offline oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 13413
    • Travis build status
Re: How to run a .bat at CB start-up to define env variables in CB scope?
« Reply #1 on: December 04, 2016, 02:48:02 am »
What do you really want to achieve?
Run msvc++ inside C::B?
(most of the time I ignore long posts)
[strangers don't send me private messages, I'll ignore them; post a topic in the forum, but first read the rules!]

Offline J.

  • Multiple posting newcomer
  • *
  • Posts: 47
Re: How to run a .bat at CB start-up to define env variables in CB scope?
« Reply #2 on: December 04, 2016, 11:40:52 am »
Yes  - and in addition the question for other questions and probably the first one: How to get env variables dynamically defined in some script to make them available in CB scope?

Offline oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 13413
    • Travis build status
Re: How to run a .bat at CB start-up to define env variables in CB scope?
« Reply #3 on: December 04, 2016, 12:32:29 pm »
1. Just setup your msvc++ inside C::B as a compiler and use it in your projects. The vcvars32.bat is not really needed. C::B can emulate it.
2. Do you need these variables for something else than the debugger?
(most of the time I ignore long posts)
[strangers don't send me private messages, I'll ignore them; post a topic in the forum, but first read the rules!]

Offline J.

  • Multiple posting newcomer
  • *
  • Posts: 47
Re: How to run a .bat at CB start-up to define env variables in CB scope?
« Reply #4 on: December 04, 2016, 01:37:45 pm »
How does this set up work for all the paths to be set and required by cl and link?  This task is silently and - I guess - reliably done by vcvars32.bat. Any manual fiddling with paths calls for errors and potential incompleteness I think.

The question is more general of how to set up env vars at CB start-up to provide dynamically set env paths. I would be interested not only to use it with the debugger where the env var(s) might change for every gdb start during one single CB session.

Is it possible to run the .bat simply before calling the CB exe when firing it up? Just an idea coming to my mind right now.

Offline oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 13413
    • Travis build status
Re: How to run a .bat at CB start-up to define env variables in CB scope?
« Reply #5 on: December 04, 2016, 05:02:17 pm »
Have you looked at the envvar plugin?

If you want to setup env vars you can make a bat file that sets them up and starts C::B.
(most of the time I ignore long posts)
[strangers don't send me private messages, I'll ignore them; post a topic in the forum, but first read the rules!]

Offline oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 13413
    • Travis build status
Re: How to run a .bat at CB start-up to define env variables in CB scope?
« Reply #6 on: December 04, 2016, 05:12:57 pm »
How does this set up work for all the paths to be set and required by cl and link?  This task is silently and - I guess - reliably done by vcvars32.bat. Any manual fiddling with paths calls for errors and potential incompleteness I think.
Just select the msvc++ compiler in the settings-> compiler. If you use already supported compiler all should work out of the box.
If you're using newer compiler then you should fiddle with the settings to make them match the new version.

You can use the vcvars32.bat as a reference what needs to be set.
It is not rocket science.
(most of the time I ignore long posts)
[strangers don't send me private messages, I'll ignore them; post a topic in the forum, but first read the rules!]