1
0
Fork 0
mirror of https://github.com/juce-framework/JUCE.git synced 2026-01-10 23:44:24 +00:00

CMake: Fix missing pragma in generated resource.rc files

This commit is contained in:
reuk 2020-04-15 11:32:40 +01:00
parent c244bbbdb0
commit 7dca2fb488
2 changed files with 16 additions and 29 deletions

View file

@ -195,20 +195,5 @@ namespace build_tools
}
}
}
/** Takes a string and returns a version of it where standard C++ escape sequences have been
used to replace any non-ascii bytes.
Although not strictly a tokenising function, this is still a function that often comes in
handy when working with C++ code!
@see writeEscapeChars
*/
static String addEscapeChars (const String& s)
{
MemoryOutputStream mo;
writeEscapeChars (mo, s.toRawUTF8(), -1, -1, false, true, true);
return mo.toString();
}
}
}

View file

@ -20,13 +20,6 @@ namespace juce
{
namespace build_tools
{
static void writeRCValue (MemoryOutputStream& mo, const String& n, const String& value)
{
if (value.isNotEmpty())
mo << " VALUE \"" << n << "\", \""
<< addEscapeChars (value) << "\\0\"" << newLine;
}
static String getCommaSeparatedVersionNumber (const String& version)
{
auto versionParts = StringArray::fromTokens (version, ",.", "");
@ -42,7 +35,9 @@ namespace build_tools
{
MemoryOutputStream mo;
mo << "#ifdef JUCE_USER_DEFINED_RC_FILE" << newLine
mo << "#pragma code_page(65001)" << newLine
<< newLine
<< "#ifdef JUCE_USER_DEFINED_RC_FILE" << newLine
<< " #include JUCE_USER_DEFINED_RC_FILE" << newLine
<< "#else" << newLine
<< newLine
@ -58,12 +53,19 @@ namespace build_tools
<< " BLOCK \"040904E4\"" << newLine
<< " BEGIN" << newLine;
writeRCValue (mo, "CompanyName", companyName);
writeRCValue (mo, "LegalCopyright", companyCopyright);
writeRCValue (mo, "FileDescription", projectName);
writeRCValue (mo, "FileVersion", version);
writeRCValue (mo, "ProductName", projectName);
writeRCValue (mo, "ProductVersion", version);
const auto writeRCValue = [&] (const String& n, const String& value)
{
if (value.isNotEmpty())
mo << " VALUE \"" << n << "\", \""
<< value.replace ("\"", "\"\"") << "\\0\"" << newLine;
};
writeRCValue ("CompanyName", companyName);
writeRCValue ("LegalCopyright", companyCopyright);
writeRCValue ("FileDescription", projectName);
writeRCValue ("FileVersion", version);
writeRCValue ("ProductName", projectName);
writeRCValue ("ProductVersion", version);
mo << " END" << newLine
<< " END" << newLine