summaryrefslogtreecommitdiffstats
path: root/Source/cmLocalVisualStudio7Generator.cxx
diff options
context:
space:
mode:
authorMarc Chevrier <marc.chevrier@sap.com>2017-12-13 15:34:11 (GMT)
committerMarc Chevrier <marc.chevrier@sap.com>2017-12-13 15:35:22 (GMT)
commit10f58b27ac1015e4f1615372bb5168e43afcdf3a (patch)
tree8f1db98fd525f9a4039fd9a0194b009d208a4acc /Source/cmLocalVisualStudio7Generator.cxx
parent14fe6d431b12139ea2aeb5bcc09efd0f964597aa (diff)
downloadCMake-10f58b27ac1015e4f1615372bb5168e43afcdf3a.zip
CMake-10f58b27ac1015e4f1615372bb5168e43afcdf3a.tar.gz
CMake-10f58b27ac1015e4f1615372bb5168e43afcdf3a.tar.bz2
Genex: Per-source $<COMPILE_LANGUAGE:...> support
Fixes: #17542
Diffstat (limited to 'Source/cmLocalVisualStudio7Generator.cxx')
-rw-r--r--Source/cmLocalVisualStudio7Generator.cxx37
1 files changed, 22 insertions, 15 deletions
diff --git a/Source/cmLocalVisualStudio7Generator.cxx b/Source/cmLocalVisualStudio7Generator.cxx
index 53966cd..4121190 100644
--- a/Source/cmLocalVisualStudio7Generator.cxx
+++ b/Source/cmLocalVisualStudio7Generator.cxx
@@ -1458,14 +1458,28 @@ cmLocalVisualStudio7GeneratorFCInfo::cmLocalVisualStudio7GeneratorFCInfo(
i != configs.end(); ++i, ++ci) {
std::string configUpper = cmSystemTools::UpperCase(*i);
cmLVS7GFileConfig fc;
- cmGeneratorExpressionInterpreter genexInterpreter(lg, gt, *i);
+
+ std::string lang =
+ lg->GlobalGenerator->GetLanguageFromExtension(sf.GetExtension().c_str());
+ const std::string& sourceLang = lg->GetSourceFileLanguage(sf);
+ bool needForceLang = false;
+ // source file does not match its extension language
+ if (lang != sourceLang) {
+ needForceLang = true;
+ lang = sourceLang;
+ }
+
+ cmGeneratorExpressionInterpreter genexInterpreter(lg, gt, *i,
+ gt->GetName(), lang);
+
bool needfc = false;
if (!objectName.empty()) {
fc.ObjectName = objectName;
needfc = true;
}
- if (const char* cflags = sf.GetProperty("COMPILE_FLAGS")) {
- fc.CompileFlags = genexInterpreter.Evaluate(cflags);
+ const std::string COMPILE_FLAGS("COMPILE_FLAGS");
+ if (const char* cflags = sf.GetProperty(COMPILE_FLAGS)) {
+ fc.CompileFlags = genexInterpreter.Evaluate(cflags, COMPILE_FLAGS);
needfc = true;
}
if (lg->FortranProject) {
@@ -1483,14 +1497,16 @@ cmLocalVisualStudio7GeneratorFCInfo::cmLocalVisualStudio7GeneratorFCInfo(
break;
}
}
- if (const char* cdefs = sf.GetProperty("COMPILE_DEFINITIONS")) {
- fc.CompileDefs = genexInterpreter.Evaluate(cdefs);
+ const std::string COMPILE_DEFINITIONS("COMPILE_DEFINITIONS");
+ if (const char* cdefs = sf.GetProperty(COMPILE_DEFINITIONS)) {
+ fc.CompileDefs = genexInterpreter.Evaluate(cdefs, COMPILE_DEFINITIONS);
needfc = true;
}
std::string defPropName = "COMPILE_DEFINITIONS_";
defPropName += configUpper;
if (const char* ccdefs = sf.GetProperty(defPropName)) {
- fc.CompileDefsConfig = genexInterpreter.Evaluate(ccdefs);
+ fc.CompileDefsConfig =
+ genexInterpreter.Evaluate(ccdefs, COMPILE_DEFINITIONS);
needfc = true;
}
@@ -1508,16 +1524,7 @@ cmLocalVisualStudio7GeneratorFCInfo::cmLocalVisualStudio7GeneratorFCInfo(
}
}
- std::string lang =
- lg->GlobalGenerator->GetLanguageFromExtension(sf.GetExtension().c_str());
- const std::string& sourceLang = lg->GetSourceFileLanguage(sf);
const std::string& linkLanguage = gt->GetLinkerLanguage(i->c_str());
- bool needForceLang = false;
- // source file does not match its extension language
- if (lang != sourceLang) {
- needForceLang = true;
- lang = sourceLang;
- }
// If HEADER_FILE_ONLY is set, we must suppress this generation in
// the project file
fc.ExcludedFromBuild = sf.GetPropertyAsBool("HEADER_FILE_ONLY") ||