Author Topic: Multiple build targets from same code base  (Read 1559 times)

byadav

  • New Community Member
  • Posts: 1
  • Hero Points: 0
Multiple build targets from same code base
« on: February 10, 2019, 03:31:20 AM »
Hi,

I have a project that is built on Linux and MacOS. It needs one extra library when building on MacOS. Is there a way to conditionally link to a library in SlickEdit projects?

Thanks,

Graeme

  • Senior Community Member
  • Posts: 2796
  • Hero Points: 347
Re: Multiple build targets from same code base
« Reply #1 on: February 11, 2019, 10:32:03 AM »
You could try an environment variable, not sure if this will work.  In project properties, compile/link tab -> click the right arrow at the right hand end of the "libraries/objects" edit box and you will see you can use, say, %(EXTRALIB).  It will then appear in the link order dialog box - click the elipsis to see it.

Any Slick C macro whose name starts with _workspace_opened_ gets called automatically when the workspace is opened.
So you can do this to set the environment variable when the workspace is opened.  Save the code in something.e and load it using the load module command on the macro menu.

Code: [Select]
#include "slick.sh"
void _workspace_opened_do_something()
{
   // say("abc " :+ _workspace_filename);
   if (_isMac())
      set_env("EXTRALIB", "mylib.lib");
   else
      set_env("EXTRALIB", "");

}

Also see this.
https://community.slickedit.com/index.php/topic,16714.msg64622.html#msg64622

Graeme

  • Senior Community Member
  • Posts: 2796
  • Hero Points: 347
Re: Multiple build targets from same code base
« Reply #2 on: February 11, 2019, 10:47:19 AM »
A way to do it without the macro is to have extra configurations - e.g. debug release debug-mac release-mac.  When you create a new configuration it lets you copy the settings from an existing configuration.  Then you can specify a different set of libs for each configuration.