diff --git a/extras/Projucer/Source/ProjectSaving/jucer_ProjectExport_MSVC.h b/extras/Projucer/Source/ProjectSaving/jucer_ProjectExport_MSVC.h index 022e96688e..3e1d1a5e5e 100644 --- a/extras/Projucer/Source/ProjectSaving/jucer_ProjectExport_MSVC.h +++ b/extras/Projucer/Source/ProjectSaving/jucer_ProjectExport_MSVC.h @@ -1350,38 +1350,38 @@ public: auto& config = *static_cast (&*i); - for (const auto& arch : config.getArchitectures()) + auto pchFileContent = config.getPrecompiledHeaderFileContent(); + + if (pchFileContent.isEmpty()) + continue; + + auto pchFile = owner.getTargetFolder().getChildFile (config.getPrecompiledHeaderFilename()) + .withFileExtension (".h"); + + build_tools::writeStreamToFile (pchFile, [&] (MemoryOutputStream& mo) { - auto pchFileContent = config.getPrecompiledHeaderFileContent(); + mo << pchFileContent; + }); - if (pchFileContent.isEmpty()) - continue; + auto pchSourceFile = pchFile.withFileExtension (".cpp"); - auto pchFile = owner.getTargetFolder().getChildFile (config.getPrecompiledHeaderFilename()).withFileExtension (".h"); + build_tools::writeStreamToFile (pchSourceFile, [this] (MemoryOutputStream& mo) + { + mo.setNewLineString (owner.getNewLineString()); - build_tools::writeStreamToFile (pchFile, [&] (MemoryOutputStream& mo) - { - mo << pchFileContent; - }); + writeAutoGenWarningComment (mo); - auto pchSourceFile = pchFile.withFileExtension (".cpp"); + mo << " This is an empty source file generated by JUCE required for Visual Studio PCH." << newLine + << newLine + << "*/" << newLine + << newLine; + }); - build_tools::writeStreamToFile (pchSourceFile, [this] (MemoryOutputStream& mo) - { - mo.setNewLineString (owner.getNewLineString()); + auto* pchSourceElement = cpps.createNewChildElement ("ClCompile"); + pchSourceElement->setAttribute ("Include", prependDot (pchSourceFile.getFileName())); - writeAutoGenWarningComment (mo); - - mo << " This is an empty source file generated by JUCE required for Visual Studio PCH." << newLine - << newLine - << "*/" << newLine - << newLine; - }); - - auto* pchSourceElement = cpps.createNewChildElement ("ClCompile"); - pchSourceElement->setAttribute ("Include", prependDot (pchSourceFile.getFileName())); + for (const auto& arch : config.getArchitectures()) setSourceFilePCHSettings (*pchSourceElement, pchFile, "Create", config, arch); - } } }