Commit 0b3ba05a authored by Brad King's avatar Brad King Committed by Kitware Robot

Merge topic 'cmTarget_cleanups'

0e4493ec cmOutputConverter: Initialize static std::set on construction
f1bdfdf2 cmAddCustomCommand: Initialize static std::unordered_set on construction
8af4b31b cmTargetPropertyComputer: Initialize static std::unordered_set on construction
537ea119 cmTarget: Initialize static std::unordered_set on construction
c4826787 cmTarget: Property initialization cleanup
Acked-by: Kitware Robot's avatarKitware Robot <kwrobot@kitware.com>
Merge-request: !3416
parents 6aee82f3 0e4493ec
Pipeline #138637 passed with stage
in 0 seconds
......@@ -95,30 +95,29 @@ bool cmAddCustomCommandCommand::InitialPass(
MAKE_STATIC_KEYWORD(VERBATIM);
MAKE_STATIC_KEYWORD(WORKING_DIRECTORY);
#undef MAKE_STATIC_KEYWORD
static std::unordered_set<std::string> keywords;
if (keywords.empty()) {
keywords.insert(keyAPPEND);
keywords.insert(keyARGS);
keywords.insert(keyBYPRODUCTS);
keywords.insert(keyCOMMAND);
keywords.insert(keyCOMMAND_EXPAND_LISTS);
keywords.insert(keyCOMMENT);
keywords.insert(keyDEPENDS);
keywords.insert(keyDEPFILE);
keywords.insert(keyIMPLICIT_DEPENDS);
keywords.insert(keyJOB_POOL);
keywords.insert(keyMAIN_DEPENDENCY);
keywords.insert(keyOUTPUT);
keywords.insert(keyOUTPUTS);
keywords.insert(keyPOST_BUILD);
keywords.insert(keyPRE_BUILD);
keywords.insert(keyPRE_LINK);
keywords.insert(keySOURCE);
keywords.insert(keyTARGET);
keywords.insert(keyUSES_TERMINAL);
keywords.insert(keyVERBATIM);
keywords.insert(keyWORKING_DIRECTORY);
}
static std::unordered_set<std::string> const keywords{
keyAPPEND,
keyARGS,
keyBYPRODUCTS,
keyCOMMAND,
keyCOMMAND_EXPAND_LISTS,
keyCOMMENT,
keyDEPENDS,
keyDEPFILE,
keyIMPLICIT_DEPENDS,
keyJOB_POOL,
keyMAIN_DEPENDENCY,
keyOUTPUT,
keyOUTPUTS,
keyPOST_BUILD,
keyPRE_BUILD,
keyPRE_LINK,
keySOURCE,
keyTARGET,
keyUSES_TERMINAL,
keyVERBATIM,
keyWORKING_DIRECTORY
};
for (std::string const& copy : args) {
if (keywords.count(copy)) {
......
......@@ -73,22 +73,10 @@ std::string cmOutputConverter::ConvertDirectorySeparatorsForShell(
static bool cmOutputConverterIsShellOperator(const std::string& str)
{
static std::set<std::string> shellOperators;
if (shellOperators.empty()) {
shellOperators.insert("<");
shellOperators.insert(">");
shellOperators.insert("<<");
shellOperators.insert(">>");
shellOperators.insert("|");
shellOperators.insert("||");
shellOperators.insert("&&");
shellOperators.insert("&>");
shellOperators.insert("1>");
shellOperators.insert("2>");
shellOperators.insert("2>&1");
shellOperators.insert("1>&2");
}
return shellOperators.count(str) > 0;
static std::set<std::string> const shellOperators{
"<", ">", "<<", ">>", "|", "||", "&&", "&>", "1>", "2>", "2>&1", "1>&2"
};
return (shellOperators.count(str) != 0);
}
std::string cmOutputConverter::EscapeForShell(const std::string& str,
......
This diff is collapsed.
......@@ -56,22 +56,21 @@ bool cmTargetPropertyComputer::WhiteListedInterfaceProperty(
if (std::islower(prop[0])) {
return true;
}
static std::unordered_set<std::string> builtIns;
if (builtIns.empty()) {
builtIns.insert("COMPATIBLE_INTERFACE_BOOL");
builtIns.insert("COMPATIBLE_INTERFACE_NUMBER_MAX");
builtIns.insert("COMPATIBLE_INTERFACE_NUMBER_MIN");
builtIns.insert("COMPATIBLE_INTERFACE_STRING");
builtIns.insert("EXPORT_NAME");
builtIns.insert("EXPORT_PROPERTIES");
builtIns.insert("IMPORTED");
builtIns.insert("IMPORTED_GLOBAL");
builtIns.insert("MANUALLY_ADDED_DEPENDENCIES");
builtIns.insert("NAME");
builtIns.insert("PRIVATE_HEADER");
builtIns.insert("PUBLIC_HEADER");
builtIns.insert("TYPE");
}
static std::unordered_set<std::string> const builtIns{
"COMPATIBLE_INTERFACE_BOOL",
"COMPATIBLE_INTERFACE_NUMBER_MAX",
"COMPATIBLE_INTERFACE_NUMBER_MIN",
"COMPATIBLE_INTERFACE_STRING",
"EXPORT_NAME",
"EXPORT_PROPERTIES",
"IMPORTED",
"IMPORTED_GLOBAL",
"MANUALLY_ADDED_DEPENDENCIES",
"NAME",
"PRIVATE_HEADER",
"PUBLIC_HEADER",
"TYPE"
};
if (builtIns.count(prop)) {
return true;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment