Page 1 of 1
Adding a library to all projects in a workspace
Posted: Thu May 03, 2012 8:03 am
by drh
I have a workspace with multiple projects. They all use the rt lib and a Utility lib.
I tried adding them as a switch in Settings->Build Settings->gnu g++->Linker options but that didn't work.
Can I set it up so that I don't have to add them to each projects global settings?
Version 3.5.5375 on Ubuntu
Re: Adding a library to all projects in a workspace
Posted: Thu May 03, 2012 9:26 am
by eranif
drh wrote:I tried adding them as a switch in Settings->Build Settings->gnu g++->Linker options but that didn't work.
this is not the place to add them. If you wanted to add it on the compiler level, you should do it from:
"Settings->Build Settings->gnu g++->Tools->Linker Name"
and replace "g++" with "g++ -lrt -lUtils"
But I am not sure that this is the correct thing to do. I would clone g++ compiler and create a new one named "g++ with rt" (or something like this) and then do this change
drh wrote:Can I set it up so that I don't have to add them to each projects global settings?
Read my previous answer ^^
Eran
Re: Adding a library to all projects in a workspace
Posted: Thu May 03, 2012 10:00 am
by drh
No joy. I added it to the linker line and my make now produces:
g++ -lrt -lFASTLib -lUtilityLib -o ./Release/SER_GPS @"/home/test/dev/FASTTrac/SER_GPS/SER_GPS.txt"
And it leaves everything unresolved.
The original compile that works uses (with libraries defined in the project settings)
g++ -o ./Release/SER_GPS @"/home/dhuff/dev/FASTTrac/SER_GPS/SER_GPS.txt" -lrt -lFASTLib -lUtilityLib
I know that order for the libs matters (I had something in FASTLib that relied on UtilityLib and if the order was rt;UtilityLIb;FASTLib and I was again left with unresolved items).
I guess it also matters in the linking command line as well.
Any ideas?
Re: Adding a library to all projects in a workspace
Posted: Thu May 03, 2012 10:28 am
by eranif
Ok, here is a better way of doing it - its a much nicer hack
right click on your workspace, and select "Workspace Settings"
In the "Environment" tab. In the "Specify here an additional environment variables" box, type"
Code: Select all
LinkOptions=$(LinkOptions) -lrt -lFASTLib -lUtilityLib
This will append " -lrt -lFASTLib -lUtilityLib " to the end of your project link options and it should work
Eran
Re: Adding a library to all projects in a workspace
Posted: Thu May 03, 2012 11:40 am
by Jarod42
An alternative is to use a tool to generate Codelite project (like
Premake).
With it, you can set settings at solution level, and the tool does the job to "dispatch" setting per project.