Project Home
Project Home
Trackers
Trackers
Documents
Documents
Wiki
Wiki
Discussion Forums
Discussions
Project Information
Project Info
Forum Topic - How to reference header/libs external to workspace using environment variables: (5 Items)
   
How to reference header/libs external to workspace using environment variables  
My source control system pulls down shared libraries (and their associated headers) somewhere outside my Momentics 
workspace.

Now, I would like to create a QNX C/C++ project that utilizes those shared header files and libraries. So I create this 
project and go to the project's properties to configure the extra include (and library) search paths to reference those 
paths outside the Momentics workspace. Unfortunately, the GUI only allows you to either select another project's path, a
 QNX target path, or an absolute path somewhere on your target file system.


What I really want to be able to do is *export* my Momentics project and check-in the exported project into my source 
control tool. Since the header/library paths are hard-coded to a path on my development machine, anyone who wants to 
import this project into their workspace must edit these paths by hand in order to reference the dependencies on their 
PC. So, ideally, I want to be able to use environment variables in the configurations paths and have those resolved at 
compile time. I know the regular CDT C/C++ projects allow you to select environment variables and include those in your 
paths. Is this possible to do with QNX C/C++ projects? Until now it doesn't appear to be supported in 4.6. Is there a 
work-around available.

Please note that I would assume any necessary environment variables used in a path would be defined in the environment 
PRIOR to launching Momentics.

Any solution would be appreciated. . . 
Re: How to reference header/libs external to workspace using environment variables  
Hi, Glenn,

It's not obvious, but it's easy to do.

Just browse your local filesystem using the "Disk..." button to add the
include path.  Then, click on the path in the list to start editing it.
Replace the portion (usually the leading bit) that corresponds to your
environment variable in the usual make syntax.  e.g.,

    $(MY_INCLUDE_ROOT)/some/include/folder

HTH,

Christian


On Thu, 2009-10-01 at 11:41 -0400, Glenn Schmottlach wrote:

> My source control system pulls down shared libraries (and their associated headers) somewhere outside my Momentics 
workspace.
> 
> Now, I would like to create a QNX C/C++ project that utilizes those shared header files and libraries. So I create 
this project and go to the project's properties to configure the extra include (and library) search paths to reference 
those paths outside the Momentics workspace. Unfortunately, the GUI only allows you to either select another project's 
path, a QNX target path, or an absolute path somewhere on your target file system.
> 
> 
> What I really want to be able to do is *export* my Momentics project and check-in the exported project into my source 
control tool. Since the header/library paths are hard-coded to a path on my development machine, anyone who wants to 
import this project into their workspace must edit these paths by hand in order to reference the dependencies on their 
PC. So, ideally, I want to be able to use environment variables in the configurations paths and have those resolved at 
compile time. I know the regular CDT C/C++ projects allow you to select environment variables and include those in your 
paths. Is this possible to do with QNX C/C++ projects? Until now it doesn't appear to be supported in 4.6. Is there a 
work-around available.
> 
> Please note that I would assume any necessary environment variables used in a path would be defined in the environment
 PRIOR to launching Momentics.
> 
> Any solution would be appreciated. . . 
> 
> 
> 
> _______________________________________________
> 
> General
> http://community.qnx.com/sf/go/post39208
> 


Re: How to reference header/libs external to workspace using environment variables  
Okay, I knew you could override that hard-coded path with environment variables. What I also wondered was whether you 
could somehow specify environment variables in "Linked Resources". That way I could add a linked folder to my project 
that resolves to the path defined in the environment variable. Currently it doesn't appear that Linked Resources allow 
you to do this. The link always gets resolved to the absolute path when looking at it in the project view.
Re: How to reference header/libs external to workspace using environment variables  
Hi, Glenn,

No, the Linked Resources capability is provided by the Eclipse Platform
and has no awareness of CDT or system programming concerns.  In
particular, it does not make use of environment variables, probably
because they are rarely used in Java applications (Eclipse, itself, does
not use the environment for anything except its native GUI libraries,
but those aren't Java anyway).

Cheers,

Christian

On Thu, 2009-10-01 at 12:03 -0400, Glenn Schmottlach wrote:

> Okay, I knew you could override that hard-coded path with environment variables. What I also wondered was whether you 
could somehow specify environment variables in "Linked Resources". That way I could add a linked folder to my project 
that resolves to the path defined in the environment variable. Currently it doesn't appear that Linked Resources allow 
you to do this. The link always gets resolved to the absolute path when looking at it in the project view.
> 
> 
> 
> _______________________________________________
> 
> General
> http://community.qnx.com/sf/go/post39210
> 


Re: How to reference header/libs external to workspace using environment variables  
You cannot specify environment variable, but you can specify linked 
resource "variables".
This way other user has to define them in eclipse to resolve properly 
after import.

Glenn Schmottlach wrote:
> Okay, I knew you could override that hard-coded path with environment variables. What I also wondered was whether you 
could somehow specify environment variables in "Linked Resources". That way I could add a linked folder to my project 
that resolves to the path defined in the environment variable. Currently it doesn't appear that Linked Resources allow 
you to do this. The link always gets resolved to the absolute path when looking at it in the project view.
>
>
>
> _______________________________________________
>
> General
> http://community.qnx.com/sf/go/post39210
>
>