[cmake-developers] $LIST_LENGTH{} syntax

Torsten at Robitzki.de Torsten at Robitzki.de
Tue Jan 22 13:31:43 EST 2019



> Am 22.01.2019 um 17:03 schrieb Brad King <brad.king at kitware.com>:
> 
> Yes, something more extensible would be fine.  We need to be careful
> not to slow down the variable reference syntax parser though.

Currently, the Code that evaluates the ${}-Syntax only evaluates the key, if the key is not an empty string:

const char* cmCommandArgumentParserHelper::ExpandSpecialVariable(
  const char* key, const char* var)
{
  if (!key) {
    return this->ExpandVariable(var);
  }
  if (!var) {
    return "";
  }
  if (strcmp(key, "ENV") == 0) {
    std::string str;
    if (cmSystemTools::GetEnv(var, str)) {
      if (this->EscapeQuotes) {
        return this->AddString(cmSystemTools::EscapeQuotes(str));
      }
      return this->AddString(str);
    }
    return "";
  }
  if (strcmp(key, „CACHE") == 0) {

…

so, there seems to be no risk to slow down the ExpandVariable()-Path (but of cause, I would measure the difference).

kind regards,

Torsten
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: Message signed with OpenPGP
URL: <https://cmake.org/pipermail/cmake-developers/attachments/20190122/98c8f045/attachment.sig>


More information about the cmake-developers mailing list