How to force use of static library over shared?

后端 未结 2 1467
谎友^
谎友^ 2021-01-04 05:39

In my SConscript I have the following line:

Program(\"xtest\", Split(\"main.cpp\"), LIBS=\"mylib fltk Xft Xinerama Xext X11 m\")

How do I g

2条回答
  •  离开以前
    2021-01-04 06:21

    To make this platform independent you append the env['SHLIBSUFFIX'] onto the library you want to use. env['SHLIBSUFFIX'] gives you this environments suffix for shared libraries.

    You also have the ['SHLIBPREFIX'], ['LIBPREFIX'], ['LIBSUFFIX'] and ['PROGSUFFIX'], all useful for situations like this.

    Edit:

    I obviously haven't made myself understood, so I will clarify. The return value of these lookups are strings to the pre/suffixes that platform uses. In that way you can refer to the file you need on each platform. Note that you cannot use it as a pure string, it has to be embedded as a file node as BennyG suggests. Working with nodes are anyway the best solution as file nodes are much more versatile than a string.

    Hope this helps.

提交回复
热议问题