ENH: Unify design of CMakeCCompilerId.c, CMakeCXXCompilerId.cpp, and CMakePlatformId.h. BUG: Do not violate system-reserved symbol namespace _[A-Z].

This commit is contained in:
Brad King 2007-05-23 11:00:54 -04:00
parent 526b72e12c
commit 2d051a6709
3 changed files with 70 additions and 56 deletions

View File

@ -7,49 +7,50 @@
#endif
#if defined(__INTEL_COMPILER) || defined(__ICC)
#define _COMPILER_ID "Intel"
# define COMPILER_ID "Intel"
#elif defined(__BORLANDC__)
#define _COMPILER_ID "Borland"
# define COMPILER_ID "Borland"
#elif defined(__WATCOMC__)
#define _COMPILER_ID "Watcom"
# define COMPILER_ID "Watcom"
#elif defined(__SUNPRO_C)
#define _COMPILER_ID "SunPro"
# define COMPILER_ID "SunPro"
#elif defined(__HP_cc)
#define _COMPILER_ID "HP"
# define COMPILER_ID "HP"
#elif defined(__DECC)
#define _COMPILER_ID "Compaq"
# define COMPILER_ID "Compaq"
#elif defined(__IBMC__)
#define _COMPILER_ID "VisualAge"
# define COMPILER_ID "VisualAge"
#elif defined(__GNUC__)
#define _COMPILER_ID "GNU"
# define COMPILER_ID "GNU"
#elif defined(_MSC_VER)
#define _COMPILER_ID "MSVC"
# define COMPILER_ID "MSVC"
#elif defined(_COMPILER_VERSION)
#define _COMPILER_ID "MIPSpro"
# define COMPILER_ID "MIPSpro"
/* This compiler is either not known or is too old to define an
identification macro. Try to identify the platform and guess that
it is the native compiler. */
#elif defined(__sgi)
#define _COMPILER_ID "MIPSpro"
# define COMPILER_ID "MIPSpro"
#elif defined(__hpux) || defined(__hpua)
#define _COMPILER_ID "HP"
# define COMPILER_ID "HP"
#else /* unknown compiler */
#define _COMPILER_ID ""
# define COMPILER_ID ""
#endif
static char const info_compiler[] = "INFO:compiler[" _COMPILER_ID "]";
static char const info_compiler[] = "INFO:compiler[" COMPILER_ID "]";
/* Include the platform identification source. */
#include "CMakePlatformId.h"

View File

@ -5,42 +5,54 @@
# error "A C compiler has been selected for C++."
#endif
static char const info_compiler[] = "INFO:compiler["
#if defined(__COMO__)
"Comeau"
# define COMPILER_ID "Comeau"
#elif defined(__INTEL_COMPILER) || defined(__ICC)
"Intel"
# define COMPILER_ID "Intel"
#elif defined(__BORLANDC__)
"Borland"
# define COMPILER_ID "Borland"
#elif defined(__WATCOMC__)
"Watcom"
# define COMPILER_ID "Watcom"
#elif defined(__SUNPRO_CC)
"SunPro"
# define COMPILER_ID "SunPro"
#elif defined(__HP_aCC)
"HP"
# define COMPILER_ID "HP"
#elif defined(__DECCXX)
"Compaq"
# define COMPILER_ID "Compaq"
#elif defined(__IBMCPP__)
"VisualAge"
# define COMPILER_ID "VisualAge"
#elif defined(__GNUC__)
"GNU"
# define COMPILER_ID "GNU"
#elif defined(_MSC_VER)
"MSVC"
# define COMPILER_ID "MSVC"
#elif defined(_COMPILER_VERSION)
"MIPSpro"
# define COMPILER_ID "MIPSpro"
/* This compiler is either not known or is too old to define an
identification macro. Try to identify the platform and guess that
it is the native compiler. */
#elif defined(__sgi)
"MIPSpro"
# define COMPILER_ID "MIPSpro"
#elif defined(__hpux) || defined(__hpua)
"HP"
# define COMPILER_ID "HP"
#else /* unknown compiler */
""
# define COMPILER_ID ""
#endif
"]";
static char const info_compiler[] = "INFO:compiler[" COMPILER_ID "]";
/* Include the platform identification source. */
#include "CMakePlatformId.h"

