在哪里设置ExternalProject属性?

时间:2014-11-02 18:06:18

标签: cmake

在cmake的ExternalProject_Add文档中,它提到设置EP_BASE属性。我尝试使用set关键字进行设置,但它似乎无法正常工作。

如何设置此属性以使ExternalProject_Add使用它?

2 个答案:

答案 0 :(得分:3)

EP_BASE是目录属性。来自documentation

  

否则,如果设置了EP_BASE 目录属性...

您需要使用set_directory_properties命令修改该值。例如:

  

set_directory_properties(PROPERTIES EP_BASE" / path / to / directory")

答案 1 :(得分:0)

由于这是一个属性,您可以使用from string import ascii_lowercase alphabet = ascii_lowercase def encode_message(message, shift): cypher_text = '' for letter in message: letter_idx = alphabet.index(letter) cypher_text = cypher_text + alphabet[(letter_idx + shift) % 26] return cypher_text def decode_message(message, shift): cypher_text = '' for letter in message: letter_idx = alphabet.index(letter) cypher_text = cypher_text + alphabet[(26 + letter_idx - shift) % 26] return cypher_text 作为第一个参数的set_property进行设置。

/**
 * Parse a string according to CSV format (https://tools.ietf.org/html/rfc4180), with variabele delimiter (default ,).
 * @param string $string    String to be parsed as csv
 * @param string $delimiter character to be used as field delimiter  
 * @return array            Array with for each line an array with csv field values
 */
 function csv_parse ($string, $delimiter = ",", $line_mode = true) {
    // This function parses on line-level first ($line_mode = true) and calls itself recursively to parse each line on field-level ($line_mode = false).
    // when in line mode, the delimiter is eol (\n, \r\n and \n\r). 
    // when in field mode, the delimiter is the passed $delimiter. 

    $delimiter = substr ($delimiter,0,1);                           // delimiter is one character       
    $length = strlen ($string);
    $parsed_array = array();
    $end_of_line_state = false;
    $enclosed_state = false;
    $i = 0;
    $field = "";
    do {
        switch (true) {
            case (!$enclosed_state && $end_of_line_state && ($string[$i] == "\r" && $string[$i-1] == "\n")) :
            case (!$enclosed_state && $end_of_line_state && ($string[$i] == "\n" && $string[$i-1] == "\r")) :
                // ...found second character of eol (\r\n of \n\r). Ignore
                $end_of_line_state = false;
                break;
            case (!$enclosed_state && !$end_of_line_state && ($string[$i] == "\n" || $string[$i] == "\r")) :
                    // ... found first character of eol \n, \r\n of \n\r
                $end_of_line_state = true;                  // eol can be two characters, so prepare for the second
                if ($field != "") {                     // ignore empty lines. Prohibited in csv
                    $parsed_array [] = csv_parse ($field, $delimiter, false); // recursive call to parse on field-level. Flush result
                };
                $field = "";                                // prepare for next one
                break;
            case (!$enclosed_state && $string[$i] == $delimiter && !$line_mode) : 
                // ...delimiter found
                $parsed_array [] = $field;              // flush field as new array element
                $field = "";                                // prepare for next one
                break;
            case ($string[$i] == "\"") :
                // ...encloser found
                if ($enclosed_state) {
                    if ($i < $length && $string[$i+1] == "\"") {
                        // ... escaped " found
                        if (!$line_mode) {
                            $field .= "\"";                     // when parsing fieldlevel, only " is part of the line
                        } else {
                            $field .= "\"\"";                   // when parsing line level, the escaping " is also part of the line
                        };
                        $i++;
                    } else {
                        // ...closing encloser found
                        $enclosed_state = false;
                        if ($line_mode) {
                            $field .= $string[$i];              // when parsing line level, the enclosing " are part of the line
                        };
                    };
                } else {
                    // ... opening encloser found 
                    $enclosed_state = true;
                    if ($line_mode) {
                        $field .= $string[$i];                  // when parsing line level, the enclosing " are part of the line
                    };
                };
                break;
            default:
                // ...regular character found
                $field .= $string[$i];
        };
        $i++;

        if ($i >= $length) {                                    // end of string
            if ($line_mode) {
                $parsed_array [] = csv_parse ($field, $delimiter, false); // recursive call to parse on field-level. Flush result.
            } else {
                $parsed_array [] = $field;                      // flush last field
            };
        };
    } while ($i < $length); 
    return $parsed_array;    
};