Author Topic: About environment and global variables  (Read 2450 times)

Offline gd_on

  • Lives here!
  • ****
  • Posts: 799
About environment and global variables
« on: November 15, 2022, 05:49:49 pm »
I have set global variables with members that I can use in C::B builds to try to avoid multiple workspaces depending on wxWidgets versions and OS number of bits.
I have already proposed a set of cbps to do this in,25068.msg170998.html#msg170998, and updated them on my own PC but not published new versions.

For example I have a cb_build.osbits with the value 64 and a wxwidgets.wx_version with the value 32.
So when building the name of the devel, obj or output folders, I can use in my build devel$(#wxwidgets.wx_version)_$(#cb_build.osbits) to obtain automatically devel32_64, .obj32_64...
It works well, is adapted automatically if you change the wxwidgets version and/or the os bits, defined at the global level.
Nevetheless, it gives some long lines in .cbp files, not easy to read.
It is possible to define a local environment variable as WX_VER=$(#wxwidgets.wx_version)_$(#cb_build.osbits). So I can write more simply devel$(WX_VER) in my cbps.
But I need to build this local environment variable in each .cbp.
The result is always good, because variables are still defined at global level in C::B.

It could be nice if I could define my WX_VER at a global level, eventually in my wx_widgets global variable as a new member. I tried to add a new member wx_widgets.wx_ver with the value $(#wxwidgets.wx_version)_$(#cb_build.osbits), but it is not accepted by the global variable dialog.
Not very surprising, because this syntax need to access an other member in the same variable, and another variable, which also means an order in the dependencies.

So, is such variable composition is possible?

« Last Edit: November 15, 2022, 05:52:43 pm by gd_on »
Windows 11 64 bits (23H2), svn C::B (last version or almost!), wxWidgets 3.2.5 (tests with 3.3), Msys2 Compilers 14.1.0, 64 bits (seh, posix : gcc, g++ and gfortran in C:\msys64\mingw64) or 32 bits (dwarf2, posix  in C:\msys64\mingw32).