Commit Graph

13 Commits

Author SHA1 Message Date
Brad King 441dba8032 Project: Guess default standard dialect if compiler was forced (#15852)
Prior to commit v3.4.0-rc1~71^2 (Project: Determine default language
dialect for the compiler, 2015-09-15) we always guessed the default
language standard dialect based on the compiler version.  This was not
reliable so that commit switched to computing the default language
standard dialect while detecting the compiler id.

When a toolchain file uses CMakeForceCompiler to set the compiler id
then the detection does not occur.  Therefore commit v3.4.0-rc1~54^2
(Project: Don't require computed default dialect if compiler was forced,
2015-09-22) made the lack of detection an error only if the compiler was
not forced.  However, this means that projects using CMakeForceCompiler
no longer even get the guess that we had before so <LANG>_COMPILER does
not work.

Due to the sophistication of CMake's compiler detection logic projects
should be ported away from using CMakeForceCompiler.  In the meantime,
restore a guess of the default language standard dialect when the
compiler is forced.
2015-11-19 10:22:35 -05:00
Stephen Kelly d13758514c Project: Don't require computed default dialect if compiler was forced.
Commit 7235334a (Project: Determine default language dialect for the
compiler., 2015-09-15) introduced a mechanism to determine the default
dialect used for the running compiler.  If conditions in
the <CompilerId>-<Lang>.cmake file are such that compile features for
that version of the compiler should be supported, the _DEFAULT_STANDARD
is set to the computed value.

However, the CMakeForceCompiler module allows users to bypass execution of the
compiler by CMake.  In that case, do not set the _DEFAULT_STANDARD variable at
all, which effectively disables the compile-features where the module is used.

No compile features have ever been recorded where the module is used so no
functionality is lost.
2015-09-22 22:13:15 +02:00
Stephen Kelly 7235334a2f Project: Determine default language dialect for the compiler.
Use the __cplusplus and __STDC_VERSION__ macros to automatically
determine the default dialect for the compiler while determining its
id and version.
2015-09-18 10:00:21 -04:00
Brad King 228643af6d AppleClang: Use modern C++14 standard flags for Apple Clang 6.1
The Apple Clang 6.1 compiler that comes with Xcode 6.3 is aware of the
modern -std=c++14 and -std=gnu++14 flags, so use them instead of the
"1y" flags.

Suggested-by: darkapostle@rule506.net
2015-07-09 09:11:57 -04:00
Stephen Kelly 9d767810e1 Features: Populate CMAKE_<LANG>_STANDARD_DEFAULT only for supported compilers.
If no compiler feature information is known for a given compiler
version, do not set a language standard default either.  The two
settings must be recorded consistently.
2015-02-04 18:29:53 -05:00
Stephen Kelly 82c9d6868b AppleClang: Remove redundant UNIX condition. 2015-02-04 18:28:06 -05:00
Stephen Kelly a60027a642 Features: Ensure appropriate return value from feature test macros.
GNU-CXX already has complex logic and sets the _result to 0 before
tests which may set it to something else.

Change the other modules to be consistent with that.
2015-01-15 22:13:21 +01:00
Stephen Kelly 3ad893b5c2 Features: Record for historical Xcode clang versions. 2015-01-11 16:52:27 +01:00
Stephen Kelly 98965fb12d Features: Record dialect flags for AppleClang 4.0+. 2015-01-11 16:52:05 +01:00
Stephen Kelly bd6b42c186 Features: Record for AppleClang 5.1
Apple's Clang 5.1 already supports most of the C and C++ features CMake
enumerates.
2014-12-22 10:44:41 -05:00
Fraser Hutchison 4d52cd36ad Avoid if() quoted auto-dereference when checking for "MSVC"
When testing CMAKE_<LANG>_COMPILER_ID values against "MSVC", do not
allow the definition of the "MSVC" variable to be expanded.
2014-11-19 16:24:54 -05:00
Stephen Kelly 59b5fdd37c Don't load Clang-CXX from AppleClang-CXX.
The Clang-CXX module is going to get version-specific checks, and
the version system for AppleClang is not the same as Clang.
2014-04-07 16:48:44 +02: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