Commit Graph

35 Commits

Author SHA1 Message Date
Brad King c2d590c957 Features: Update MSVC features for VS 2015 RTM
VS 2015 RTM completed support for constexpr and attribute features.
Update our feature table and test accordingly.
2015-07-21 12:56:47 -04:00
Stephen Kelly fb3487a997 Features: Fix C90 feature detection.
This bug caused c_function_prototypes to not be recorded at configure
time when compiling with -std=gnu99 or similar. In the case of feature
recording, that was not a problem, because the logic in
CMakeDetermineCompileFeatures.cmake currently assumes that a feature
present for an earlier standard is present for a later standard.

However, the detection strings are also used in WriteCompilerDetectionHeader,
so the feature macro has been defined to '0' when using a later language
dialect.

Fix that by not checking the existence of the __STDC_VERSION__ macro at
all when detecting C90 features.
2015-02-04 18:38:21 -05:00
Robert Maynard d3489bdb0b Features: Record for MSVC 2010-2015
Also, in WCDH add MSVC Compatibility for cxx_align{of,as}.

Co-Author: Stephen Kelly <steveire@gmail.com>
Co-Author: Brad King <brad.king@kitware.com>
2015-01-30 09:57:33 -05:00
Brad King 3228fc5049 Features: Define meaning for no language standard default
Define an empty string in CMAKE_<LANG>_STANDARD_DEFAULT to mean that
the toolchain has no notion of lanuage standard levels.  In this case
the <LANG>_STANDARD[_REQUIRED] properties will have no effect.

Update the RunCMake.CompileFeatures test to exclude the
LinkImplementationFeatureCycle test when there is no standard default.
It can never fail because no use of specific features will adjust the
CXX_STANDARD level required for any target since the standard levels
have no meaning in this case.
2015-01-29 15:01:40 -05:00
Brad King 9f559a2608 Merge topic 'GNU-4.4-compile-features'
374a66b5 Features: Blacklist raw string literals test for GNU 4.4
2015-01-23 10:50:22 -05:00
Brad King be2a74dbcb Merge topic 'GNU-4.4-compile-features'
965a50dc Features: Fix GNU 4.4 and 4.5 C standard level flags
7f4154a4 Features: Fix CompileFeatures non-feature tests for space in path
f40c19b5 Features: Fix CompileFeatures test for C non-features
2015-01-22 09:50:36 -05:00
Brad King 374a66b58c Features: Blacklist raw string literals test for GNU 4.4
RedHat gcc 4.4.7-11 supports raw string literals, so simply blacklist
the test for its rejection.
2015-01-22 09:39:35 -05:00
Brad King 7f4154a4aa Features: Fix CompileFeatures non-feature tests for space in path
Fix the <lang>_non_features try_compile calls to work correctly when
there is a space in the path.  Otherwise they all fail due to the space
instead of the lack of a feature.
2015-01-21 15:42:08 -05:00
Brad King 813ace90e4 Merge topic 'GNU-4.4-compile-features'
004e1540 Features: Record for GNU 4.4.
2a5ca650 Features: Wrap failure-test in UNIX condition.
1ae2c6b2 Features: Blacklist cxx_constexpr test for GNU 4.5.
c66e3317 Features: Use a more-common feature in cycle-test.
c43a6dc5 Features: Update comment in test to match the code.
78259135 Features: Test presence of cxx_auto_type with genex.
7b9fc88b Features: Remove outdated comment.
2015-01-19 13:55:31 -05:00
Stephen Kelly 1ae2c6b2c9 Features: Blacklist cxx_constexpr test for GNU 4.5. 2015-01-18 14:46:55 +01:00
Stephen Kelly 782591350c Features: Test presence of cxx_auto_type with genex.
The purpose of that test is to cover the case where the genex
reports '1', and the feature is chosen to be present on all/most
supported compilers.  GNU 4.4 does not support cxx_nullptr.
2015-01-17 16:07:53 +01:00
Stephen Kelly bcb04783f7 Features: Record for SolarisStudio 12.4.
It has similar C++11 capabilities compared to GCC 4.8.
2015-01-17 14:48:28 +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 06ff525492 Features: Extend the tests for the COMPILE_FEATURES genex. 2015-01-15 21:51:18 +01:00
Stephen Kelly 3ad893b5c2 Features: Record for historical Xcode clang versions. 2015-01-11 16:52:27 +01:00
Robert Maynard a15675efc3 Features: Quote all compiler names when comparing with COMPILER_ID
In preparation of adding MSVC support we need to quote all compiler names,
as MSVC is also a CMake variable.
2015-01-11 16:47:58 +01:00
Stephen Kelly 6296192def Features: Add a comment explaining part of test. 2015-01-03 15:18:39 +01:00
Stephen Kelly c13656e717 Features: Test nullptr as a side-effect activation of static_assert.
Because not all compilers under test support the existing 'activation
features', add another test to ensure that compilers which support
both static_assert and nullptr behave as expected in this test.
2015-01-03 15:14:52 +01:00
Stephen Kelly 3e34e8331a Features: Test feature propagation with more-common features.
The purpose of the feature listing in these tests is to make other
features from the same feature set (eg "C++11 features") available.

