Commit Graph

25 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 f94727a9c2 Record compile features for GNU on Windows (#15443)
Drop the 'UNIX' condition on GNU compiler features.

Suggested-by: David Demelier <demelier.david@gmail.com>
2015-03-17 13:32:08 -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 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 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
Brad King 47f1020b54 Merge topic 'fix-GNU-CXX-dialect-versions'
c03c184b Features: Record C++11 dialect switch only for GNU 4.7 and later.
2014-11-25 10:18:42 -05:00
Stephen Kelly c03c184be0 Features: Record C++11 dialect switch only for GNU 4.7 and later.
Previous versions of GNU are not currently supported by this
CMake feature.
2014-11-19 09:39:44 +01:00
Stephen Kelly 32b91b9e01 Features: Run GNU feature tests with std=c++14 when available. 2014-11-12 22:59:17 +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 dd043c3f21 Features: Add support for C++14 features.
Record the features implemented by GNU 4.9 and Clang 3.4.
2014-05-22 18:01:23 +02:00
Brad King f1d504d6cd Merge topic 'GNU-4.7-features'
9cbc63e4 Features: Record for GNU 4.7.
2014-05-08 11:28:03 -04:00
Stephen Kelly 9cbc63e40c Features: Record for GNU 4.7.
Update the CompileFeatures test to verify that unsupported features
do not work.
2014-05-07 22:02:02 +02:00
Stephen Kelly 1df2116bfa Features: Decay language flag if requested is not available.
Use the highest standard compile flags available if requested language
version is too new.

This supports use-cases like

 set(CMAKE_CXX_STANDARD 14)

 # Compiled with -std=c++11 with GNU 4.7, which has no -std=c++14
 # or equivalent flag
 add_executable(main main.cpp)

This can be used in combination with preprocessor defines which
communicate the availability of certain language features for
optional use.
2014-05-07 12:17:49 +02:00
Stephen Kelly c4f4dac2d5 Project: Fix exit-on-error with compile feature tests. 2014-05-07 12:16:14 +02:00
Stephen Kelly a36b957fc4 Features: Add cxx_template_template_parameters.
Extend the existing feature infrastructure as needed to support
both C++11 and C++98 features.
2014-04-16 15:16:23 +02:00
Stephen Kelly f97bf4370c Features: Add cxx_auto_type.
Record the availability of this feature for GNU 4.8 on (UNIX AND
NOT APPLE) only.  In the future, availability can be recorded for
earlier GNU, for other platforms and for other compilers. Initially
the affected configurations are as restricted as possible to allow
for easy testing while extending the features vector in only one
dimension.

The error message when using the set_property API directly is not
very good, but follow up commits will provide origin debugging of
the property and a target_compile_features command which will
provide a configure-time backtrace when possible.
2014-04-07 18:11:18 +02:00
Stephen Kelly 8238a6cd5d Add some COMPILE_OPTIONS for specifying C++ dialect.
These are compiler-specific, compiler version specific, extension specific
and standard version specific.
2014-04-07 16:48:44 +02:00
Stephen Kelly cd1fa537a0 Add a COMPILE_OPTION for a VISIBILITY_INLINES_HIDDEN target property.
This corresponds to the g++ and clang++
option -fvisibility-inlines-hidden on linux. On Windows with MinGW,
this corresponds to -fno-keep-inline-dllexport. That option is
not supported by clang currently.
2013-06-02 12:00:51 +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