tools: preserve the order of CPPPATH/CPPDEFINES/LIBPATH/LIBS

The order of them are important while the uniqueness has nothing to do
with the compiling.
Merge pull request #349 from grissiom/fix-tools

tools: preserve the order of CPPPATH/CPPDEFINES/LIBPATH/LIBS