I have a rather simple C++ project, which uses boost::regex library. The output I\'m getting is 3.5Mb in size. As I understand I\'m statically linking all boost .CPP files,
If you have your link order set correctly (most dependent followed by least dependent) the linker should only grab symbols that your program actually uses. Additionally, a lot (but not all, and I can't speak for regex) boost functionality is header-only due to template use.
More likely is that debugging information/symbol table/etc is taking up space in your binary. Template names (for example iostream and standard containers) are very long and create large entries in the symbol table.
You don't say what OS you're using but if it's a unix variant as a test you can actually strip
a copy of your binary to remove all the extra info and see what's left:
cp a.out a.out.test
strip a.out.test
ls -l a.out*
On one binary I tested it removed about 90% of the file size. Note that if you do this any cores will be pretty useless without a copy of the unstripped binary to debug against - you won't have any symbol names or anything, just assembly and addresses. 3.5 MB is really a tiny file in modern times. Most likely there just is that much debugging/symbol information even from only 10Ksloc of source.