Hello,

in almost all of my scons projects, I have a piece of code like that one:

def uniqueCheckLib(conf, lib, header = None):
    if header:
        if not conf.CheckLibWithHeader(lib, header = header, autoadd=0, 
language="C++"):
            print "ERROR: Library '" + lib + "' or header '" + header + "' not 
found."
            Exit(1)
    else:
        if not conf.CheckLib(lib, autoadd=0, language="C++"):
            print "ERROR: Library '" + lib + "' not found!"
            Exit(1)

    conf.env.AppendUnique(LIBS = [lib])

This is needed because of some shortcommings of CheckLib / CheckLibWithHeader.

1) CheckLib adds the library to LIBS, even if it is already present. That can 
cause problem. What is the use case for that?

2) In almost all cases, if a library is not found, I want the build to 
terminate. CheckLib should (optionally) print a nice error message and aborts 
the build, if the check fails.

Why not having a function:

AssureLibOrHeader(context, 
  library = None,
  header = None,
  [...])

If tests for library and the header, if given. If the check fails, it prints a 
nice error messages and fails.

Another idea what be to enhance the existings checks with a flag, abortOnFail, 
which prints an error messages and exists.

If such a change would have any chance of inclusion, I would try to implement 
it into scons.

What do you think? Are there alternatives I overlooked?

Florian
  

_______________________________________________
Scons-dev mailing list
Scons-dev@scons.org
https://pairlist2.pair.net/mailman/listinfo/scons-dev

Reply via email to