Q:

How to override fprintf in the C library?  How to add GCC option to toplevel CMakeLists.txt? 

I know how to overwrite C-lib functions in just simple sample.  But what I need is IN A REAL PROJECT which has hundreds of files that call fprintf. 
In each file, there's a "#include < stdio.h >", and tens or hundreds of calls of fprintf.  I wanna make all these fprintf to do my own job.  I cannot remove the "stdio.h" and put a "#include < myprint.h >", where myprint.h defines the real function or macro of fprintf that do my own job. " stdio.h" has many other calls in the project.  I want a simple enough solution. 
Thanks! 
Do I make my question clear enough?... 
Update on 2014.03.08:
Salute to all women at first...
Please see my 2nd post below. 

A:

If you are using gcc for example, you can invoke it in the following way:
gcc -include myheader.h -Dfprintf=myfprintf file.c

And that will include myheader.h before every other include header in file.c and will redefine fprintf as myfprintf. 
You can find more details here

