diff options
Diffstat (limited to 'Source')
-rw-r--r-- | Source/cmGeneratorExpressionNode.cxx | 12 | ||||
-rw-r--r-- | Source/cmGlobalXCodeGenerator.cxx | 6 | ||||
-rw-r--r-- | Source/cmLocalVisualStudio7Generator.cxx | 7 | ||||
-rw-r--r-- | Source/cmVisualStudio10TargetGenerator.cxx | 9 | ||||
-rw-r--r-- | Source/cmVisualStudio10TargetGenerator.h | 1 |
5 files changed, 23 insertions, 12 deletions
diff --git a/Source/cmGeneratorExpressionNode.cxx b/Source/cmGeneratorExpressionNode.cxx index 3d311d6..597112a 100644 --- a/Source/cmGeneratorExpressionNode.cxx +++ b/Source/cmGeneratorExpressionNode.cxx @@ -828,20 +828,20 @@ static const struct CompileLanguageNode : public cmGeneratorExpressionNode } std::string genName = gg->GetName(); if (genName.find("Visual Studio") != std::string::npos) { - if (dagChecker && (dagChecker->EvaluatingCompileDefinitions() || - dagChecker->EvaluatingIncludeDirectories())) { + if (dagChecker && dagChecker->EvaluatingIncludeDirectories()) { reportError( context, content->GetOriginalExpression(), - "$<COMPILE_LANGUAGE:...> may only be used for COMPILE_OPTIONS " + "$<COMPILE_LANGUAGE:...> may only be used for COMPILE_OPTIONS, " + "COMPILE_DEFINITIONS, " "and file(GENERATE) with the Visual Studio generator."); return std::string(); } } else if (genName.find("Xcode") != std::string::npos) { - if (dagChecker && (dagChecker->EvaluatingCompileDefinitions() || - dagChecker->EvaluatingIncludeDirectories())) { + if (dagChecker && dagChecker->EvaluatingIncludeDirectories()) { reportError( context, content->GetOriginalExpression(), - "$<COMPILE_LANGUAGE:...> may only be used for COMPILE_OPTIONS " + "$<COMPILE_LANGUAGE:...> may only be used for COMPILE_OPTIONS, " + "COMPILE_DEFINITIONS, " "and file(GENERATE) with the Xcode generator."); return std::string(); } diff --git a/Source/cmGlobalXCodeGenerator.cxx b/Source/cmGlobalXCodeGenerator.cxx index 338c2b4..d22356e 100644 --- a/Source/cmGlobalXCodeGenerator.cxx +++ b/Source/cmGlobalXCodeGenerator.cxx @@ -1703,6 +1703,7 @@ void cmGlobalXCodeGenerator::CreateBuildSettings(cmGeneratorTarget* gtgt, gtgt->GetName().c_str()); return; } + std::string const& langForPreprocessor = llang; if (gtgt->IsIPOEnabled(llang, configName)) { const char* ltoValue = @@ -1723,7 +1724,10 @@ void cmGlobalXCodeGenerator::CreateBuildSettings(cmGeneratorTarget* gtgt, this->AppendDefines(ppDefs, exportMacro); } std::vector<std::string> targetDefines; - gtgt->GetCompileDefinitions(targetDefines, configName, "C"); + if (!langForPreprocessor.empty()) { + gtgt->GetCompileDefinitions(targetDefines, configName, + langForPreprocessor); + } this->AppendDefines(ppDefs, targetDefines); buildSettings->AddAttribute("GCC_PREPROCESSOR_DEFINITIONS", ppDefs.CreateList()); diff --git a/Source/cmLocalVisualStudio7Generator.cxx b/Source/cmLocalVisualStudio7Generator.cxx index 4cc6e3c..003163e 100644 --- a/Source/cmLocalVisualStudio7Generator.cxx +++ b/Source/cmLocalVisualStudio7Generator.cxx @@ -705,7 +705,9 @@ void cmLocalVisualStudio7Generator::WriteConfiguration( targetOptions.Parse(defineFlags.c_str()); targetOptions.ParseFinish(); std::vector<std::string> targetDefines; - target->GetCompileDefinitions(targetDefines, configName, "CXX"); + if (!langForClCompile.empty()) { + target->GetCompileDefinitions(targetDefines, configName, langForClCompile); + } targetOptions.AddDefines(targetDefines); targetOptions.SetVerboseMakefile( this->Makefile->IsOn("CMAKE_VERBOSE_MAKEFILE")); @@ -812,7 +814,8 @@ void cmLocalVisualStudio7Generator::WriteConfiguration( } fout << "\"\n"; targetOptions.OutputFlagMap(fout, "\t\t\t\t"); - targetOptions.OutputPreprocessorDefinitions(fout, "\t\t\t\t", "\n", "CXX"); + targetOptions.OutputPreprocessorDefinitions(fout, "\t\t\t\t", "\n", + langForClCompile); fout << "\t\t\t\tObjectFile=\"$(IntDir)\\\"\n"; if (target->GetType() <= cmStateEnums::OBJECT_LIBRARY) { // Specify the compiler program database file if configured. diff --git a/Source/cmVisualStudio10TargetGenerator.cxx b/Source/cmVisualStudio10TargetGenerator.cxx index 7074624..5533652 100644 --- a/Source/cmVisualStudio10TargetGenerator.cxx +++ b/Source/cmVisualStudio10TargetGenerator.cxx @@ -2391,6 +2391,7 @@ bool cmVisualStudio10TargetGenerator::ComputeClOptions( } } } + this->LangForClCompile = langForClCompile; if (!langForClCompile.empty()) { std::string baseFlagVar = "CMAKE_"; baseFlagVar += langForClCompile; @@ -2434,8 +2435,10 @@ bool cmVisualStudio10TargetGenerator::ComputeClOptions( std::vector<std::string> targetDefines; switch (this->ProjectType) { case vcxproj: - this->GeneratorTarget->GetCompileDefinitions(targetDefines, configName, - "CXX"); + if (!langForClCompile.empty()) { + this->GeneratorTarget->GetCompileDefinitions(targetDefines, configName, + langForClCompile); + } break; case csproj: this->GeneratorTarget->GetCompileDefinitions(targetDefines, configName, @@ -2512,7 +2515,7 @@ void cmVisualStudio10TargetGenerator::WriteClOptions( "%(AdditionalIncludeDirectories)"); clOptions.OutputFlagMap(*this->BuildFileStream, " "); clOptions.OutputPreprocessorDefinitions(*this->BuildFileStream, " ", - "\n", "CXX"); + "\n", this->LangForClCompile); if (this->NsightTegra) { if (const char* processMax = diff --git a/Source/cmVisualStudio10TargetGenerator.h b/Source/cmVisualStudio10TargetGenerator.h index 3f56959..b1a09eb 100644 --- a/Source/cmVisualStudio10TargetGenerator.h +++ b/Source/cmVisualStudio10TargetGenerator.h @@ -183,6 +183,7 @@ private: OptionsMap MasmOptions; OptionsMap NasmOptions; OptionsMap LinkOptions; + std::string LangForClCompile; std::string PathToProjectFile; std::string ProjectFileExtension; enum VsProjectType |