summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChristian Pfeiffer <cpfeiffer@live.de>2017-03-30 16:10:28 (GMT)
committerBrad King <brad.king@kitware.com>2017-03-30 17:22:02 (GMT)
commit2c9f35789d4955bf77436091d1535ed8761a15d2 (patch)
tree52877f7367cd38c89e8589fe9111c19e4b05eeee
parent21499431e05b0defb134b10b1753488c0516bafd (diff)
downloadCMake-2c9f35789d4955bf77436091d1535ed8761a15d2.zip
CMake-2c9f35789d4955bf77436091d1535ed8761a15d2.tar.gz
CMake-2c9f35789d4955bf77436091d1535ed8761a15d2.tar.bz2
VS: Decide project type by linker lang as fallback
Fixes: #16738
-rw-r--r--Source/cmGlobalVisualStudioGenerator.cxx14
1 files changed, 14 insertions, 0 deletions
diff --git a/Source/cmGlobalVisualStudioGenerator.cxx b/Source/cmGlobalVisualStudioGenerator.cxx
index 32579aa..eb92b83 100644
--- a/Source/cmGlobalVisualStudioGenerator.cxx
+++ b/Source/cmGlobalVisualStudioGenerator.cxx
@@ -729,12 +729,26 @@ bool cmGlobalVisualStudioGenerator::TargetIsFortranOnly(
return false;
}
}
+ // If there's only one source language, Fortran has to be used
+ // in order for the sources to compile.
+ // Note: Via linker propagation, LINKER_LANGUAGE could become CXX in
+ // this situation and mismatch from the actual language of the linker.
gt->GetLanguages(languages, "");
if (languages.size() == 1) {
if (*languages.begin() == "Fortran") {
return true;
}
}
+
+ // In the case of mixed object files or sources mixed with objects,
+ // decide the language based on the value of LINKER_LANGUAGE.
+ // This will not make it possible to mix source files of different
+ // languages, but object libraries will be linked together in the
+ // same fashion as other generators do.
+ if (gt->GetLinkerLanguage("") == "Fortran") {
+ return true;
+ }
+
return false;
}