cmAddCustomCommand: Initialize static std::unordered_set on construction

This commit is contained in:
Sebastian Holtermann 2019-06-04 12:19:59 +02:00
parent 8af4b31b8a
commit f1bdfdf242

View File

@ -95,30 +95,29 @@ bool cmAddCustomCommandCommand::InitialPass(
MAKE_STATIC_KEYWORD(VERBATIM); MAKE_STATIC_KEYWORD(VERBATIM);
MAKE_STATIC_KEYWORD(WORKING_DIRECTORY); MAKE_STATIC_KEYWORD(WORKING_DIRECTORY);
#undef MAKE_STATIC_KEYWORD #undef MAKE_STATIC_KEYWORD
static std::unordered_set<std::string> keywords; static std::unordered_set<std::string> const keywords{
if (keywords.empty()) { keyAPPEND,
keywords.insert(keyAPPEND); keyARGS,
keywords.insert(keyARGS); keyBYPRODUCTS,
keywords.insert(keyBYPRODUCTS); keyCOMMAND,
keywords.insert(keyCOMMAND); keyCOMMAND_EXPAND_LISTS,
keywords.insert(keyCOMMAND_EXPAND_LISTS); keyCOMMENT,
keywords.insert(keyCOMMENT); keyDEPENDS,
keywords.insert(keyDEPENDS); keyDEPFILE,
keywords.insert(keyDEPFILE); keyIMPLICIT_DEPENDS,
keywords.insert(keyIMPLICIT_DEPENDS); keyJOB_POOL,
keywords.insert(keyJOB_POOL); keyMAIN_DEPENDENCY,
keywords.insert(keyMAIN_DEPENDENCY); keyOUTPUT,
keywords.insert(keyOUTPUT); keyOUTPUTS,
keywords.insert(keyOUTPUTS); keyPOST_BUILD,
keywords.insert(keyPOST_BUILD); keyPRE_BUILD,
keywords.insert(keyPRE_BUILD); keyPRE_LINK,
keywords.insert(keyPRE_LINK); keySOURCE,
keywords.insert(keySOURCE); keyTARGET,
keywords.insert(keyTARGET); keyUSES_TERMINAL,
keywords.insert(keyUSES_TERMINAL); keyVERBATIM,
keywords.insert(keyVERBATIM); keyWORKING_DIRECTORY
keywords.insert(keyWORKING_DIRECTORY); };
}
for (std::string const& copy : args) { for (std::string const& copy : args) {
if (keywords.count(copy)) { if (keywords.count(copy)) {