summaryrefslogtreecommitdiffstats
path: root/Source/cmLocalGenerator.cxx
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2017-04-28 18:45:11 (GMT)
committerBrad King <brad.king@kitware.com>2017-05-01 14:33:06 (GMT)
commite17b1791843b473d0d57ccdbe98689d1be8228e2 (patch)
treefaa4236993a654043011d6ddf0893f7e3a3d5102 /Source/cmLocalGenerator.cxx
parentd037be122e15fb3860869e07a0b6ccd8e7d4d94a (diff)
downloadCMake-e17b1791843b473d0d57ccdbe98689d1be8228e2.zip
CMake-e17b1791843b473d0d57ccdbe98689d1be8228e2.tar.gz
CMake-e17b1791843b473d0d57ccdbe98689d1be8228e2.tar.bz2
Features: On SunPro link with language standard compiler flag
When C++ feature requirements or `CXX_STANDARD` cause us to compile on SunPro with the `-std=c++11` option, link with the option too. This is needed to make the compiler use the matching standard library.
Diffstat (limited to 'Source/cmLocalGenerator.cxx')
-rw-r--r--Source/cmLocalGenerator.cxx9
1 files changed, 9 insertions, 0 deletions
diff --git a/Source/cmLocalGenerator.cxx b/Source/cmLocalGenerator.cxx
index dd1b86f..8ce158b 100644
--- a/Source/cmLocalGenerator.cxx
+++ b/Source/cmLocalGenerator.cxx
@@ -1321,6 +1321,15 @@ void cmLocalGenerator::AddLanguageFlagsForLinking(
std::string& flags, cmGeneratorTarget const* target, const std::string& lang,
const std::string& config)
{
+ if (this->Makefile->IsOn("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.
+ // FIXME: If CMake gains an abstraction for standard library
+ // selection, this will have to be reconciled with it.
+ this->AddCompilerRequirementFlag(flags, target, lang);
+ }
+
this->AddLanguageFlags(flags, target, lang, config);
}