Commit Graph

46 Commits

Author SHA1 Message Date
Brad King a85e17e660 Intel: When simulating MSVC, re-use Windows-MSVC (#14476)
Teach CMake(C|CXX|Fortran)CompilerId* to report the MSVC version
simulated by the Intel compiler, if any.  Refactor the Windows-Intel
platform information helper module to load Windows-MSVC instead of
duplicating the information.  Teach Windows-MSVC to understand when
it is loaded as the simulated Fortran compiler (its preprocessor is
simulated).
2013-10-18 09:55:59 -04:00
Brad King 12a7e2b10c Merge topic 'apple-clang-id'
1763c31 Set policy CMP0025 to NEW while building CMake itself
aa53ee5 Add policy CMP0025 for Apple Clang compiler id compatibility
ab65862 Clang: Add separate "AppleClang" compiler id
2013-10-09 10:21:28 -04:00
Brad King ab65862417 Clang: Add separate "AppleClang" compiler id
Apple distributes their own Clang build with their own version numbers
that differ from upstream Clang.  Use the __apple_build_version__ symbol
to identify the Apple Clang compiler and report the Apple Build Version
as the fourth version component in CMAKE_<LANG>_COMPILER_VERSION.  Add
Compiler/AppleClang-<lang> and Platform/Darwin-AppleClang-<lang> modules
that simply include the upstream equivalents.

Fix comparisons of CMAKE_<LANG>_COMPILER_ID to Clang in CMake's own
source and tests to account for AppleClang.
2013-10-07 20:12:46 -04:00
Brad King 3d8356d486 Clang: Support Windows variants for GNU and MSVC (#13035, #14458)
Teach the compiler identification preprocessor tests to report when
Clang simulates MSVC, and what version.  If not MSVC, assume GNU.

Teach compiler information modules Clang-(C|CXX) to recognize when Clang
simulates MSVC and skip loading the GNU information.

Teach the Windows-MSVC platform information to recognize when it is
loaded as the simulated compiler and use that version information
instead of the real compiler's (different) version scheme.

Add platform modules Windows-Clang-(C|CXX) and support module
Windows-Clang to load either Windows-MSVC or Windows-GNU and wrap
the corresponding information macros.
2013-10-04 13:39:22 -04:00
Brad King 51ab85c398 CMakeDetermineCompilerId: Add notion of "simulated" id/version
Some compilers try to simulate other compilers as a drop-in replacement
supporting all the same command-line options and predefined preprocessor
macros.  In such cases it will be useful to have CMake load the compiler
information files for the simulated compiler instead of duplicating the
information.  Teach CMakeDetermineCompilerId to extract the simulated
compiler id and version when the compiler id detection provides it.
2013-10-04 13:25:06 -04:00
Alex Neundorf d118b8b389 Add IAR to the CMakeDetectC(XX)CompilerID.c(pp).in
With the AVR IAR compiler this can't be found, but it works e.g. for the
ARM AVR compiler.

Alex
2013-04-15 09:14:35 -04:00
Alex Neundorf b3015862e5 rename TI_DSP toolchain to TI, since it works also for the ARM compiler
Additionally, look for a special ar and strip

Alex
2013-03-14 21:47:59 +01:00
Patrick Gansterer 8e85822e2b VS: Add the entry point when compiling for WindowsCE
Set the entry point to mainACRTStartup to make sure that main()
can be found when linking the application to check the compiler.
2012-11-30 15:15:06 +01:00
Patrick Gansterer 40c36c9f7b VS: Make DetermineCompilerId working with WinCE too
Add a dummy mainCRTStartup() function, since the linker searches for
it instead of main() and set the CMAKE_SYSTEM_* variables depending
on the MSVC_C_ARCHITECTURE_ID and CMAKE_VS_WINCE_VERSION variables.
2012-11-27 08:31:19 -05:00
Brad King fccf19f49b Fix PathScale compiler id for Clang-based upstream
Upstream PathScale now uses Clang as its front-end.  Test for __PATHCC__
before __clang__.

Reported-by: C. Bergström <cbergstrom@pathscale.com>
2012-11-05 08:33:54 -05:00
Brad King e9bc502fb8 Detect Analog VisualDSP++ compiler version with its id
Decode hex digits from __VISUALDSPVERSION__ to compute the version
number components.  Note that the constant encodes decimal digits as hex
digits (never larger than 9).  We represent them as decimal after
extraction.  See documentation at:

  http://download.analog.com/dsp/tools/VisualDSP_45_Update_6_Release_Note_v4.pdf
  http://www.analog.com/static/imported-files/software_manuals/50_asm_man.rev3.1.pdf

Note that __VISUALDSPVERSION__ was introduced in version 4.5.6.
2012-08-22 11:48:07 -04:00
Brad King cca386b0a0 Detect Cray compiler version with its id
Decode decimal digits from

  _RELEASE
  _RELEASE_MINOR

to compute version number components.  See documentation at:

  http://docs.cray.com/books/S-2179-52/html-S-2179-52/zfixed5fvzxnxo.html
  http://sourceforge.net/p/predef/wiki/Compilers/#cray-c
2012-08-22 11:31:33 -04:00
Brad King 622d9a789d Detect SDCC compiler version with its id
Decode decimal digits from SDCC to compute version number components.
See documentation at:

  http://sdcc.sourceforge.net/doc/sdccman.pdf
  http://sourceforge.net/p/predef/wiki/Compilers/#small-device-c-compilerhttpenwikipediaorgwikismall_device_c_compiler
2012-08-22 10:27:09 -04:00
Brad King 952651c642 Detect TI compiler version with its id
Decode decimal digits from __TI_COMPILER_VERSION__ to compute version
number components.  See documentation at:

  http://processors.wiki.ti.com/index.php/Refer_to_Compiler_Version_in_Your_Source
  http://www.ti.com/general/docs/lit/getliterature.tsp?literatureNumber=spru187o
  http://sourceforge.net/p/predef/wiki/Compilers/#texas-instruments-cc-compiler
2012-08-22 10:17:01 -04:00
Brad King 74c57d99b4 Detect PathScale compiler version with its id
Decode decimal digits from

  __PATHCC__
  __PATHCC_MINOR__
  __PATHCC_PATCHLEVEL__

to compute version number components.  See documentation at:

  http://www.pathscale.com/docs/UserGuide.pdf
  http://sourceforge.net/p/predef/wiki/Compilers/#ekopathhttpenwikipediaorgwikipathscale
2012-08-22 10:17:01 -04:00
Brad King 707aefd853 Detect Compaq compiler version with its id
Decode decimal digits from __DECC_VER and __DECCXX_VER to compute
version number components.  See documentation at:

  http://www.openvms.compaq.com/commercial/c/docs/5492p024.html#decc_ver_sec
  http://www.tru64unix.compaq.com/cplus/ugu_impl.html#predef_vernum
  http://sourceforge.net/p/predef/wiki/Compilers/#compaq-cchttpwwwopenvmscompaqcomopenvmsbrochuresdeccplus
2012-08-22 10:17:01 -04:00
Brad King bdbbf763d6 Recognize Embarcadero compiler (#12604)
The Borland compiler was re-branded as CodeGear during 2007-2009 and
since 2009 is the Embarcadero compiler.  They offer predefined macros:

  http://docwiki.embarcadero.com/RADStudio/en/Predefined_Macros

and distinguish themselves by __CODEGEARC__ and __CODEGEARC_VERSION__.

Version 6.30 (C++Builder XE) changed the meaning of some flags:

  http://docwiki.embarcadero.com/RADStudio/en/C%2B%2B_Compiler_Option_Changes_for_XE

Teach Embarcadero compiler information files to generate build rules
with flags matching the compiler version.  Leave the flags unchanged
for old Borland versions.  Always set the BORLAND toolchain indicator
for compatibility with existing projects that test it.  Also set the
EMBARCADERO indicator for newer toolchains.
2012-02-20 10:09:44 -05:00
David Cole 4dd47eb6c3 Merge topic 'compiler-version'
0df1942 Detect SGI MIPSpro compiler version with its id
a5e892c Document compiler version macro formats used for detection
d7c6f41 Detect HP compiler version with its id
3dd9fa9 Detect SunPro compiler version with its id
c198730 Detect Watcom compiler version with its id
5899b98 Detect Clang compiler version with its id
b8cfa65 Detect PGI compiler version with its id
6dae666 Detect IBM XL compiler version with its id
4080d55 Detect Borland compiler version with its id
2cc205a Detect Intel compiler version with its id (#11937)
a6d83cc Detect MSVC compiler version with its id
a662855 Detect GNU compiler version with its id (#6251)
fa7141f Add framework to detect compiler version with its id (#12408)
2012-01-17 16:22:53 -05:00
Brad King 0df1942a72 Detect SGI MIPSpro compiler version with its id
Decode decimal digits from _SGI_COMPILER_VERSION or _COMPILER_VERSION to
compute version number components.  See documentation at:

  http://predef.sourceforge.net/precomp.html
2012-01-10 13:29:39 -05:00
Brad King a5e892ca1f Document compiler version macro formats used for detection
The MSVC, HP, XL, SunPro, Watcom, Borland, and Intel compilers specify
their version number in components encoded in a single integer value.
Document the components that we use to compute version numbers.
2012-01-10 13:24:38 -05:00
Brad King d7c6f410f9 Detect HP compiler version with its id
Decode decimal digits from __HP_cc and __HP_aCC to compute version
number components.  See documentation at:

  http://predef.sourceforge.net/precomp.html
  http://g4u0420c.houston.hp.com/en/14487/preprocess.htm
2012-01-10 13:07:04 -05:00
Brad King 3dd9fa9d6a Detect SunPro compiler version with its id
Decode hex digits from __SUNPRO_C and __SUNPRO_CC to compute the version
number components.  Note that the constant encodes decimal digits as hex
digits (never larger than 9).  We represent them as decimal after
extraction.  See documentation at

  http://predef.sourceforge.net/precomp.html

Although the documented version number format is

  0xVRP where V = Version, R = Revision, P = Patch

it holds only though SunPro C/C++ version 5.9.  Later versions have
a two-digit revision (minor) number so their format is 0xVRRP.
2012-01-10 11:59:14 -05:00
Brad King c198730b45 Detect Watcom compiler version with its id
Decode decimal digits from __WATCOMC__ to compute the version number
components.  See documentation at:

  http://predef.sourceforge.net/precomp.html
2011-12-07 09:39:50 -05:00
Brad King 5899b988d5 Detect Clang compiler version with its id
Decode decimal digits from

  __clang_major__
  __clang_minor__
  __clang_patchlevel__

to compute version number components.  See documentation at:

  http://clang.llvm.org/docs/LanguageExtensions.html#builtinmacros
  http://predef.sourceforge.net/precomp.html
2011-12-07 09:39:49 -05:00
Brad King b8cfa656ce Detect PGI compiler version with its id
Decode decimal digits from

  __PGIC__
  __PGIC_MINOR__
  __PGIC_PATCHLEVEL__

to compute version number components.
2011-12-07 09:39:48 -05:00
Brad King 6dae6660fc Detect IBM XL compiler version with its id
Decode decimal digits from __IBMC__ and __IBMCPP__ to compute version
number components.  See documentation at:

  http://predef.sourceforge.net/precomp.html
  http://publib.boulder.ibm.com/infocenter/comphelp/v111v131/topic/com.ibm.xlc111.aix.doc/compiler_ref/xlmacros.html
  http://publib.boulder.ibm.com/infocenter/comphelp/v111v131/topic/com.ibm.xlcpp111.aix.doc/compiler_ref/xlmacros.html
2011-12-07 09:39:47 -05:00
Brad King 4080d5510e Detect Borland compiler version with its id
Decode hex digits from __BORLANDC__ to compute the version number
components.  Note that the constant encodes decimal digits as hex digits
(never larger than 9).  We represent them as decimal after extraction.
See documentation at

  http://predef.sourceforge.net/precomp.html
  http://docwiki.embarcadero.com/RADStudio/en/Predefined_Macros
2011-12-07 09:39:46 -05:00
Brad King 2cc205a0fb Detect Intel compiler version with its id (#11937)
Decode decimal digits from

  __INTEL_COMPILER
  __INTEL_COMPILER_BUILD_DATE

to compute the version number components.  See documentation at:

  http://predef.sourceforge.net/precomp.html
  http://software.intel.com/sites/products/documentation/hpc/compilerpro/en-us/fortran/lin/compiler_f/bldaps_for/common/bldaps_use_presym.htm
2011-12-07 09:39:45 -05:00
Brad King a6d83ccea9 Detect MSVC compiler version with its id
Decode decimal digits from _MSC_VER, _MSC_FULL_VER, and _MSC_BUILD to
compute the version number components.  See documentation at:

  http://msdn.microsoft.com/en-us/library/b0084kay.aspx
  http://predef.sourceforge.net/precomp.html
2011-12-07 08:59:53 -05:00
Brad King a66285583d Detect GNU compiler version with its id (#6251)
Decode decimal digits from

  __GNUC__
  __GNUC_MINOR__
  __GNUC_PATCHLEVEL__

to compute version components.  See documentation at

  http://gcc.gnu.org/onlinedocs/cpp/Common-Predefined-Macros.html
  http://predef.sourceforge.net/precomp.html
2011-12-07 08:59:52 -05:00
Brad King fa7141f5ad Add framework to detect compiler version with its id (#12408)
Teach CMakePlatformId.h to construct an "INFO:compiler_version[]" string
literal from macros COMPILER_VERSION_(MAJOR|MINOR|PATCH|TWEAK) to be
defined in CMake(C|CXX)CompilerId.(c|cpp) for each compiler.  Provide
conversion macros DEC() and HEX() to decode decimal or hex digits from
integer values.  Parse the version out of the compiler id binary along
with the other INFO values already present.

Store the result in variable CMAKE_<LANG>_COMPILER_VERSION in the format
"major[.minor[.patch[.tweak]]]".  Save the value persistently in
CMake(C|CXX)Compiler.cmake in the build tree.  Document the variable for
internal use since we do not set it everywhere yet.

Report the compiler version on the compiler id result line e.g.

  The C compiler identification is GNU 4.5.2

Report CMAKE_(C|CXX)_COMPILER_(ID|VERSION) in SystemInformation test.
2011-12-07 08:59:51 -05:00
Brad King 1f49d725ab Recognize the Tiny C Compiler (#12605)
See compiler home page here:

  http://tinycc.org/
  http://bellard.org/tcc/

Use the id "TinyCC" as it appears in their online documentation.
2011-12-02 10:08:34 -05:00
Brad King db05da35d2 Recognize SCO UnixWare C/C++ compilers (#11700)
These compilers define __SCO_VERSION__ as VvvYYYYMML:

     V = major version
    vv = minor version
  YYYY = release year
    MM = release month

http://osr600doc.sco.com/en/manCP/cc.CP.html
http://osr600doc.sco.com/en/manCP/CC.CP.html
2011-01-17 09:52:33 -05:00
Brad King 79f5a7c098 Merge topic 'compiler-id-literal-const'
dbc79bd Fix constness in compiler id detection
2011-01-04 15:44:56 -05:00
Brad King dbc79bd8c8 Fix constness in compiler id detection
Since commit 70c2dc8a (Make compiler id detection more robust,
2008-03-10) we store compiler identification strings in test binaries
using the form

  char* info = "info";

Use the const-correct

  char const* info = "info";

form instead.  This allows the C++ compiler identification to work with
"-Werror -Wall" or equivalent flags if the compiler would warn about
const-to-non-const conversion.
2010-12-29 15:35:15 -05:00
Wojciech Migda f1392dc90b Recognize the Texas Instruments DSP compiler (#11645)
The TI DSP compiler predefines "__TI_COMPILER_VERSION__".  Use this to
identify the C and C++ compilers.  For assembler language the C compiler
executable is used:

  $ cl6x -h
  TMS320C6x C/C++ Compiler v6.1.11
  Tools Copyright (c) 1996-2009 Texas Instruments Incorporated

Use this command-line option and output to recognize the assembler.
2010-12-28 12:22:38 -05:00
Brad King 53e76c8f12 Teach CMake about Cray C, C++, and Fortran compilers
The Cray Fortran compiler needs "-em" to enable module output and also
"-J." to place the .mod files in the current working directory (instead
of next to the .o file).
2010-11-12 09:12:08 -05:00
Brad King 571dc74891 Recognize Clang C and C++ compilers (see #10693)
Map to the platform and compiler information for GNU because the
compilers are command-line compatible for common operations.  Later we
can add Clang-specific features as necessary.  We honor the preferred
capitalization is "Clang", not the common mis-spelling "CLang".
2010-05-17 14:11:20 -04:00
Brad King 1e9f58e605 Recognize the PathScale C/C++/Fortran compilers 2010-01-13 12:12:39 -05:00
Bill Hoffman 4430bccc70 Change the way 32/64 bit compiles are detected with MSVC and intel makefile builds. Use the platform ID preprocessor approach. 2009-11-19 21:58:42 -05:00
Brad King 115ecc5750 Teach compiler id about VisualAge -> XL rebranding
IBM rebranded its VisualAge compiler to XL starting at version 8.0.  We
use the compiler id "XL" for newer versions and "VisualAge" for older
versions.  We now also recognize the "z/OS" compiler, which is distinct
from XL.
2009-08-07 10:13:07 -04:00
Brad King 69e366f49b ENH: Check _SGI_COMPILER_VERSION for compiler id
Some SGI compilers define _SGI_COMPILER_VERSION in addition to the old
_COMPILER_VERSION preprocessor symbol.  It is more distinctive, so we
should check it in case the old one is ever removed.
2009-07-14 15:17:21 -04:00
Brad King b8fc8b324d ENH: Improve robustness of compiler INFO strings
Compiler INFO strings built at preprocessing time encode information
that must appear as a string literal in the resulting binary.  We must
make sure the strings appear in the final binary no matter what compiler
and flags are used.  The previous implementation worked in most places
but failed with the GNU linker's --gc-sections option which managed to
discard the string.  Instead we make the program return value depend on
an element of the string indexed by a runtime program parameter, which
absolutely requires the string to be present.
2008-08-07 09:09:45 -04:00
Brad King 70c2dc8a64 ENH: Make compiler id detection more robust
- Split INFO strings in source into multiple pieces
    to make sure assembly or other listings produced
    by the compiler are never matched by the regex
  - Store INFO strings via pointer instead of array
    to convince some compilers to store the string
    literally in the binary
  - This should help make it work for sdcc 2.8.0 RC1
2008-03-10 09:32:25 -04:00
Brad King 83c5f1b3f0 ENH: Add support to C compiler identification for void return type from main. Cross-compilers for embedded platforms may require it. 2008-02-25 18:47:19 -05:00
Brad King 9211b0d234 ENH: Improvied compiler identification robustness
- Write a single source file into the compiler id directory
  - This avoid requiring the compiler to behave correctly with
    respect to include rules and the current working directory
  - Helps to identify cross-compiling toolchains with unusual
    default behavior
2008-02-25 09:23:14 -05:00