Code::Blocks Forums

User forums => Help => Topic started by: ccdric on January 02, 2020, 11:07:50 am

Title: auto set environement variables [solved]
Post by: ccdric on January 02, 2020, 11:07:50 am
Hello evrybody,
... and appy new year   :)

(hope this won't be a double post. I lost strangely my first try to post)

anybody know how to set env var automaticly at code::blocks startup ?

I'm talking about menu : settings/environement/Environement variables.

In the last stable release 17.12 the env vars were set at CB startup.

With my nightbuilds (first with realease 11736, now with 11927), I have to click each startup on the settings/environement/Environement variables/"set now" button !!

My env var are in a named set : "myclient" (it's not the "default" one).

this is extracted from my conf file (looks like the "myclient" set is the active one at startup)

Code
	
...
  <envvars>
    <sets>
    <default />
    <myclient>
      <ENVVAR0>
        <str>
          <![CDATA[1|CLIENTSDIR|/home/cedric/Documents/devellopement/myclient/clients]]>
        </str>
      </ENVVAR0>
      <ENVVAR1>
        <str>
          <![CDATA[1|SCRIPTS|/home/cedric/Documents/devellopement/myclient/clients/scripts]]>
        </str>
      </ENVVAR1>
....
      <ENVVAR19>
        <str>
          <![CDATA[1|PRJROOT|/outils/glob]]>
        </str>
      </ENVVAR19>
    </myclient>
    </sets>
    <ACTIVE_SET>
      <str>
        <![CDATA[myclient]]>
      </str>
    </ACTIVE_SET>
    <DEBUG_LOG bool="1" />
  </envvars>
...

I can stil live like this but I'll be happy if someone can help me to automate this feature.
thanks
Title: Re: auto set environement variables
Post by: oBFusCATed on January 02, 2020, 11:24:57 am
Have you tried to select the env vars set in your project/target? If you do so they should be set automatically.
Title: Re: auto set environement variables
Post by: ccdric on January 02, 2020, 02:23:26 pm
Thanks for your answer.

so I looked in project/properties in "EnvVars option" tab

try to quit CB
run again CB,
...  compile my project failded

go to the settings/environement/Environement variables and click "set now" button ( of course "myclient" env var set is selected)
... compile OK
(of course compile uses env vars)

so I gess something didn't works with project vars assignement and/or global vars assignment.

someone else has the same issue ?
did I miss something ?
Title: Re: auto set environement variables
Post by: MortenMacFly on January 04, 2020, 04:21:37 pm
go to the settings/environement/Environement variables and click "set now" button ( of course "myclient" env var set is selected)
... compile OK
This used to work. Maybe something got broken. Could you please enable the envvar debug option (settings->environment->envvar->checkbox at the bottom "Enable full envvar debug output...").

Then, close/restart C::B again an run you compilation (just as you described). Inspect the debug log and see if the envvars are really set and if the right set is chosen.

Please report back. Thank you!
Title: Re: auto set environement variables
Post by: ccdric on January 06, 2020, 09:57:53 am
Thanks MortenMacFly for your answer,

I did the test you asked to me
so i find that the init setup  of env var was a little bit different  from the second one.

one envVar was not at the right place, (depending from an other one).
that's why the second envVars setup vas good, not the first one.

Now I put the envVars in the good order and evrithink's OK.

tanks for all and sorry for my mistake.