Search code examples
pythonbuildscons

What is the construction variable used for creating libraries in SCons?


I'm trying to create library files from object files using SCons function Library('name', ['source']) .

I want to configure the path and cmd line to my specific librarian.

I tried to change DLIBCOM but SCons still uses its default cmd line: lib /nologo /OUT:foo.lib f1.obj f2.obj f3.obj

Can anybody tell me where I have to configure this ?


Solution

  • I'm betting this is a variant of a question I hear over and over again with SCons. "Why does scons not pick up my changes to the build environment?"

    If I'm right, the answer to your question is to make sure you are calling Library from the build environment that you are modifying, and not the default environment.

    SConstruct

    env = Environment()
    env.Replace(DLIBCOM='my custom lib command')
    env.Library('name', ['source'])
    

    What I see all the time, which would cause the problem you describe is the following.

    SConstruct

    env = Environment()
    env.Replace(DLIBCOM='my custom lib command')
    # The following command will utilize the default value for DLIBCOM, not the above
    Library('name', ['source'])