News:

The new Release 25.03 is out! You can download binaries for Windows and many major Linux distros here .

Main Menu

AddLinkLib to Target in Wizard - prepending policy

Started by huycan, May 02, 2020, 09:49:12 AM

Previous topic - Next topic

huycan

I am creating a wizard... and I have a question. The command AddLinkLib add a lib to target with an appending policy. What's the command for prepending instead?

oBFusCATed

Check the docs here: http://wiki.codeblocks.org/index.php/Scripting_commands#CompileOptionsBase

I suppose you can use GetLinkLibs and then use SetLinkLibs. Or build an array of libs and then set it at the end. It is up to you.
(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!]

huycan

What I want to do is this:

At the Project level... I just AddLinkLib.. as usual...

Then at the Target level... AddLinkLib action is default to orAppendToParentOptions... so the question how can I change it to --> orPrependToParentOptions...

oBFusCATed

For this you use CompileTargetBase::GetOptionRelation and CompileTargetBase::SetOptionRelation, I think.
(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!]

huycan

Perfect! Thanks. That did it. I use target.SetOptionRelation(ortLinkerOptions, 2);

oBFusCATed

You can use one of the enum OptionsRelation names instead of plain 2. It is shown in the docs on the page I've linked.
(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!]

huycan

Yes, I know. I was just do a quick test. I use the constant "orPrependToParentOptions" mentioned above. The final code is:

target.SetOptionRelation(ortLinkerOptions, orPrependToParentOptions);
target.AddLinkLib(_T("TheLib"));

Anyway, thanks again.