Commit Graph

15 Commits

Author SHA1 Message Date
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
Brad King 965a50dcea Features: Fix GNU 4.4 and 4.5 C standard level flags
The C90 flags were only the "89" versions until GNU 4.5.
The C11 flags were not introduced until GNU 4.6.
2015-01-21 15:47:13 -05:00
Stephen Kelly 004e1540e0 Features: Record for GNU 4.4. 2015-01-18 15:01:15 +01:00
Stephen Kelly b15c008fac Features: Record for GNU 4.6.
Adjust the CompileFeatures genex_test for the expectation of the
OVERRIDE_CONTROL feature group.
2015-01-16 00:11:01 +01:00
Stephen Kelly 6e909035af Features: Record C/CXX dialect flags for GNU 4.6.
This release was prior to standardization of C11/CXX11.
2015-01-15 22:13:22 +01:00
Stephen Kelly bfc995cc3b Features: Remove wrong content from else() condition.
As this is not elseif(), the content has no effect.

Rather than changing it to an elseif(), remove the conditional content.
All versions of GNU prior to 5.0 default to C90/89.

Clang-C.cmake has a similar code block which correctly uses
elseif() for setting the default C dialect to C99.  That may have
been updated from a C90 default at some point, so leave the
version condition there in place for now.
2015-01-15 22:13:22 +01: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 00f66a0451 Record compile features for GNU on Apple.
Tested with GNU 4.8 binary (bottle) from homebrew, and assumed to work
with the others.
2015-01-11 18:34:25 +01:00
Stephen Kelly f327a9fd26 Merge branch 'default-lang-dialect' into step2
Conflicts:
	Modules/Compiler/Clang-C.cmake
2014-11-20 22:11:56 +01:00
Stephen Kelly a3d0ae1758 Features: Fix the default C dialect for Clang and GNU.
Clang 3.4 uses C99 by default, and Clang 3.6 uses C11 by default:

 http://thread.gmane.org/gmane.comp.compilers.clang.devel/39379

GNU 4.9 uses C90 by default, and GNU 5.0 uses C11 by default:

 https://gcc.gnu.org/gcc-5/changes.html

Test that the default compiler settings result in the expected dialect
macros being defined for both C and CXX.  Remove the unused main.c
file from the CompileFeatures unit test.
2014-11-20 18:24:59 +01:00
Stephen Kelly 82c283f914 Features: Use the correct dialect flag when recording features.
Avoid using -std=c++1y for compilers which support -std=c++14, for
example.
2014-11-12 22:59:17 +01:00
Stephen Kelly b18155b788 Features: Reorder the GNU C dialect feature tests
This doesn't make a difference, but the consistency with other files
is easier to reason about.
2014-11-12 22:59:14 +01:00
Stephen Kelly e0890d03a4 Features: Extend concept to C language.
Add properties and variables corresponding to CXX equivalents.

Add features for c_function_prototypes (C90), c_restrict (C99),
c_variadic_macros (C99) and c_static_assert (C11). This feature
set can be extended later.

Add a <PREFIX>_RESTRICT symbol define to WriteCompilerDetectionHeader
to conditionally represent the c_restrict feature.
2014-05-15 00:15:18 +02:00
Brad King e28c16b482 Split GNU compiler information files
This moves GNU compiler flags into new-style modules

  Compiler/GNU-<lang>.cmake
  Platform/<os>-GNU-<lang>.cmake

We use language-independent helper modules

  Compiler/GNU.cmake
  Platform/<os>-GNU.cmake

to define macros consolidating the information.
2009-12-02 09:52:00 -05:00
Brad King 07ea19ad1f ENH: Implicit link info for C, CXX, and Fortran
This teaches CMake to detect implicit link information for C, C++, and
Fortran compilers.  We detect the implicit linker search directories and
implicit linker options for UNIX-like environments using verbose output
from compiler front-ends.  We store results in new variables called

  CMAKE_<LANG>_IMPLICIT_LINK_LIBRARIES
  CMAKE_<LANG>_IMPLICIT_LINK_DIRECTORIES

The implicit libraries can contain linker flags as well as library
names.
2009-07-23 10:07:25 -04:00