summaryrefslogtreecommitdiff
path: root/Modules/Internal/FeatureTesting.cmake
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2015-09-10 14:37:20 -0400
committerBrad King <brad.king@kitware.com>2015-09-10 14:41:05 -0400
commit150e1b27c54cf4e19e19ad7836e6bbfb9fbb5266 (patch)
treee58ef54fa0f8f2b8131178255143037a5c936373 /Modules/Internal/FeatureTesting.cmake
parent72797dec8f8dca151d821be57b78a04ba27e1d5e (diff)
downloadcmake-150e1b27c54cf4e19e19ad7836e6bbfb9fbb5266.tar.gz
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.
Diffstat (limited to 'Modules/Internal/FeatureTesting.cmake')
-rw-r--r--Modules/Internal/FeatureTesting.cmake2
1 files changed, 1 insertions, 1 deletions
diff --git a/Modules/Internal/FeatureTesting.cmake b/Modules/Internal/FeatureTesting.cmake
index abd9a2636c..86b89b25ce 100644
--- a/Modules/Internal/FeatureTesting.cmake
+++ b/Modules/Internal/FeatureTesting.cmake
@@ -5,7 +5,7 @@ macro(record_compiler_features lang compile_flags feature_list)
string(TOLOWER ${lang} lang_lc)
file(REMOVE "${CMAKE_BINARY_DIR}/CMakeFiles/feature_tests.bin")
file(WRITE "${CMAKE_BINARY_DIR}/CMakeFiles/feature_tests.${lang_lc}" "
- const char features[] = {\"\"\n")
+ const char features[] = {\"\\n\"\n")
get_property(known_features GLOBAL PROPERTY CMAKE_${lang}_KNOWN_FEATURES)