Author Topic: AddLinkLib to Target in Wizard - prepending policy  (Read 232 times)

Offline huycan

  • Multiple posting newcomer
  • *
  • Posts: 16
AddLinkLib to Target in Wizard - prepending policy
« on: May 02, 2020, 09:49:12 am »
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?

Offline oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 12625
    • Travis build status
Re: AddLinkLib to Target in Wizard - prepending policy
« Reply #1 on: May 02, 2020, 11:09:02 am »
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!]

Offline huycan

  • Multiple posting newcomer
  • *
  • Posts: 16
Re: AddLinkLib to Target in Wizard - prepending policy
« Reply #2 on: May 02, 2020, 09:54:03 pm »
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...

Offline oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 12625
    • Travis build status
Re: AddLinkLib to Target in Wizard - prepending policy
« Reply #3 on: May 02, 2020, 11:51:53 pm »
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!]

Offline huycan

  • Multiple posting newcomer
  • *
  • Posts: 16
Re: AddLinkLib to Target in Wizard - prepending policy
« Reply #4 on: May 03, 2020, 12:56:48 am »
Perfect! Thanks. That did it. I use
Code: [Select]
target.SetOptionRelation(ortLinkerOptions, 2);

Offline oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 12625
    • Travis build status
Re: AddLinkLib to Target in Wizard - prepending policy
« Reply #5 on: May 03, 2020, 01:28:27 am »
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!]

Offline huycan

  • Multiple posting newcomer
  • *
  • Posts: 16
Re: AddLinkLib to Target in Wizard - prepending policy
« Reply #6 on: May 03, 2020, 01:41:07 am »
Yes, I know. I was just do a quick test. I use the constant "orPrependToParentOptions" mentioned above. The final code is:
Code: [Select]
target.SetOptionRelation(ortLinkerOptions, orPrependToParentOptions);
target.AddLinkLib(_T("TheLib"));
Anyway, thanks again.