summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2017-05-10 13:36:10 (GMT)
committerKitware Robot <kwrobot@kitware.com>2017-05-10 13:36:16 (GMT)
commit8cc9e07a2ca7018feb0dbc286f1db23a4294eeec (patch)
tree61161e8dfa108e28ea22c044cba9ec9daf9afe01
parentd43eb3aec2419284c8491b0f8334ca47d0a6e334 (diff)
parentd49aa10768fba4c2cb113d49629138140b37d560 (diff)
downloadCMake-8cc9e07a2ca7018feb0dbc286f1db23a4294eeec.zip
CMake-8cc9e07a2ca7018feb0dbc286f1db23a4294eeec.tar.gz
CMake-8cc9e07a2ca7018feb0dbc286f1db23a4294eeec.tar.bz2
Merge topic 'sunpro-c++11-link'
d49aa107 Features: On SunPro link feature check with lang std flag Acked-by: Kitware Robot <kwrobot@kitware.com> Merge-request: !818
-rw-r--r--Modules/Internal/FeatureTesting.cmake10
1 files changed, 10 insertions, 0 deletions
diff --git a/Modules/Internal/FeatureTesting.cmake b/Modules/Internal/FeatureTesting.cmake
index 50b8526..de336e7 100644
--- a/Modules/Internal/FeatureTesting.cmake
+++ b/Modules/Internal/FeatureTesting.cmake
@@ -22,9 +22,18 @@ macro(_record_compiler_features lang compile_flags feature_list)
file(APPEND "${CMAKE_BINARY_DIR}/CMakeFiles/feature_tests.${lang_lc}"
"\n};\n\nint main(int argc, char** argv) { (void)argv; return features[argc]; }\n")
+ if(CMAKE_${lang}_LINK_WITH_STANDARD_COMPILE_OPTION)
+ # This toolchain requires use of the language standard flag
+ # when linking in order to use the matching standard library.
+ set(compile_flags_for_link "${compile_flags}")
+ else()
+ set(compile_flags_for_link "")
+ endif()
+
try_compile(CMAKE_${lang}_FEATURE_TEST
${CMAKE_BINARY_DIR} "${CMAKE_BINARY_DIR}/CMakeFiles/feature_tests.${lang_lc}"
COMPILE_DEFINITIONS "${compile_flags}"
+ LINK_LIBRARIES "${compile_flags_for_link}"
OUTPUT_VARIABLE _output
COPY_FILE "${CMAKE_BINARY_DIR}/CMakeFiles/feature_tests.bin"
COPY_FILE_ERROR _copy_error
@@ -35,6 +44,7 @@ macro(_record_compiler_features lang compile_flags feature_list)
set(_result 255)
endif()
unset(CMAKE_${lang}_FEATURE_TEST CACHE)
+ unset(compile_flags_for_link)
if (_result EQUAL 0)
file(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeOutput.log