The compilers under test until now have supported these 'activation
features', but MSVC does not.  Use the cxx_static_assert feature
instead to activate the feature set.
2015-01-03 15:11:04 +01:00
Stephen Kelly b3e86f4e97 Features: Test an expectation of whether OVERRIDE_CONTROL is expected
The tests below test the presence of both cxx_final and cxx_override,
only one of which is supported by MSVC.  The test is in part intended
to verify that the COMPILE_FEATURES genex supports multiple arguments
and allows users to define names for groups of features (Clang already
calls cxx_final and cxx_override 'override control' as a group).  Keep
the test, and allow the expectation to be set as appropriate.
2015-01-03 15:09:58 +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 7565ab2cd1 Features: Test the CXX compiler only if it has features.
If using different C and CXX compilers, we might not have a
feature-full CXX compiler at this point.
2014-11-19 00:42:35 +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
Stephen Kelly 0dfe395e3c Features: Add COMPILE_FEATURES generator expression.
Allow setting build properties based on the features available
for a target.  The availability of features is determined at
generate-time by evaluating the link implementation.

Ensure that the <LANG>_STANDARD determined while evaluating
COMPILE_FEATURES in the link implementation is not lower than that
provided by the INTERFACE of the link implementation.  This is
similar to handling of transitive properties such as
POSITION_INDEPENDENT_CODE.
2014-05-21 17:22:32 +02: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
Stephen Kelly 6a9fdbeb48 Test: Parameterize the language in the CompileFeature test. 2014-05-09 17:29:05 +02:00
Stephen Kelly f5bf9d4311 Tests: Make CompileFeature tests use highest standard known.
Remove the use of check_cxx_source_compiles which is now just getting in
the way.

Blacklist the cxx_alignof feature in the test with GNU 4.7. The test
file compiles, but it is documented as available first in GNU 4.8.
2014-05-09 14:39:30 +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 205215fb8a cmTarget: Add CXX_STANDARD_REQUIRED to control decay. 2014-05-07 12:17:49 +02:00
Stephen Kelly 3fdfa5d3fc Features: Make CMAKE_CXX_KNOWN_FEATURES a property.
As a 'built-in' variable it imposes a cost on all variable lookups
and it is expected to be rarely used.
2014-05-02 10:18:16 +02:00
Stephen Kelly 447fbb3fac Tests: Execute compile features tests unconditionally.
Conditionally create a dummy test if there are no known features.
2014-04-17 16:20:50 +02:00
Stephen Kelly 5412deded1 cmTarget: Transitively evaluate compiler features.
Extend the interface of the target_compile_features command with
PUBLIC and INTERFACE keywords. Populate the INTERFACE_COMPILER_FEATURES
target property if they are set. Consume the INTERFACE_COMPILER_FEATURES
target property from linked dependent targets to determine the final
required compiler features and the compile flag, if needed.

Use the same pattern of origin-debugging which is used for other
build properties.
2014-04-07 18:11:18 +02:00
Stephen Kelly baff44345c cmTarget: Allow populating COMPILE_FEATURES using generator expressions.
Delay validation of the content as a feature if it contains a
generator expression. It will be checked again at generate-time
after evaluation.
2014-04-07 18:11:18 +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