[Scons-users] Dependency missed when the included filename is defined by a preprocessor macro

Julien Pommier pommier at pianoteq.com
Tue Mar 14 06:16:43 EDT 2017


Hi, 

I’m using a library that #includes a header file whose name is defined by a preprocessor macro. Unfortunately, scons does not seem to add this file to the dependency list of the file that does the #include

Here is a short example:

I have a hello.c file that is:

#include HELLO_H
#include <stdio.h>
int main() {
  printf(MESSAGE);
  return 0;
}

and a hello.h file that is:

#define MESSAGE "HELLO\n”

My SConstruct is:

env=Environment()
env.Append(CPPDEFINES={'HELLO_H':'\'"hello.h"\'’})
env.Program('hello.c’)


The hello program is not rebuilt when I edit the content of ‘hello.h’. 

Is there a workaround for that ? I know I can add a Depends(‘hello.c’, ‘hello.h’) , but that is not a very convenient solution for me, as I would have to do it in many places.

Best regards,
Julien
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://pairlist4.pair.net/pipermail/scons-users/attachments/20170314/23898d73/attachment.html>


More information about the Scons-users mailing list