I need to detect the OS name, compiler name, and version of the compiler with C++, as I need to change the setup for each case.
How can I do that?
Usually you leave that task to the build environment. Either using commands like uname if you can assume a posixy set up, or by any other mean which is deemed suitable.
uname