diff --git a/Source/cmGlobalVisualStudio10Generator.cxx b/Source/cmGlobalVisualStudio10Generator.cxx index 0837f993f..9b1405165 100644 --- a/Source/cmGlobalVisualStudio10Generator.cxx +++ b/Source/cmGlobalVisualStudio10Generator.cxx @@ -79,6 +79,7 @@ cmGlobalVisualStudio10Generator::cmGlobalVisualStudio10Generator( this->ExpressEdition = cmSystemTools::ReadRegistryValue( "HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\VCExpress\\10.0\\Setup\\VC;" "ProductDir", vc10Express, cmSystemTools::KeyWOW64_32); + this->MasmEnabled = false; } //---------------------------------------------------------------------------- @@ -168,6 +169,16 @@ void cmGlobalVisualStudio10Generator return; } } + + for(std::vector::const_iterator it = lang.begin(); + it != lang.end(); ++it) + { + if(*it == "ASM_MASM") + { + this->MasmEnabled = true; + } + } + cmGlobalVisualStudio8Generator::EnableLanguage(lang, mf, optional); } diff --git a/Source/cmGlobalVisualStudio10Generator.h b/Source/cmGlobalVisualStudio10Generator.h index dbe60442a..00f8d3340 100644 --- a/Source/cmGlobalVisualStudio10Generator.h +++ b/Source/cmGlobalVisualStudio10Generator.h @@ -54,6 +54,9 @@ public: /** Is the installed VS an Express edition? */ bool IsExpressEdition() const { return this->ExpressEdition; } + /** Is the Microsoft Assembler enabled? */ + bool IsMasmEnabled() const { return this->MasmEnabled; } + /** The toolset name for the target platform. */ const char* GetPlatformToolset(); @@ -83,6 +86,7 @@ protected: std::string PlatformToolset; bool ExpressEdition; + bool MasmEnabled; bool UseFolderProperty(); diff --git a/Source/cmVisualStudio10TargetGenerator.cxx b/Source/cmVisualStudio10TargetGenerator.cxx index 937509e6e..ea0534731 100644 --- a/Source/cmVisualStudio10TargetGenerator.cxx +++ b/Source/cmVisualStudio10TargetGenerator.cxx @@ -307,6 +307,11 @@ void cmVisualStudio10TargetGenerator::Generate() this->WriteString( "\n", 1); this->WriteString("\n", 1); + if (this->GlobalGenerator->IsMasmEnabled()) + { + this->WriteString("\n", 2); + } this->WriteString("\n", 1); this->WriteString("\n", 1); this->WriteString("\n", 1); this->WriteString("\n", 1); + if (this->GlobalGenerator->IsMasmEnabled()) + { + this->WriteString("\n", 2); + } this->WriteString("\n", 1); this->WriteString("", 0); // The groups are stored in a separate file for VS 10 @@ -982,24 +992,37 @@ void cmVisualStudio10TargetGenerator::WriteAllSources() si != this->GeneratorTarget->ObjectSources.end(); ++si) { const char* lang = (*si)->GetLanguage(); - bool cl = strcmp(lang, "C") == 0 || strcmp(lang, "CXX") == 0; - bool rc = strcmp(lang, "RC") == 0; - const char* tool = cl? "ClCompile" : (rc? "ResourceCompile" : "None"); - this->WriteSource(tool, *si, " "); - // ouput any flags specific to this source file - if(cl && this->OutputSourceSpecificFlags(*si)) + const char* tool = NULL; + if (strcmp(lang, "C") == 0 || strcmp(lang, "CXX") == 0) { - // if the source file has specific flags the tag - // is ended on a new line - this->WriteString("\n", 2); + tool = "ClCompile"; } - else if(rc && this->OutputSourceSpecificFlags(*si)) + else if (strcmp(lang, "ASM_MASM") == 0 && + this->GlobalGenerator->IsMasmEnabled()) { - this->WriteString("\n", 2); + tool = "MASM"; + } + else if (strcmp(lang, "RC") == 0) + { + tool = "ResourceCompile"; + } + + if (tool) + { + this->WriteSource(tool, *si, " "); + if (this->OutputSourceSpecificFlags(*si)) + { + this->WriteString("BuildFileStream ) << tool << ">\n"; + } + else + { + (*this->BuildFileStream ) << " />\n"; + } } else { - (*this->BuildFileStream ) << " />\n"; + this->WriteSource("None", *si); } }