User forums > Help

Setting of OS variables possible?

(1/6) > >>

MortenMacFly:
Dear all,
I have a question: Is it possible to set a specific OS environment variable before running a compiler using C::B? I don't mean the C::B user/compiler/global variables or defines that are used as arguments for the compiler/linker. I really mean the once you set at the command prompt, e.g. the PATH environment variable. If I got it right then C::B runs an external command shell so in general this could be possible.
Why do I want this? In my specific case I am using 2 programs that use the FLEX license manager. One of it is a QNX compiler. Thus the compiler requires a specific environment variable to point to the license file. Unfortunately the variable is called the same for both applications so I have to switch from one to the other. If it would be possible to set his environment variable for the QNX compiler only at compile time in C::B this would help a lot. I always forget to set the variable accordingly before starting C::B. So when it comes to compilation I always have to quit C::B, update the environment and run C:::B again.
Another reason might be environment variables such as INCLUDE or LIB which is set by e.g. MS-DevStudio but others as well. So such things might really interfer if several compilers are installed on a single system.
So again: Is this already possible? Any arguments why not? Any help is appreciated.
With reagrds, Morten.

mandrav:

--- Quote ---So again: Is this already possible?
--- End quote ---

It sure was.
At some point, Thomas worked on optimizing things in macros/variables replacement (it was necessary) and it may have broken since then. I haven't tested it lately.
Why don't you test it and see? ;)
Normally, all custom variables should be exposed as environment variables.

thomas:

--- Quote from: mandrav on January 26, 2006, 01:59:54 pm ---Normally, all custom variables should be exposed as environment variables.
--- End quote ---
Umm... no, they sure are not. Remember, this was the one thing that caused so much grief.

The reverse does work, environment variables can always be used inside Code::Blocks, but that's not what you want here... :(

You could set them from a script which runs in pre-build steps, though. What's the Windows equivalent for sh's EXPORT?

MortenMacFly:

--- Quote from: mandrav on January 26, 2006, 01:59:54 pm ---Normally, all custom variables should be exposed as environment variables.

--- End quote ---
All right! I didn't even try because the dialog states "These variables can be used in compiler and/or linker options." So I didn't get that they are expanded as environment variables, too! So I thought it's only an option to the compiler/linker.
Sorry for that, I'll try now... and reporting back...

Morten.

MortenMacFly:

--- Quote from: thomas on January 26, 2006, 02:04:57 pm ---You could set them from a script which runs in pre-build steps, though.

--- End quote ---
Alright, so I see there are several solutions... I feel stupid now... :oops:


--- Quote from: thomas on January 26, 2006, 02:04:57 pm ---What's the Windows equivalent for sh's EXPORT?

--- End quote ---
It's SET, e.g.
--- Code: ---SET PATH=%PATH%;D:\Devel\CodeBlocks
--- End code ---
:lol:
Thank you very much so far... Morten.

Navigation

[0] Message Index

[#] Next page

Go to full version