Originally my binding file has only one target and that has been fine:
{
'targets': [
{
'target_name': 'target1',
'sources': [ 'source1.cc', 'source2.cc' ],
'cflags_cc!': [ '-fno-rtti', '-fno-exceptions' ],
'cflags!': [ '-fno-exceptions' ],
'conditions': [
#A very, very long condition
]
},
}
Now I need another target which is more or less the same, but build an executable file instead of link object. If I duplicate the original target, that will be OK, however I don't want to repeat the condition
which is exactly the same. How could I do that?
E.g. My ideal bindin.gyp would look somewhat like this:
{
'conditions': [
#A very, very long condition
]
'targets': [
{
'target_name': 'target1',
'sources': [ 'source1.cc', 'source2.cc' ],
'cflags_cc!': [ '-fno-rtti', '-fno-exceptions' ],
'cflags!': [ '-fno-exceptions' ],
'conditions' : #Refer to the conditions stated above
},
{
'target_name': 'target2',
'type' : 'executable'
'sources': [ 'source1.cc', 'source3.cc' ],
'cflags_cc!': [ '-fno-rtti', '-fno-exceptions' ],
'cflags!': [ '-fno-exceptions' ],
'conditions' : #Refer to the conditions stated above
},
}
I tried using variables
but node-gyp only allows variables of type string or list, while 'conditions' is an associative array