Commit Graph

6 Commits

Author SHA1 Message Date
Brad King 150e1b27c5 Features: Extract strings from test binary more reliably (#15736)
Since commit v3.1.0-rc1~635^2~7 (project: Add infrastructure for
recording CXX compiler features, 2013-10-17) we compile a test source to
a binary and then extract "<LANG>_FEATURES:..." strings from the binary
with the file(STRINGS) command.  Add a newline at the beginning of the
string literal to be sure file(STRINGS) can extract the first entry as a
string independent of whatever else the compiler may put before the
storage it allocates for the literal within the binary.
2015-09-10 14:41:05 -04:00
Stephen Kelly f6f1095413 Features: Use the features symbol in the feature-test compile.
Clang discards the entire string if it is not used, removing
the ability to read the features from the compiled binary. That
is prevented by using the symbol.

GNU with -O3 also discards the string, so use the string in a
way which is determined by a runtime value (argc) to prevent
it being discarded.
2014-05-15 19:38:25 +02:00
Stephen Kelly 5bb7ce724c Project: Use nullary form of main for compile feature tests. 2014-05-07 12:16:13 +02:00
Stephen Kelly 64254e7a74 Project: Remove extern from static string in feature tests. 2014-05-07 12:16:13 +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 faeddf64f2 project: Add infrastructure for recording CXX compiler features
Add a feature test using the compiler macros and the preprocessor to
determine available features.

Add a CMAKE_CXX_COMPILE_FEATURES variable which contains all features
known to the loaded compiler, and a CMAKE_CXX_KNOWN_FEATURES variable
containing all features known to CMake.  Add language standard specific
variables for internal use to determine the standard-specific compile
flags to use.

This will be extended to other languages in the future.  Follow-up
commits will add features which will be recorded by the feature test.
2014-04-07 16:48:44 +02:00