logological / gpp

GPP, a generic preprocessor
https://logological.org/gpp
GNU Lesser General Public License v3.0
192 stars 33 forks source link

Add support for "sysroot" #28

Open duncanmac99 opened 5 years ago

duncanmac99 commented 5 years ago

In the GNU C pre-processor, an argument called '-isysroot' (or '--sysroot', depending on circumstances) is allowed to specify the first part of the path or paths used in '-I' arguments. Any given '-I' argument may then reference the path given in the "sysroot" argument by starting the path with an '='. If either of those arguments appear on the compiler command line, it is used for both the pre-processor and the linker (for libraries); if both appear, the '-isysroot' argument is given to the pre-processor, and the other one goes to the linker.

Not clear is what happens if there is more than one '--sysroot' argument on the command-line, or whether that argument must appear before or after the '-I' arguments.

Support for just the '--sysroot' argument would make sense and allow paths given to each '-I' argument to be shorter.

duncanmac99 commented 5 years ago

If we are running under Windows/DOS, we may want to incorporate support for the Windows call "GetSystemDirectory". For more details:

https://msdn.microsoft.com/en-us/library/windows/desktop/ms724373(v=vs.85).aspx