2017-03-02 2 views
0

I définir la variable CPPPATH via ParseFlags:Scons semble ignorer la valeur CPPPATH

env = Environment() 
env["CXX"] = "clang++" 
d = env.ParseFlags("-I. -I../utl") 
print d 
env.StaticLibrary(target="myLib",source = source_files) 

L'impression de d montre CPPPATH réglé sur le bon répertoire:

{'CPPFLAGS': [], 'FRAMEWORKPATH': [], 'LIBPATH': [], 'CXXFLAGS': [], 'LIBS': [], 'ASFLAGS': [], 'LINKFLAGS': [], 'RPATH': [], 'CPPDEFINES': [], 'FRAMEWORKS': [], 'CCFLAGS': [], 'CFLAGS': [], 'CPPPATH': ['.', '../utl']}

Cependant, la sortie de la compilation n'a pas option -I:

clang++ -o ABC_Exception.o -c ABC_Exception.cpp 

Et ne parvient pas à trouver un fichier inclure dans ../utl

./ABC_Exception.hpp:4:10: fatal error: 'Exception.hpp' file not found

Répondre

2

ParseFlags devrait être suivi par MergeFlags pour ajouter les variables à l'environnement tel que décrit dans le SCons documentation.

ParseFlags returns a dictionary containing the options distributed into their respective construction variables. Normally, this dictionary would be passed to MergeFlags to merge the options into a construction environment, but the dictionary can be edited if desired to provide additional functionality. (Note that if the flags are not going to be edited, calling MergeFlags with the options directly will avoid an additional step.)

Dans votre exemple, vous pouvez simplement appeler MergeFlags avec la chaîne transmise à ParseFlags.