View File

@ -1,78 +1,79 @@
/* Identify known platforms by name. */
#if defined(__linux) || defined(__linux__) || defined(linux)
#define _PLATFORM_ID "Linux"
# define PLATFORM_ID "Linux"
#elif defined(__CYGWIN__)
#define _PLATFORM_ID "Cygwin"
# define PLATFORM_ID "Cygwin"
#elif defined(__MINGW32__)
#define _PLATFORM_ID "MinGW"
# define PLATFORM_ID "MinGW"
#elif defined(__APPLE__)
#define _PLATFORM_ID "Darwin"
# define PLATFORM_ID "Darwin"
#elif defined(_WIN32) || defined(__WIN32__) || defined(WIN32)
#define _PLATFORM_ID "Windows"
# define PLATFORM_ID "Windows"
#elif defined(__FreeBSD__) || defined(__FreeBSD)
#define _PLATFORM_ID "FreeBSD"
# define PLATFORM_ID "FreeBSD"
#elif defined(__NetBSD__) || defined(__NetBSD)
#define _PLATFORM_ID "NetBSD"
# define PLATFORM_ID "NetBSD"
#elif defined(__OpenBSD__) || defined(__OPENBSD)
#define _PLATFORM_ID "OpenBSD"
# define PLATFORM_ID "OpenBSD"
#elif defined(__sun) || defined(sun)
#define _PLATFORM_ID "SunOS"
# define PLATFORM_ID "SunOS"
#elif defined(_AIX) || defined(__AIX) || defined(__AIX__) || defined(__aix) || defined(__aix__)
#define _PLATFORM_ID "AIX"
# define PLATFORM_ID "AIX"
#elif defined(__sgi) || defined(__sgi__) || defined(_SGI)
#define _PLATFORM_ID "IRIX"
# define PLATFORM_ID "IRIX"
#elif defined(__hpux) || defined(__hpux__)
#define _PLATFORM_ID "HP-UX"
# define PLATFORM_ID "HP-UX"
#elif defined(__BeOS) || defined(__BEOS__) || defined(_BEOS)
#define _PLATFORM_ID "BeOS"
# define PLATFORM_ID "BeOS"
#elif defined(__QNX__) || defined(__QNXNTO__)
#define _PLATFORM_ID "QNX"
# define PLATFORM_ID "QNX"
#elif defined(__tru64) || defined(_tru64) || defined(__TRU64__)
#define _PLATFORM_ID "Tru64"
# define PLATFORM_ID "Tru64"
#elif defined(__riscos) || defined(__riscos__)
#define _PLATFORM_ID "RISCos"
# define PLATFORM_ID "RISCos"
#elif defined(__sinix) || defined(__sinix__) || defined(__SINIX__)
#define _PLATFORM_ID "SINIX"
# define PLATFORM_ID "SINIX"
#elif defined(__UNIX_SV__)
#define _PLATFORM_ID "UNIX_SV"
# define PLATFORM_ID "UNIX_SV"
#elif defined(__bsdos__)
#define _PLATFORM_ID "BSDOS"
# define PLATFORM_ID "BSDOS"
#elif defined(_MPRAS) || defined(MPRAS)
#define _PLATFORM_ID "MP-RAS"
# define PLATFORM_ID "MP-RAS"
#elif defined(__osf) || defined(__osf__)
#define _PLATFORM_ID "OSF1"
# define PLATFORM_ID "OSF1"
#elif defined(_SCO_SV) || defined(SCO_SV) || defined(sco_sv)
#define _PLATFORM_ID "SCO_SV"
# define PLATFORM_ID "SCO_SV"
#elif defined(__ultrix) || defined(__ultrix__) || defined(_ULTRIX)
#define _PLATFORM_ID "ULTRIX"
# define PLATFORM_ID "ULTRIX"
#elif defined(__XENIX__) || defined(_XENIX) || defined(XENIX)
#define _PLATFORM_ID "Xenix"
# define PLATFORM_ID "Xenix"
#else /* unknown platform */
#define _PLATFORM_ID ""
# define PLATFORM_ID ""
#endif
static char const info_platform[] = "INFO:platform[" _PLATFORM_ID "]";
static char const info_platform[] = "INFO:platform[" PLATFORM_ID "]";