Author Topic: auto set environement variables [solved]  (Read 2897 times)

Offline ccdric

  • Multiple posting newcomer
  • *
  • Posts: 20
auto set environement variables [solved]
« 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
« Last Edit: January 06, 2020, 09:58:15 am by ccdric »

Offline oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 13413
    • Travis build status
Re: auto set environement variables
« Reply #1 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.
(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 ccdric

  • Multiple posting newcomer
  • *
  • Posts: 20
Re: auto set environement variables
« Reply #2 on: January 02, 2020, 02:23:26 pm »
Thanks for your answer.

so I looked in project/properties in "EnvVars option" tab
  • env var select is checked
  • myclient is selected

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 ?
« Last Edit: January 02, 2020, 02:26:33 pm by ccdric »

Offline MortenMacFly

  • Administrator
  • Lives here!
  • *****
  • Posts: 9694
Re: auto set environement variables
« Reply #3 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!
Compiler logging: Settings->Compiler & Debugger->tab "Other"->Compiler logging="Full command line"
C::B Manual: https://www.codeblocks.org/docs/main_codeblocks_en.html
C::B FAQ: https://wiki.codeblocks.org/index.php?title=FAQ

Offline ccdric

  • Multiple posting newcomer
  • *
  • Posts: 20
Re: auto set environement variables
« Reply #4 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.