OXIESEC PANEL
- Current Dir:
/
/
usr
/
local
/
doc
/
cmake
/
html
/
command
Server IP: 139.59.38.164
Upload:
Create Dir:
Name
Size
Modified
Perms
π
..
-
04/04/2023 07:10:48 PM
rwxr-xr-x
π
add_compile_definitions.html
8.97 KB
04/04/2023 07:04:57 PM
rw-r--r--
π
add_compile_options.html
13.11 KB
04/04/2023 07:04:57 PM
rw-r--r--
π
add_custom_command.html
67.2 KB
04/04/2023 07:04:58 PM
rw-r--r--
π
add_custom_target.html
26.7 KB
04/04/2023 07:04:58 PM
rw-r--r--
π
add_definitions.html
9.72 KB
04/04/2023 07:04:58 PM
rw-r--r--
π
add_dependencies.html
8.79 KB
04/04/2023 07:04:58 PM
rw-r--r--
π
add_executable.html
20.23 KB
04/04/2023 07:04:58 PM
rw-r--r--
π
add_library.html
43.25 KB
04/04/2023 07:04:58 PM
rw-r--r--
π
add_link_options.html
17.79 KB
04/04/2023 07:04:58 PM
rw-r--r--
π
add_subdirectory.html
8.85 KB
04/04/2023 07:04:58 PM
rw-r--r--
π
add_test.html
17.09 KB
04/04/2023 07:04:58 PM
rw-r--r--
π
aux_source_directory.html
6.45 KB
04/04/2023 07:04:58 PM
rw-r--r--
π
block.html
13.15 KB
04/04/2023 07:04:58 PM
rw-r--r--
π
break.html
5.97 KB
04/04/2023 07:04:58 PM
rw-r--r--
π
build_command.html
10.66 KB
04/04/2023 07:04:58 PM
rw-r--r--
π
build_name.html
6.43 KB
04/04/2023 07:04:59 PM
rw-r--r--
π
cmake_host_system_information.html
38.46 KB
04/04/2023 07:04:59 PM
rw-r--r--
π
cmake_language.html
59.74 KB
04/04/2023 07:04:59 PM
rw-r--r--
π
cmake_minimum_required.html
13.56 KB
04/04/2023 07:04:59 PM
rw-r--r--
π
cmake_parse_arguments.html
18.62 KB
04/04/2023 07:04:59 PM
rw-r--r--
π
cmake_path.html
80.45 KB
04/04/2023 07:04:59 PM
rw-r--r--
π
cmake_policy.html
23.14 KB
04/04/2023 07:04:59 PM
rw-r--r--
π
configure_file.html
20.36 KB
04/04/2023 07:04:59 PM
rw-r--r--
π
continue.html
6.15 KB
04/04/2023 07:04:59 PM
rw-r--r--
π
create_test_sourcelist.html
7.61 KB
04/04/2023 07:04:59 PM
rw-r--r--
π
ctest_build.html
14.87 KB
04/04/2023 07:04:59 PM
rw-r--r--
π
ctest_configure.html
10.28 KB
04/04/2023 07:04:59 PM
rw-r--r--
π
ctest_coverage.html
9.93 KB
04/04/2023 07:04:59 PM
rw-r--r--
π
ctest_empty_binary_directory.html
5.54 KB
04/04/2023 07:04:59 PM
rw-r--r--
π
ctest_memcheck.html
11.73 KB
04/04/2023 07:04:59 PM
rw-r--r--
π
ctest_read_custom_files.html
5.78 KB
04/04/2023 07:04:59 PM
rw-r--r--
π
ctest_run_script.html
6.72 KB
04/04/2023 07:04:59 PM
rw-r--r--
π
ctest_sleep.html
5.66 KB
04/04/2023 07:04:59 PM
rw-r--r--
π
ctest_start.html
14.68 KB
04/04/2023 07:04:59 PM
rw-r--r--
π
ctest_submit.html
16.18 KB
04/04/2023 07:05:00 PM
rw-r--r--
π
ctest_test.html
38.64 KB
04/04/2023 07:05:00 PM
rw-r--r--
π
ctest_update.html
8.79 KB
04/04/2023 07:05:00 PM
rw-r--r--
π
ctest_upload.html
6.7 KB
04/04/2023 07:05:00 PM
rw-r--r--
π
define_property.html
15.53 KB
04/04/2023 07:05:00 PM
rw-r--r--
π
else.html
5.35 KB
04/04/2023 07:05:00 PM
rw-r--r--
π
elseif.html
5.44 KB
04/04/2023 07:05:00 PM
rw-r--r--
π
enable_language.html
10.08 KB
04/04/2023 07:05:00 PM
rw-r--r--
π
enable_testing.html
6.04 KB
04/04/2023 07:05:00 PM
rw-r--r--
π
endblock.html
5.66 KB
04/04/2023 07:05:00 PM
rw-r--r--
π
endforeach.html
5.88 KB
04/04/2023 07:05:00 PM
rw-r--r--
π
endfunction.html
5.85 KB
04/04/2023 07:05:00 PM
rw-r--r--
π
endif.html
5.71 KB
04/04/2023 07:05:00 PM
rw-r--r--
π
endmacro.html
5.79 KB
04/04/2023 07:05:00 PM
rw-r--r--
π
endwhile.html
5.79 KB
04/04/2023 07:05:00 PM
rw-r--r--
π
exec_program.html
7.52 KB
04/04/2023 07:05:00 PM
rw-r--r--
π
execute_process.html
20.95 KB
04/04/2023 07:05:00 PM
rw-r--r--
π
export.html
19.49 KB
04/04/2023 07:05:00 PM
rw-r--r--
π
export_library_dependencies.html
8.01 KB
04/04/2023 07:05:00 PM
rw-r--r--
π
file.html
128.25 KB
04/04/2023 07:05:00 PM
rw-r--r--
π
find_file.html
39.65 KB
04/04/2023 07:05:00 PM
rw-r--r--
π
find_library.html
46.52 KB
04/04/2023 07:05:01 PM
rw-r--r--
π
find_package.html
91.29 KB
04/04/2023 07:05:01 PM
rw-r--r--
π
find_path.html
40.22 KB
04/04/2023 07:05:01 PM
rw-r--r--
π
find_program.html
37.17 KB
04/04/2023 07:05:01 PM
rw-r--r--
π
fltk_wrap_ui.html
5.8 KB
04/04/2023 07:05:01 PM
rw-r--r--
π
foreach.html
18.65 KB
04/04/2023 07:05:01 PM
rw-r--r--
π
function.html
12.42 KB
04/04/2023 07:05:02 PM
rw-r--r--
π
get_cmake_property.html
8.05 KB
04/04/2023 07:05:02 PM
rw-r--r--
π
get_directory_property.html
9.08 KB
04/04/2023 07:05:02 PM
rw-r--r--
π
get_filename_component.html
12.57 KB
04/04/2023 07:05:02 PM
rw-r--r--
π
get_property.html
15.95 KB
04/04/2023 07:05:02 PM
rw-r--r--
π
get_source_file_property.html
11.47 KB
04/04/2023 07:05:02 PM
rw-r--r--
π
get_target_property.html
9.1 KB
04/04/2023 07:05:02 PM
rw-r--r--
π
get_test_property.html
8.06 KB
04/04/2023 07:05:02 PM
rw-r--r--
π
if.html
41.89 KB
04/04/2023 07:05:02 PM
rw-r--r--
π
include.html
8.04 KB
04/04/2023 07:05:02 PM
rw-r--r--
π
include_directories.html
10.54 KB
04/04/2023 07:05:02 PM
rw-r--r--
π
include_external_msproject.html
8.14 KB
04/04/2023 07:05:02 PM
rw-r--r--
π
include_guard.html
8.85 KB
04/04/2023 07:05:02 PM
rw-r--r--
π
include_regular_expression.html
6.14 KB
04/04/2023 07:05:02 PM
rw-r--r--
π
install.html
126.44 KB
04/04/2023 07:05:02 PM
rw-r--r--
π
install_files.html
9.13 KB
04/04/2023 07:05:02 PM
rw-r--r--
π
install_programs.html
9.09 KB
04/04/2023 07:05:02 PM
rw-r--r--
π
install_targets.html
7 KB
04/04/2023 07:05:02 PM
rw-r--r--
π
link_directories.html
11.99 KB
04/04/2023 07:05:02 PM
rw-r--r--
π
link_libraries.html
7.36 KB
04/04/2023 07:05:02 PM
rw-r--r--
π
list.html
35.79 KB
04/04/2023 07:05:03 PM
rw-r--r--
π
load_cache.html
6.78 KB
04/04/2023 07:05:03 PM
rw-r--r--
π
load_command.html
6.61 KB
04/04/2023 07:05:03 PM
rw-r--r--
π
macro.html
20.49 KB
04/04/2023 07:05:03 PM
rw-r--r--
π
make_directory.html
5.77 KB
04/04/2023 07:05:03 PM
rw-r--r--
π
mark_as_advanced.html
6.73 KB
04/04/2023 07:05:03 PM
rw-r--r--
π
math.html
9.01 KB
04/04/2023 07:05:03 PM
rw-r--r--
π
message.html
27.67 KB
04/04/2023 07:05:03 PM
rw-r--r--
π
option.html
6.48 KB
04/04/2023 07:05:03 PM
rw-r--r--
π
output_required_files.html
6.59 KB
04/04/2023 07:05:03 PM
rw-r--r--
π
project.html
30.84 KB
04/04/2023 07:05:03 PM
rw-r--r--
π
qt_wrap_cpp.html
7.2 KB
04/04/2023 07:05:03 PM
rw-r--r--
π
qt_wrap_ui.html
7.43 KB
04/04/2023 07:05:03 PM
rw-r--r--
π
remove.html
6 KB
04/04/2023 07:05:03 PM
rw-r--r--
π
remove_definitions.html
6.15 KB
04/04/2023 07:05:03 PM
rw-r--r--
π
return.html
16.06 KB
04/04/2023 07:05:03 PM
rw-r--r--
π
separate_arguments.html
11.04 KB
04/04/2023 07:05:03 PM
rw-r--r--
π
set.html
18.35 KB
04/04/2023 07:05:03 PM
rw-r--r--
π
set_directory_properties.html
7.58 KB
04/04/2023 07:05:03 PM
rw-r--r--
π
set_property.html
17.74 KB
04/04/2023 07:05:03 PM
rw-r--r--
π
set_source_files_properties.html
10.63 KB
04/04/2023 07:05:03 PM
rw-r--r--
π
set_target_properties.html
8.33 KB
04/04/2023 07:05:03 PM
rw-r--r--
π
set_tests_properties.html
7.98 KB
04/04/2023 07:05:03 PM
rw-r--r--
π
site_name.html
5.46 KB
04/04/2023 07:05:03 PM
rw-r--r--
π
source_group.html
10.97 KB
04/04/2023 07:05:03 PM
rw-r--r--
π
string.html
64.24 KB
04/04/2023 07:05:04 PM
rw-r--r--
π
subdir_depends.html
5.69 KB
04/04/2023 07:05:04 PM
rw-r--r--
π
subdirs.html
7.51 KB
04/04/2023 07:05:04 PM
rw-r--r--
π
target_compile_definitions.html
16.09 KB
04/04/2023 07:05:04 PM
rw-r--r--
π
target_compile_features.html
14.47 KB
04/04/2023 07:05:04 PM
rw-r--r--
π
target_compile_options.html
18.02 KB
04/04/2023 07:05:04 PM
rw-r--r--
π
target_include_directories.html
22.39 KB
04/04/2023 07:05:04 PM
rw-r--r--
π
target_link_directories.html
16.03 KB
04/04/2023 07:05:04 PM
rw-r--r--
π
target_link_libraries.html
60.83 KB
04/04/2023 07:05:04 PM
rw-r--r--
π
target_link_options.html
23.66 KB
04/04/2023 07:05:04 PM
rw-r--r--
π
target_precompile_headers.html
24.42 KB
04/04/2023 07:05:04 PM
rw-r--r--
π
target_sources.html
38.35 KB
04/04/2023 07:05:04 PM
rw-r--r--
π
try_compile.html
57.47 KB
04/04/2023 07:05:04 PM
rw-r--r--
π
try_run.html
24.62 KB
04/04/2023 07:05:04 PM
rw-r--r--
π
unset.html
9.21 KB
04/04/2023 07:05:04 PM
rw-r--r--
π
use_mangled_mesa.html
5.91 KB
04/04/2023 07:05:04 PM
rw-r--r--
π
utility_source.html
6.78 KB
04/04/2023 07:05:04 PM
rw-r--r--
π
variable_requires.html
6.84 KB
04/04/2023 07:05:04 PM
rw-r--r--
π
variable_watch.html
8.98 KB
04/04/2023 07:05:04 PM
rw-r--r--
π
while.html
9.14 KB
04/04/2023 07:05:04 PM
rw-r--r--
π
write_file.html
7.25 KB
04/04/2023 07:05:04 PM
rw-r--r--
Editing: string.html
Close
<!DOCTYPE html> <html lang="en"> <head> <meta charset="utf-8" /> <meta name="viewport" content="width=device-width, initial-scale=1.0" /><meta name="generator" content="Docutils 0.18.1: http://docutils.sourceforge.net/" /> <title>string — CMake 3.26.3 Documentation</title> <link rel="stylesheet" type="text/css" href="../_static/pygments.css" /> <link rel="stylesheet" type="text/css" href="../_static/cmake.css" /> <script data-url_root="../" id="documentation_options" src="../_static/documentation_options.js"></script> <script src="../_static/jquery.js"></script> <script src="../_static/underscore.js"></script> <script src="../_static/_sphinx_javascript_frameworks_compat.js"></script> <script src="../_static/doctools.js"></script> <link rel="shortcut icon" href="../_static/cmake-favicon.ico"/> <link rel="index" title="Index" href="../genindex.html" /> <link rel="search" title="Search" href="../search.html" /> <link rel="next" title="unset" href="unset.html" /> <link rel="prev" title="site_name" href="site_name.html" /> </head><body> <div class="related" role="navigation" aria-label="related navigation"> <h3>Navigation</h3> <ul> <li class="right" style="margin-right: 10px"> <a href="../genindex.html" title="General Index" accesskey="I">index</a></li> <li class="right" > <a href="unset.html" title="unset" accesskey="N">next</a> |</li> <li class="right" > <a href="site_name.html" title="site_name" accesskey="P">previous</a> |</li> <li> <img src="../_static/cmake-logo-16.png" alt="" style="vertical-align: middle; margin-top: -2px" /> </li> <li> <a href="https://cmake.org/">CMake</a> » </li> <li> <a href="../index.html">3.26.3 Documentation</a> » </li> <li class="nav-item nav-item-1"><a href="../manual/cmake-commands.7.html" accesskey="U">cmake-commands(7)</a> »</li> <li class="nav-item nav-item-this"><a href="">string</a></li> </ul> </div> <div class="document"> <div class="documentwrapper"> <div class="bodywrapper"> <div class="body" role="main"> <section id="string"> <span id="command:string"></span><h1>string<a class="headerlink" href="#string" title="Permalink to this heading">ΒΆ</a></h1> <p>String operations.</p> <section id="synopsis"> <h2>Synopsis<a class="headerlink" href="#synopsis" title="Permalink to this heading">ΒΆ</a></h2> <pre class="literal-block"><a class="reference internal" href="#search-and-replace">Search and Replace</a> string(<a class="reference internal" href="#find">FIND</a> <string> <substring> <out-var> [...]) string(<a class="reference internal" href="#replace">REPLACE</a> <match-string> <replace-string> <out-var> <input>...) string(<a class="reference internal" href="#regex-match">REGEX MATCH</a> <match-regex> <out-var> <input>...) string(<a class="reference internal" href="#regex-matchall">REGEX MATCHALL</a> <match-regex> <out-var> <input>...) string(<a class="reference internal" href="#regex-replace">REGEX REPLACE</a> <match-regex> <replace-expr> <out-var> <input>...) <a class="reference internal" href="#manipulation">Manipulation</a> string(<a class="reference internal" href="#append">APPEND</a> <string-var> [<input>...]) string(<a class="reference internal" href="#prepend">PREPEND</a> <string-var> [<input>...]) string(<a class="reference internal" href="#concat">CONCAT</a> <out-var> [<input>...]) string(<a class="reference internal" href="#join">JOIN</a> <glue> <out-var> [<input>...]) string(<a class="reference internal" href="#tolower">TOLOWER</a> <string> <out-var>) string(<a class="reference internal" href="#toupper">TOUPPER</a> <string> <out-var>) string(<a class="reference internal" href="#length">LENGTH</a> <string> <out-var>) string(<a class="reference internal" href="#substring">SUBSTRING</a> <string> <begin> <length> <out-var>) string(<a class="reference internal" href="#strip">STRIP</a> <string> <out-var>) string(<a class="reference internal" href="#genex-strip">GENEX_STRIP</a> <string> <out-var>) string(<a class="reference internal" href="#repeat">REPEAT</a> <string> <count> <out-var>) <a class="reference internal" href="#comparison">Comparison</a> string(<a class="reference internal" href="#compare">COMPARE</a> <op> <string1> <string2> <out-var>) <a class="reference internal" href="#hashing">Hashing</a> string(<a class="reference internal" href="#hash"><HASH></a> <out-var> <input>) <a class="reference internal" href="#generation">Generation</a> string(<a class="reference internal" href="#ascii">ASCII</a> <number>... <out-var>) string(<a class="reference internal" href="#hex">HEX</a> <string> <out-var>) string(<a class="reference internal" href="#configure">CONFIGURE</a> <string> <out-var> [...]) string(<a class="reference internal" href="#make-c-identifier">MAKE_C_IDENTIFIER</a> <string> <out-var>) string(<a class="reference internal" href="#random">RANDOM</a> [<option>...] <out-var>) string(<a class="reference internal" href="#timestamp">TIMESTAMP</a> <out-var> [<format string>] [UTC]) string(<a class="reference internal" href="#uuid">UUID</a> <out-var> ...) <a class="reference internal" href="#json">JSON</a> string(JSON <out-var> [ERROR_VARIABLE <error-var>] {<a class="reference internal" href="#json-get"><span class="std std-ref">GET</span></a> | <a class="reference internal" href="#json-type"><span class="std std-ref">TYPE</span></a> | <a class="reference internal" href="#json-length"><span class="std std-ref">LENGTH</span></a> | <a class="reference internal" href="#json-remove"><span class="std std-ref">REMOVE</span></a>} <json-string> <member|index> [<member|index> ...]) string(JSON <out-var> [ERROR_VARIABLE <error-var>] <a class="reference internal" href="#json-member"><span class="std std-ref">MEMBER</span></a> <json-string> [<member|index> ...] <index>) string(JSON <out-var> [ERROR_VARIABLE <error-var>] <a class="reference internal" href="#json-set"><span class="std std-ref">SET</span></a> <json-string> <member|index> [<member|index> ...] <value>) string(JSON <out-var> [ERROR_VARIABLE <error-var>] <a class="reference internal" href="#json-equal"><span class="std std-ref">EQUAL</span></a> <json-string1> <json-string2>)</pre> </section> <section id="search-and-replace"> <h2>Search and Replace<a class="headerlink" href="#search-and-replace" title="Permalink to this heading">ΒΆ</a></h2> <section id="search-and-replace-with-plain-strings"> <h3>Search and Replace With Plain Strings<a class="headerlink" href="#search-and-replace-with-plain-strings" title="Permalink to this heading">ΒΆ</a></h3> <div class="highlight-cmake notranslate" id="find"><div class="highlight"><pre><span></span><span class="nf">string(</span><span class="no">FIND</span><span class="w"> </span><span class="nv"><string></span><span class="w"> </span><span class="nv"><substring></span><span class="w"> </span><span class="nv"><output_variable></span><span class="w"> </span><span class="p">[</span><span class="no">REVERSE</span><span class="p">]</span><span class="nf">)</span><span class="w"></span> </pre></div> </div> <p>Return the position where the given <code class="docutils literal notranslate"><span class="pre"><substring></span></code> was found in the supplied <code class="docutils literal notranslate"><span class="pre"><string></span></code>. If the <code class="docutils literal notranslate"><span class="pre">REVERSE</span></code> flag was used, the command will search for the position of the last occurrence of the specified <code class="docutils literal notranslate"><span class="pre"><substring></span></code>. If the <code class="docutils literal notranslate"><span class="pre"><substring></span></code> is not found, a position of -1 is returned.</p> <p>The <code class="docutils literal notranslate"><span class="pre">string(FIND)</span></code> subcommand treats all strings as ASCII-only characters. The index stored in <code class="docutils literal notranslate"><span class="pre"><output_variable></span></code> will also be counted in bytes, so strings containing multi-byte characters may lead to unexpected results.</p> <div class="highlight-cmake notranslate" id="replace"><div class="highlight"><pre><span></span><span class="nf">string(</span><span class="no">REPLACE</span><span class="w"> </span><span class="nv"><match_string></span><span class="w"></span> <span class="w"> </span><span class="nv"><replace_string></span><span class="w"> </span><span class="nv"><output_variable></span><span class="w"></span> <span class="w"> </span><span class="nv"><input></span><span class="w"> </span><span class="p">[</span><span class="nv"><input>...</span><span class="p">]</span><span class="nf">)</span><span class="w"></span> </pre></div> </div> <p>Replace all occurrences of <code class="docutils literal notranslate"><span class="pre"><match_string></span></code> in the <code class="docutils literal notranslate"><span class="pre"><input></span></code> with <code class="docutils literal notranslate"><span class="pre"><replace_string></span></code> and store the result in the <code class="docutils literal notranslate"><span class="pre"><output_variable></span></code>.</p> </section> <section id="search-and-replace-with-regular-expressions"> <h3>Search and Replace With Regular Expressions<a class="headerlink" href="#search-and-replace-with-regular-expressions" title="Permalink to this heading">ΒΆ</a></h3> <div class="highlight-cmake notranslate" id="regex-match"><div class="highlight"><pre><span></span><span class="nf">string(</span><span class="no">REGEX</span><span class="w"> </span><span class="no">MATCH</span><span class="w"> </span><span class="nv"><regular_expression></span><span class="w"></span> <span class="w"> </span><span class="nv"><output_variable></span><span class="w"> </span><span class="nv"><input></span><span class="w"> </span><span class="p">[</span><span class="nv"><input>...</span><span class="p">]</span><span class="nf">)</span><span class="w"></span> </pre></div> </div> <p>Match the <code class="docutils literal notranslate"><span class="pre"><regular_expression></span></code> once and store the match in the <code class="docutils literal notranslate"><span class="pre"><output_variable></span></code>. All <code class="docutils literal notranslate"><span class="pre"><input></span></code> arguments are concatenated before matching. Regular expressions are specified in the subsection just below.</p> <div class="highlight-cmake notranslate" id="regex-matchall"><div class="highlight"><pre><span></span><span class="nf">string(</span><span class="no">REGEX</span><span class="w"> </span><span class="no">MATCHALL</span><span class="w"> </span><span class="nv"><regular_expression></span><span class="w"></span> <span class="w"> </span><span class="nv"><output_variable></span><span class="w"> </span><span class="nv"><input></span><span class="w"> </span><span class="p">[</span><span class="nv"><input>...</span><span class="p">]</span><span class="nf">)</span><span class="w"></span> </pre></div> </div> <p>Match the <code class="docutils literal notranslate"><span class="pre"><regular_expression></span></code> as many times as possible and store the matches in the <code class="docutils literal notranslate"><span class="pre"><output_variable></span></code> as a list. All <code class="docutils literal notranslate"><span class="pre"><input></span></code> arguments are concatenated before matching.</p> <div class="highlight-cmake notranslate" id="regex-replace"><div class="highlight"><pre><span></span><span class="nf">string(</span><span class="no">REGEX</span><span class="w"> </span><span class="no">REPLACE</span><span class="w"> </span><span class="nv"><regular_expression></span><span class="w"></span> <span class="w"> </span><span class="nv"><replacement_expression></span><span class="w"> </span><span class="nv"><output_variable></span><span class="w"></span> <span class="w"> </span><span class="nv"><input></span><span class="w"> </span><span class="p">[</span><span class="nv"><input>...</span><span class="p">]</span><span class="nf">)</span><span class="w"></span> </pre></div> </div> <p>Match the <code class="docutils literal notranslate"><span class="pre"><regular_expression></span></code> as many times as possible and substitute the <code class="docutils literal notranslate"><span class="pre"><replacement_expression></span></code> for the match in the output. All <code class="docutils literal notranslate"><span class="pre"><input></span></code> arguments are concatenated before matching.</p> <p>The <code class="docutils literal notranslate"><span class="pre"><replacement_expression></span></code> may refer to parenthesis-delimited subexpressions of the match using <code class="docutils literal notranslate"><span class="pre">\1</span></code>, <code class="docutils literal notranslate"><span class="pre">\2</span></code>, ..., <code class="docutils literal notranslate"><span class="pre">\9</span></code>. Note that two backslashes (<code class="docutils literal notranslate"><span class="pre">\\1</span></code>) are required in CMake code to get a backslash through argument parsing.</p> </section> <section id="regex-specification"> <span id="id1"></span><h3>Regex Specification<a class="headerlink" href="#regex-specification" title="Permalink to this heading">ΒΆ</a></h3> <p>The following characters have special meaning in regular expressions:</p> <dl> <dt><code class="docutils literal notranslate"><span class="pre">^</span></code></dt><dd><p>Matches at beginning of input</p> </dd> <dt><code class="docutils literal notranslate"><span class="pre">$</span></code></dt><dd><p>Matches at end of input</p> </dd> <dt><code class="docutils literal notranslate"><span class="pre">.</span></code></dt><dd><p>Matches any single character</p> </dd> <dt><code class="docutils literal notranslate"><span class="pre">\<char></span></code></dt><dd><p>Matches the single character specified by <code class="docutils literal notranslate"><span class="pre"><char></span></code>. Use this to match special regex characters, e.g. <code class="docutils literal notranslate"><span class="pre">\.</span></code> for a literal <code class="docutils literal notranslate"><span class="pre">.</span></code> or <code class="docutils literal notranslate"><span class="pre">\\</span></code> for a literal backslash <code class="docutils literal notranslate"><span class="pre">\</span></code>. Escaping a non-special character is unnecessary but allowed, e.g. <code class="docutils literal notranslate"><span class="pre">\a</span></code> matches <code class="docutils literal notranslate"><span class="pre">a</span></code>.</p> </dd> <dt><code class="docutils literal notranslate"><span class="pre">[</span> <span class="pre">]</span></code></dt><dd><p>Matches any character(s) inside the brackets</p> </dd> <dt><code class="docutils literal notranslate"><span class="pre">[^</span> <span class="pre">]</span></code></dt><dd><p>Matches any character(s) not inside the brackets</p> </dd> <dt><code class="docutils literal notranslate"><span class="pre">-</span></code></dt><dd><p>Inside brackets, specifies an inclusive range between characters on either side e.g. <code class="docutils literal notranslate"><span class="pre">[a-f]</span></code> is <code class="docutils literal notranslate"><span class="pre">[abcdef]</span></code> To match a literal <code class="docutils literal notranslate"><span class="pre">-</span></code> using brackets, make it the first or the last character e.g. <code class="docutils literal notranslate"><span class="pre">[+*/-]</span></code> matches basic mathematical operators.</p> </dd> <dt><code class="docutils literal notranslate"><span class="pre">*</span></code></dt><dd><p>Matches preceding pattern zero or more times</p> </dd> <dt><code class="docutils literal notranslate"><span class="pre">+</span></code></dt><dd><p>Matches preceding pattern one or more times</p> </dd> <dt><code class="docutils literal notranslate"><span class="pre">?</span></code></dt><dd><p>Matches preceding pattern zero or once only</p> </dd> <dt><code class="docutils literal notranslate"><span class="pre">|</span></code></dt><dd><p>Matches a pattern on either side of the <code class="docutils literal notranslate"><span class="pre">|</span></code></p> </dd> <dt><code class="docutils literal notranslate"><span class="pre">()</span></code></dt><dd><p>Saves a matched subexpression, which can be referenced in the <code class="docutils literal notranslate"><span class="pre">REGEX</span> <span class="pre">REPLACE</span></code> operation.</p> <div class="versionadded"> <p><span class="versionmodified added">New in version 3.9: </span>All regular expression-related commands, including e.g. <span class="target" id="index-0-command:if"></span><a class="reference internal" href="if.html#command:if" title="if"><code class="xref cmake cmake-command docutils literal notranslate"><span class="pre">if(MATCHES)</span></code></a>, save subgroup matches in the variables <span class="target" id="index-0-variable:CMAKE_MATCH_<n>"></span><a class="reference internal" href="../variable/CMAKE_MATCH_n.html#variable:CMAKE_MATCH_<n>" title="CMAKE_MATCH_<n>"><code class="xref cmake cmake-variable docutils literal notranslate"><span class="pre">CMAKE_MATCH_<n></span></code></a> for <code class="docutils literal notranslate"><span class="pre"><n></span></code> 0..9.</p> </div> </dd> </dl> <p><code class="docutils literal notranslate"><span class="pre">*</span></code>, <code class="docutils literal notranslate"><span class="pre">+</span></code> and <code class="docutils literal notranslate"><span class="pre">?</span></code> have higher precedence than concatenation. <code class="docutils literal notranslate"><span class="pre">|</span></code> has lower precedence than concatenation. This means that the regular expression <code class="docutils literal notranslate"><span class="pre">^ab+d$</span></code> matches <code class="docutils literal notranslate"><span class="pre">abbd</span></code> but not <code class="docutils literal notranslate"><span class="pre">ababd</span></code>, and the regular expression <code class="docutils literal notranslate"><span class="pre">^(ab|cd)$</span></code> matches <code class="docutils literal notranslate"><span class="pre">ab</span></code> but not <code class="docutils literal notranslate"><span class="pre">abd</span></code>.</p> <p>CMake language <a class="reference internal" href="../manual/cmake-language.7.html#escape-sequences"><span class="std std-ref">Escape Sequences</span></a> such as <code class="docutils literal notranslate"><span class="pre">\t</span></code>, <code class="docutils literal notranslate"><span class="pre">\r</span></code>, <code class="docutils literal notranslate"><span class="pre">\n</span></code>, and <code class="docutils literal notranslate"><span class="pre">\\</span></code> may be used to construct literal tabs, carriage returns, newlines, and backslashes (respectively) to pass in a regex. For example:</p> <ul class="simple"> <li><p>The quoted argument <code class="docutils literal notranslate"><span class="pre">"[</span> <span class="pre">\t\r\n]"</span></code> specifies a regex that matches any single whitespace character.</p></li> <li><p>The quoted argument <code class="docutils literal notranslate"><span class="pre">"[/\\]"</span></code> specifies a regex that matches a single forward slash <code class="docutils literal notranslate"><span class="pre">/</span></code> or backslash <code class="docutils literal notranslate"><span class="pre">\</span></code>.</p></li> <li><p>The quoted argument <code class="docutils literal notranslate"><span class="pre">"[A-Za-z0-9_]"</span></code> specifies a regex that matches any single "word" character in the C locale.</p></li> <li><p>The quoted argument <code class="docutils literal notranslate"><span class="pre">"\\(\\a\\+b\\)"</span></code> specifies a regex that matches the exact string <code class="docutils literal notranslate"><span class="pre">(a+b)</span></code>. Each <code class="docutils literal notranslate"><span class="pre">\\</span></code> is parsed in a quoted argument as just <code class="docutils literal notranslate"><span class="pre">\</span></code>, so the regex itself is actually <code class="docutils literal notranslate"><span class="pre">\(\a\+\b\)</span></code>. This can alternatively be specified in a <a class="reference internal" href="../manual/cmake-language.7.html#bracket-argument"><span class="std std-ref">Bracket Argument</span></a> without having to escape the backslashes, e.g. <code class="docutils literal notranslate"><span class="pre">[[\(\a\+\b\)]]</span></code>.</p></li> </ul> </section> </section> <section id="manipulation"> <h2>Manipulation<a class="headerlink" href="#manipulation" title="Permalink to this heading">ΒΆ</a></h2> <div class="highlight-cmake notranslate" id="append"><div class="highlight"><pre><span></span><span class="nf">string(</span><span class="no">APPEND</span><span class="w"> </span><span class="nv"><string_variable></span><span class="w"> </span><span class="p">[</span><span class="nv"><input>...</span><span class="p">]</span><span class="nf">)</span><span class="w"></span> </pre></div> </div> <div class="versionadded"> <p><span class="versionmodified added">New in version 3.4.</span></p> </div> <p>Append all the <code class="docutils literal notranslate"><span class="pre"><input></span></code> arguments to the string.</p> <div class="highlight-cmake notranslate" id="prepend"><div class="highlight"><pre><span></span><span class="nf">string(</span><span class="no">PREPEND</span><span class="w"> </span><span class="nv"><string_variable></span><span class="w"> </span><span class="p">[</span><span class="nv"><input>...</span><span class="p">]</span><span class="nf">)</span><span class="w"></span> </pre></div> </div> <div class="versionadded"> <p><span class="versionmodified added">New in version 3.10.</span></p> </div> <p>Prepend all the <code class="docutils literal notranslate"><span class="pre"><input></span></code> arguments to the string.</p> <div class="highlight-cmake notranslate" id="concat"><div class="highlight"><pre><span></span><span class="nf">string(</span><span class="no">CONCAT</span><span class="w"> </span><span class="nv"><output_variable></span><span class="w"> </span><span class="p">[</span><span class="nv"><input>...</span><span class="p">]</span><span class="nf">)</span><span class="w"></span> </pre></div> </div> <p>Concatenate all the <code class="docutils literal notranslate"><span class="pre"><input></span></code> arguments together and store the result in the named <code class="docutils literal notranslate"><span class="pre"><output_variable></span></code>.</p> <div class="highlight-cmake notranslate" id="join"><div class="highlight"><pre><span></span><span class="nf">string(</span><span class="no">JOIN</span><span class="w"> </span><span class="nv"><glue></span><span class="w"> </span><span class="nv"><output_variable></span><span class="w"> </span><span class="p">[</span><span class="nv"><input>...</span><span class="p">]</span><span class="nf">)</span><span class="w"></span> </pre></div> </div> <div class="versionadded"> <p><span class="versionmodified added">New in version 3.12.</span></p> </div> <p>Join all the <code class="docutils literal notranslate"><span class="pre"><input></span></code> arguments together using the <code class="docutils literal notranslate"><span class="pre"><glue></span></code> string and store the result in the named <code class="docutils literal notranslate"><span class="pre"><output_variable></span></code>.</p> <p>To join a list's elements, prefer to use the <code class="docutils literal notranslate"><span class="pre">JOIN</span></code> operator from the <span class="target" id="index-0-command:list"></span><a class="reference internal" href="list.html#command:list" title="list"><code class="xref cmake cmake-command docutils literal notranslate"><span class="pre">list()</span></code></a> command. This allows for the elements to have special characters like <code class="docutils literal notranslate"><span class="pre">;</span></code> in them.</p> <div class="highlight-cmake notranslate" id="tolower"><div class="highlight"><pre><span></span><span class="nf">string(</span><span class="no">TOLOWER</span><span class="w"> </span><span class="nv"><string></span><span class="w"> </span><span class="nv"><output_variable></span><span class="nf">)</span><span class="w"></span> </pre></div> </div> <p>Convert <code class="docutils literal notranslate"><span class="pre"><string></span></code> to lower characters.</p> <div class="highlight-cmake notranslate" id="toupper"><div class="highlight"><pre><span></span><span class="nf">string(</span><span class="no">TOUPPER</span><span class="w"> </span><span class="nv"><string></span><span class="w"> </span><span class="nv"><output_variable></span><span class="nf">)</span><span class="w"></span> </pre></div> </div> <p>Convert <code class="docutils literal notranslate"><span class="pre"><string></span></code> to upper characters.</p> <div class="highlight-cmake notranslate" id="length"><div class="highlight"><pre><span></span><span class="nf">string(</span><span class="no">LENGTH</span><span class="w"> </span><span class="nv"><string></span><span class="w"> </span><span class="nv"><output_variable></span><span class="nf">)</span><span class="w"></span> </pre></div> </div> <p>Store in an <code class="docutils literal notranslate"><span class="pre"><output_variable></span></code> a given string's length in bytes. Note that this means if <code class="docutils literal notranslate"><span class="pre"><string></span></code> contains multi-byte characters, the result stored in <code class="docutils literal notranslate"><span class="pre"><output_variable></span></code> will <em>not</em> be the number of characters.</p> <div class="highlight-cmake notranslate" id="substring"><div class="highlight"><pre><span></span><span class="nf">string(</span><span class="no">SUBSTRING</span><span class="w"> </span><span class="nv"><string></span><span class="w"> </span><span class="nv"><begin></span><span class="w"> </span><span class="nv"><length></span><span class="w"> </span><span class="nv"><output_variable></span><span class="nf">)</span><span class="w"></span> </pre></div> </div> <p>Store in an <code class="docutils literal notranslate"><span class="pre"><output_variable></span></code> a substring of a given <code class="docutils literal notranslate"><span class="pre"><string></span></code>. If <code class="docutils literal notranslate"><span class="pre"><length></span></code> is <code class="docutils literal notranslate"><span class="pre">-1</span></code> the remainder of the string starting at <code class="docutils literal notranslate"><span class="pre"><begin></span></code> will be returned.</p> <div class="versionchanged"> <p><span class="versionmodified changed">Changed in version 3.2: </span>If <code class="docutils literal notranslate"><span class="pre"><string></span></code> is shorter than <code class="docutils literal notranslate"><span class="pre"><length></span></code> then the end of the string is used instead. Previous versions of CMake reported an error in this case.</p> </div> <p>Both <code class="docutils literal notranslate"><span class="pre"><begin></span></code> and <code class="docutils literal notranslate"><span class="pre"><length></span></code> are counted in bytes, so care must be exercised if <code class="docutils literal notranslate"><span class="pre"><string></span></code> could contain multi-byte characters.</p> <div class="highlight-cmake notranslate" id="strip"><div class="highlight"><pre><span></span><span class="nf">string(</span><span class="no">STRIP</span><span class="w"> </span><span class="nv"><string></span><span class="w"> </span><span class="nv"><output_variable></span><span class="nf">)</span><span class="w"></span> </pre></div> </div> <p>Store in an <code class="docutils literal notranslate"><span class="pre"><output_variable></span></code> a substring of a given <code class="docutils literal notranslate"><span class="pre"><string></span></code> with leading and trailing spaces removed.</p> <div class="highlight-cmake notranslate" id="genex-strip"><div class="highlight"><pre><span></span><span class="nf">string(</span><span class="no">GENEX_STRIP</span><span class="w"> </span><span class="nv"><string></span><span class="w"> </span><span class="nv"><output_variable></span><span class="nf">)</span><span class="w"></span> </pre></div> </div> <div class="versionadded"> <p><span class="versionmodified added">New in version 3.1.</span></p> </div> <p>Strip any <span class="target" id="index-0-manual:cmake-generator-expressions(7)"></span><a class="reference internal" href="../manual/cmake-generator-expressions.7.html#manual:cmake-generator-expressions(7)" title="cmake-generator-expressions(7)"><code class="xref cmake cmake-manual docutils literal notranslate"><span class="pre">generator</span> <span class="pre">expressions</span></code></a> from the input <code class="docutils literal notranslate"><span class="pre"><string></span></code> and store the result in the <code class="docutils literal notranslate"><span class="pre"><output_variable></span></code>.</p> <div class="highlight-cmake notranslate" id="repeat"><div class="highlight"><pre><span></span><span class="nf">string(</span><span class="no">REPEAT</span><span class="w"> </span><span class="nv"><string></span><span class="w"> </span><span class="nv"><count></span><span class="w"> </span><span class="nv"><output_variable></span><span class="nf">)</span><span class="w"></span> </pre></div> </div> <div class="versionadded"> <p><span class="versionmodified added">New in version 3.15.</span></p> </div> <p>Produce the output string as the input <code class="docutils literal notranslate"><span class="pre"><string></span></code> repeated <code class="docutils literal notranslate"><span class="pre"><count></span></code> times.</p> </section> <section id="comparison"> <h2>Comparison<a class="headerlink" href="#comparison" title="Permalink to this heading">ΒΆ</a></h2> <div class="highlight-cmake notranslate" id="compare"><div class="highlight"><pre><span></span><span class="nf">string(</span><span class="no">COMPARE</span><span class="w"> </span><span class="no">LESS</span><span class="w"> </span><span class="nv"><string1></span><span class="w"> </span><span class="nv"><string2></span><span class="w"> </span><span class="nv"><output_variable></span><span class="nf">)</span><span class="w"></span> <span class="nf">string(</span><span class="no">COMPARE</span><span class="w"> </span><span class="no">GREATER</span><span class="w"> </span><span class="nv"><string1></span><span class="w"> </span><span class="nv"><string2></span><span class="w"> </span><span class="nv"><output_variable></span><span class="nf">)</span><span class="w"></span> <span class="nf">string(</span><span class="no">COMPARE</span><span class="w"> </span><span class="no">EQUAL</span><span class="w"> </span><span class="nv"><string1></span><span class="w"> </span><span class="nv"><string2></span><span class="w"> </span><span class="nv"><output_variable></span><span class="nf">)</span><span class="w"></span> <span class="nf">string(</span><span class="no">COMPARE</span><span class="w"> </span><span class="no">NOTEQUAL</span><span class="w"> </span><span class="nv"><string1></span><span class="w"> </span><span class="nv"><string2></span><span class="w"> </span><span class="nv"><output_variable></span><span class="nf">)</span><span class="w"></span> <span class="nf">string(</span><span class="no">COMPARE</span><span class="w"> </span><span class="no">LESS_EQUAL</span><span class="w"> </span><span class="nv"><string1></span><span class="w"> </span><span class="nv"><string2></span><span class="w"> </span><span class="nv"><output_variable></span><span class="nf">)</span><span class="w"></span> <span class="nf">string(</span><span class="no">COMPARE</span><span class="w"> </span><span class="no">GREATER_EQUAL</span><span class="w"> </span><span class="nv"><string1></span><span class="w"> </span><span class="nv"><string2></span><span class="w"> </span><span class="nv"><output_variable></span><span class="nf">)</span><span class="w"></span> </pre></div> </div> <p>Compare the strings and store true or false in the <code class="docutils literal notranslate"><span class="pre"><output_variable></span></code>.</p> <div class="versionadded"> <p><span class="versionmodified added">New in version 3.7: </span>Added the <code class="docutils literal notranslate"><span class="pre">LESS_EQUAL</span></code> and <code class="docutils literal notranslate"><span class="pre">GREATER_EQUAL</span></code> options.</p> </div> </section> <section id="hashing"> <span id="supported-hash-algorithms"></span><h2>Hashing<a class="headerlink" href="#hashing" title="Permalink to this heading">ΒΆ</a></h2> <div class="highlight-cmake notranslate" id="hash"><div class="highlight"><pre><span></span><span class="nf">string(</span><span class="nv"><HASH></span><span class="w"> </span><span class="nv"><output_variable></span><span class="w"> </span><span class="nv"><input></span><span class="nf">)</span><span class="w"></span> </pre></div> </div> <p>Compute a cryptographic hash of the <code class="docutils literal notranslate"><span class="pre"><input></span></code> string. The supported <code class="docutils literal notranslate"><span class="pre"><HASH></span></code> algorithm names are:</p> <dl class="simple"> <dt><code class="docutils literal notranslate"><span class="pre">MD5</span></code></dt><dd><p>Message-Digest Algorithm 5, RFC 1321.</p> </dd> <dt><code class="docutils literal notranslate"><span class="pre">SHA1</span></code></dt><dd><p>US Secure Hash Algorithm 1, RFC 3174.</p> </dd> <dt><code class="docutils literal notranslate"><span class="pre">SHA224</span></code></dt><dd><p>US Secure Hash Algorithms, RFC 4634.</p> </dd> <dt><code class="docutils literal notranslate"><span class="pre">SHA256</span></code></dt><dd><p>US Secure Hash Algorithms, RFC 4634.</p> </dd> <dt><code class="docutils literal notranslate"><span class="pre">SHA384</span></code></dt><dd><p>US Secure Hash Algorithms, RFC 4634.</p> </dd> <dt><code class="docutils literal notranslate"><span class="pre">SHA512</span></code></dt><dd><p>US Secure Hash Algorithms, RFC 4634.</p> </dd> <dt><code class="docutils literal notranslate"><span class="pre">SHA3_224</span></code></dt><dd><p>Keccak SHA-3.</p> </dd> <dt><code class="docutils literal notranslate"><span class="pre">SHA3_256</span></code></dt><dd><p>Keccak SHA-3.</p> </dd> <dt><code class="docutils literal notranslate"><span class="pre">SHA3_384</span></code></dt><dd><p>Keccak SHA-3.</p> </dd> <dt><code class="docutils literal notranslate"><span class="pre">SHA3_512</span></code></dt><dd><p>Keccak SHA-3.</p> </dd> </dl> <div class="versionadded"> <p><span class="versionmodified added">New in version 3.8: </span>Added the <code class="docutils literal notranslate"><span class="pre">SHA3_*</span></code> hash algorithms.</p> </div> </section> <section id="generation"> <h2>Generation<a class="headerlink" href="#generation" title="Permalink to this heading">ΒΆ</a></h2> <div class="highlight-cmake notranslate" id="ascii"><div class="highlight"><pre><span></span><span class="nf">string(</span><span class="no">ASCII</span><span class="w"> </span><span class="nv"><number></span><span class="w"> </span><span class="p">[</span><span class="nv"><number></span><span class="w"> </span><span class="p">...]</span><span class="w"> </span><span class="nv"><output_variable></span><span class="nf">)</span><span class="w"></span> </pre></div> </div> <p>Convert all numbers into corresponding ASCII characters.</p> <div class="highlight-cmake notranslate" id="hex"><div class="highlight"><pre><span></span><span class="nf">string(</span><span class="no">HEX</span><span class="w"> </span><span class="nv"><string></span><span class="w"> </span><span class="nv"><output_variable></span><span class="nf">)</span><span class="w"></span> </pre></div> </div> <div class="versionadded"> <p><span class="versionmodified added">New in version 3.18.</span></p> </div> <p>Convert each byte in the input <code class="docutils literal notranslate"><span class="pre"><string></span></code> to its hexadecimal representation and store the concatenated hex digits in the <code class="docutils literal notranslate"><span class="pre"><output_variable></span></code>. Letters in the output (<code class="docutils literal notranslate"><span class="pre">a</span></code> through <code class="docutils literal notranslate"><span class="pre">f</span></code>) are in lowercase.</p> <div class="highlight-cmake notranslate" id="configure"><div class="highlight"><pre><span></span><span class="nf">string(</span><span class="no">CONFIGURE</span><span class="w"> </span><span class="nv"><string></span><span class="w"> </span><span class="nv"><output_variable></span><span class="w"></span> <span class="w"> </span><span class="p">[</span><span class="no">@ONLY</span><span class="p">]</span><span class="w"> </span><span class="p">[</span><span class="no">ESCAPE_QUOTES</span><span class="p">]</span><span class="nf">)</span><span class="w"></span> </pre></div> </div> <p>Transform a <code class="docutils literal notranslate"><span class="pre"><string></span></code> like <span class="target" id="index-0-command:configure_file"></span><a class="reference internal" href="configure_file.html#command:configure_file" title="configure_file"><code class="xref cmake cmake-command docutils literal notranslate"><span class="pre">configure_file()</span></code></a> transforms a file.</p> <div class="highlight-cmake notranslate" id="make-c-identifier"><div class="highlight"><pre><span></span><span class="nf">string(</span><span class="no">MAKE_C_IDENTIFIER</span><span class="w"> </span><span class="nv"><string></span><span class="w"> </span><span class="nv"><output_variable></span><span class="nf">)</span><span class="w"></span> </pre></div> </div> <p>Convert each non-alphanumeric character in the input <code class="docutils literal notranslate"><span class="pre"><string></span></code> to an underscore and store the result in the <code class="docutils literal notranslate"><span class="pre"><output_variable></span></code>. If the first character of the <code class="docutils literal notranslate"><span class="pre"><string></span></code> is a digit, an underscore will also be prepended to the result.</p> <div class="highlight-cmake notranslate" id="random"><div class="highlight"><pre><span></span><span class="nf">string(</span><span class="no">RANDOM</span><span class="w"> </span><span class="p">[</span><span class="no">LENGTH</span><span class="w"> </span><span class="nv"><length></span><span class="p">]</span><span class="w"> </span><span class="p">[</span><span class="no">ALPHABET</span><span class="w"> </span><span class="nv"><alphabet></span><span class="p">]</span><span class="w"></span> <span class="w"> </span><span class="p">[</span><span class="no">RANDOM_SEED</span><span class="w"> </span><span class="nv"><seed></span><span class="p">]</span><span class="w"> </span><span class="nv"><output_variable></span><span class="nf">)</span><span class="w"></span> </pre></div> </div> <p>Return a random string of given <code class="docutils literal notranslate"><span class="pre"><length></span></code> consisting of characters from the given <code class="docutils literal notranslate"><span class="pre"><alphabet></span></code>. Default length is 5 characters and default alphabet is all numbers and upper and lower case letters. If an integer <code class="docutils literal notranslate"><span class="pre">RANDOM_SEED</span></code> is given, its value will be used to seed the random number generator.</p> <div class="highlight-cmake notranslate" id="timestamp"><div class="highlight"><pre><span></span><span class="nf">string(</span><span class="no">TIMESTAMP</span><span class="w"> </span><span class="nv"><output_variable></span><span class="w"> </span><span class="p">[</span><span class="nv"><format_string></span><span class="p">]</span><span class="w"> </span><span class="p">[</span><span class="no">UTC</span><span class="p">]</span><span class="nf">)</span><span class="w"></span> </pre></div> </div> <p>Write a string representation of the current date and/or time to the <code class="docutils literal notranslate"><span class="pre"><output_variable></span></code>.</p> <p>If the command is unable to obtain a timestamp, the <code class="docutils literal notranslate"><span class="pre"><output_variable></span></code> will be set to the empty string <code class="docutils literal notranslate"><span class="pre">""</span></code>.</p> <p>The optional <code class="docutils literal notranslate"><span class="pre">UTC</span></code> flag requests the current date/time representation to be in Coordinated Universal Time (UTC) rather than local time.</p> <p>The optional <code class="docutils literal notranslate"><span class="pre"><format_string></span></code> may contain the following format specifiers:</p> <dl> <dt><code class="docutils literal notranslate"><span class="pre">%%</span></code></dt><dd><div class="versionadded"> <p><span class="versionmodified added">New in version 3.8.</span></p> </div> <p>A literal percent sign (%).</p> </dd> <dt><code class="docutils literal notranslate"><span class="pre">%d</span></code></dt><dd><p>The day of the current month (01-31).</p> </dd> <dt><code class="docutils literal notranslate"><span class="pre">%H</span></code></dt><dd><p>The hour on a 24-hour clock (00-23).</p> </dd> <dt><code class="docutils literal notranslate"><span class="pre">%I</span></code></dt><dd><p>The hour on a 12-hour clock (01-12).</p> </dd> <dt><code class="docutils literal notranslate"><span class="pre">%j</span></code></dt><dd><p>The day of the current year (001-366).</p> </dd> <dt><code class="docutils literal notranslate"><span class="pre">%m</span></code></dt><dd><p>The month of the current year (01-12).</p> </dd> <dt><code class="docutils literal notranslate"><span class="pre">%b</span></code></dt><dd><div class="versionadded"> <p><span class="versionmodified added">New in version 3.7.</span></p> </div> <p>Abbreviated month name (e.g. Oct).</p> </dd> <dt><code class="docutils literal notranslate"><span class="pre">%B</span></code></dt><dd><div class="versionadded"> <p><span class="versionmodified added">New in version 3.10.</span></p> </div> <p>Full month name (e.g. October).</p> </dd> <dt><code class="docutils literal notranslate"><span class="pre">%M</span></code></dt><dd><p>The minute of the current hour (00-59).</p> </dd> <dt><code class="docutils literal notranslate"><span class="pre">%s</span></code></dt><dd><div class="versionadded"> <p><span class="versionmodified added">New in version 3.6.</span></p> </div> <p>Seconds since midnight (UTC) 1-Jan-1970 (UNIX time).</p> </dd> <dt><code class="docutils literal notranslate"><span class="pre">%S</span></code></dt><dd><p>The second of the current minute. 60 represents a leap second. (00-60)</p> </dd> <dt><code class="docutils literal notranslate"><span class="pre">%f</span></code></dt><dd><div class="versionadded"> <p><span class="versionmodified added">New in version 3.23.</span></p> </div> <p>The microsecond of the current second (000000-999999).</p> </dd> <dt><code class="docutils literal notranslate"><span class="pre">%U</span></code></dt><dd><p>The week number of the current year (00-53).</p> </dd> <dt><code class="docutils literal notranslate"><span class="pre">%V</span></code></dt><dd><div class="versionadded"> <p><span class="versionmodified added">New in version 3.22.</span></p> </div> <p>The ISO 8601 week number of the current year (01-53).</p> </dd> <dt><code class="docutils literal notranslate"><span class="pre">%w</span></code></dt><dd><p>The day of the current week. 0 is Sunday. (0-6)</p> </dd> <dt><code class="docutils literal notranslate"><span class="pre">%a</span></code></dt><dd><div class="versionadded"> <p><span class="versionmodified added">New in version 3.7.</span></p> </div> <p>Abbreviated weekday name (e.g. Fri).</p> </dd> <dt><code class="docutils literal notranslate"><span class="pre">%A</span></code></dt><dd><div class="versionadded"> <p><span class="versionmodified added">New in version 3.10.</span></p> </div> <p>Full weekday name (e.g. Friday).</p> </dd> <dt><code class="docutils literal notranslate"><span class="pre">%y</span></code></dt><dd><p>The last two digits of the current year (00-99).</p> </dd> <dt><code class="docutils literal notranslate"><span class="pre">%Y</span></code></dt><dd><p>The current year.</p> </dd> <dt><code class="docutils literal notranslate"><span class="pre">%z</span></code></dt><dd><div class="versionadded"> <p><span class="versionmodified added">New in version 3.26.</span></p> </div> <p>The offset of the time zone from UTC, in hours and minutes, with format <code class="docutils literal notranslate"><span class="pre">+hhmm</span></code> or <code class="docutils literal notranslate"><span class="pre">-hhmm</span></code>.</p> </dd> <dt><code class="docutils literal notranslate"><span class="pre">%Z</span></code></dt><dd><div class="versionadded"> <p><span class="versionmodified added">New in version 3.26.</span></p> </div> <p>The time zone name.</p> </dd> </dl> <p>Unknown format specifiers will be ignored and copied to the output as-is.</p> <p>If no explicit <code class="docutils literal notranslate"><span class="pre"><format_string></span></code> is given, it will default to:</p> <div class="highlight-none notranslate"><div class="highlight"><pre><span></span>%Y-%m-%dT%H:%M:%S for local time. %Y-%m-%dT%H:%M:%SZ for UTC. </pre></div> </div> <div class="versionadded"> <p><span class="versionmodified added">New in version 3.8: </span>If the <code class="docutils literal notranslate"><span class="pre">SOURCE_DATE_EPOCH</span></code> environment variable is set, its value will be used instead of the current time. See <a class="reference external" href="https://reproducible-builds.org/specs/source-date-epoch/">https://reproducible-builds.org/specs/source-date-epoch/</a> for details.</p> </div> <div class="highlight-cmake notranslate" id="uuid"><div class="highlight"><pre><span></span><span class="nf">string(</span><span class="no">UUID</span><span class="w"> </span><span class="nv"><output_variable></span><span class="w"> </span><span class="no">NAMESPACE</span><span class="w"> </span><span class="nv"><namespace></span><span class="w"> </span><span class="no">NAME</span><span class="w"> </span><span class="nv"><name></span><span class="w"></span> <span class="w"> </span><span class="no">TYPE</span><span class="w"> </span><span class="o"><</span><span class="no">MD5</span><span class="p">|</span><span class="no">SHA1</span><span class="o">></span><span class="w"> </span><span class="p">[</span><span class="no">UPPER</span><span class="p">]</span><span class="nf">)</span><span class="w"></span> </pre></div> </div> <div class="versionadded"> <p><span class="versionmodified added">New in version 3.1.</span></p> </div> <p>Create a universally unique identifier (aka GUID) as per RFC4122 based on the hash of the combined values of <code class="docutils literal notranslate"><span class="pre"><namespace></span></code> (which itself has to be a valid UUID) and <code class="docutils literal notranslate"><span class="pre"><name></span></code>. The hash algorithm can be either <code class="docutils literal notranslate"><span class="pre">MD5</span></code> (Version 3 UUID) or <code class="docutils literal notranslate"><span class="pre">SHA1</span></code> (Version 5 UUID). A UUID has the format <code class="docutils literal notranslate"><span class="pre">xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx</span></code> where each <code class="docutils literal notranslate"><span class="pre">x</span></code> represents a lower case hexadecimal character. Where required, an uppercase representation can be requested with the optional <code class="docutils literal notranslate"><span class="pre">UPPER</span></code> flag.</p> </section> <section id="json"> <span id="id2"></span><h2>JSON<a class="headerlink" href="#json" title="Permalink to this heading">ΒΆ</a></h2> <div class="versionadded"> <p><span class="versionmodified added">New in version 3.19.</span></p> </div> <p>Functionality for querying a JSON string.</p> <div class="admonition note"> <p class="admonition-title">Note</p> <p>In each of the following JSON-related subcommands, if the optional <code class="docutils literal notranslate"><span class="pre">ERROR_VARIABLE</span></code> argument is given, errors will be reported in <code class="docutils literal notranslate"><span class="pre"><error-variable></span></code> and the <code class="docutils literal notranslate"><span class="pre"><out-var></span></code> will be set to <code class="docutils literal notranslate"><span class="pre"><member|index>-[<member|index>...]-NOTFOUND</span></code> with the path elements up to the point where the error occurred, or just <code class="docutils literal notranslate"><span class="pre">NOTFOUND</span></code> if there is no relevant path. If an error occurs but the <code class="docutils literal notranslate"><span class="pre">ERROR_VARIABLE</span></code> option is not present, a fatal error message is generated. If no error occurs, the <code class="docutils literal notranslate"><span class="pre"><error-variable></span></code> will be set to <code class="docutils literal notranslate"><span class="pre">NOTFOUND</span></code>.</p> </div> <div class="highlight-cmake notranslate" id="json-get"><div class="highlight"><pre><span></span><span class="nf">string(</span><span class="no">JSON</span><span class="w"> </span><span class="nv"><out-var></span><span class="w"> </span><span class="p">[</span><span class="no">ERROR_VARIABLE</span><span class="w"> </span><span class="nv"><error-variable></span><span class="p">]</span><span class="w"></span> <span class="w"> </span><span class="no">GET</span><span class="w"> </span><span class="nv"><json-string></span><span class="w"> </span><span class="o"><</span><span class="nb">member</span><span class="p">|</span><span class="nb">index</span><span class="o">></span><span class="w"> </span><span class="p">[</span><span class="o"><</span><span class="nb">member</span><span class="p">|</span><span class="nb">index</span><span class="o">></span><span class="w"> </span><span class="p">...]</span><span class="nf">)</span><span class="w"></span> </pre></div> </div> <p>Get an element from <code class="docutils literal notranslate"><span class="pre"><json-string></span></code> at the location given by the list of <code class="docutils literal notranslate"><span class="pre"><member|index></span></code> arguments. Array and object elements will be returned as a JSON string. Boolean elements will be returned as <code class="docutils literal notranslate"><span class="pre">ON</span></code> or <code class="docutils literal notranslate"><span class="pre">OFF</span></code>. Null elements will be returned as an empty string. Number and string types will be returned as strings.</p> <div class="highlight-cmake notranslate" id="json-type"><div class="highlight"><pre><span></span><span class="nf">string(</span><span class="no">JSON</span><span class="w"> </span><span class="nv"><out-var></span><span class="w"> </span><span class="p">[</span><span class="no">ERROR_VARIABLE</span><span class="w"> </span><span class="nv"><error-variable></span><span class="p">]</span><span class="w"></span> <span class="w"> </span><span class="no">TYPE</span><span class="w"> </span><span class="nv"><json-string></span><span class="w"> </span><span class="o"><</span><span class="nb">member</span><span class="p">|</span><span class="nb">index</span><span class="o">></span><span class="w"> </span><span class="p">[</span><span class="o"><</span><span class="nb">member</span><span class="p">|</span><span class="nb">index</span><span class="o">></span><span class="w"> </span><span class="p">...]</span><span class="nf">)</span><span class="w"></span> </pre></div> </div> <p>Get the type of an element in <code class="docutils literal notranslate"><span class="pre"><json-string></span></code> at the location given by the list of <code class="docutils literal notranslate"><span class="pre"><member|index></span></code> arguments. The <code class="docutils literal notranslate"><span class="pre"><out-var></span></code> will be set to one of <code class="docutils literal notranslate"><span class="pre">NULL</span></code>, <code class="docutils literal notranslate"><span class="pre">NUMBER</span></code>, <code class="docutils literal notranslate"><span class="pre">STRING</span></code>, <code class="docutils literal notranslate"><span class="pre">BOOLEAN</span></code>, <code class="docutils literal notranslate"><span class="pre">ARRAY</span></code>, or <code class="docutils literal notranslate"><span class="pre">OBJECT</span></code>.</p> <div class="highlight-cmake notranslate" id="json-member"><div class="highlight"><pre><span></span><span class="nf">string(</span><span class="no">JSON</span><span class="w"> </span><span class="nv"><out-var></span><span class="w"> </span><span class="p">[</span><span class="no">ERROR_VARIABLE</span><span class="w"> </span><span class="nv"><error-var></span><span class="p">]</span><span class="w"></span> <span class="w"> </span><span class="no">MEMBER</span><span class="w"> </span><span class="nv"><json-string></span><span class="w"></span> <span class="w"> </span><span class="p">[</span><span class="o"><</span><span class="nb">member</span><span class="p">|</span><span class="nb">index</span><span class="o">></span><span class="w"> </span><span class="p">...]</span><span class="w"> </span><span class="nv"><index></span><span class="nf">)</span><span class="w"></span> </pre></div> </div> <p>Get the name of the <code class="docutils literal notranslate"><span class="pre"><index></span></code>-th member in <code class="docutils literal notranslate"><span class="pre"><json-string></span></code> at the location given by the list of <code class="docutils literal notranslate"><span class="pre"><member|index></span></code> arguments. Requires an element of object type.</p> <div class="highlight-cmake notranslate" id="json-length"><div class="highlight"><pre><span></span><span class="nf">string(</span><span class="no">JSON</span><span class="w"> </span><span class="nv"><out-var></span><span class="w"> </span><span class="p">[</span><span class="no">ERROR_VARIABLE</span><span class="w"> </span><span class="nv"><error-variable></span><span class="p">]</span><span class="w"></span> <span class="w"> </span><span class="no">LENGTH</span><span class="w"> </span><span class="nv"><json-string></span><span class="w"> </span><span class="p">[</span><span class="o"><</span><span class="nb">member</span><span class="p">|</span><span class="nb">index</span><span class="o">></span><span class="w"> </span><span class="p">...]</span><span class="nf">)</span><span class="w"></span> </pre></div> </div> <p>Get the length of an element in <code class="docutils literal notranslate"><span class="pre"><json-string></span></code> at the location given by the list of <code class="docutils literal notranslate"><span class="pre"><member|index></span></code> arguments. Requires an element of array or object type.</p> <div class="highlight-cmake notranslate" id="json-remove"><div class="highlight"><pre><span></span><span class="nf">string(</span><span class="no">JSON</span><span class="w"> </span><span class="nv"><out-var></span><span class="w"> </span><span class="p">[</span><span class="no">ERROR_VARIABLE</span><span class="w"> </span><span class="nv"><error-variable></span><span class="p">]</span><span class="w"></span> <span class="w"> </span><span class="no">REMOVE</span><span class="w"> </span><span class="nv"><json-string></span><span class="w"> </span><span class="o"><</span><span class="nb">member</span><span class="p">|</span><span class="nb">index</span><span class="o">></span><span class="w"> </span><span class="p">[</span><span class="o"><</span><span class="nb">member</span><span class="p">|</span><span class="nb">index</span><span class="o">></span><span class="w"> </span><span class="p">...]</span><span class="nf">)</span><span class="w"></span> </pre></div> </div> <p>Remove an element from <code class="docutils literal notranslate"><span class="pre"><json-string></span></code> at the location given by the list of <code class="docutils literal notranslate"><span class="pre"><member|index></span></code> arguments. The JSON string without the removed element will be stored in <code class="docutils literal notranslate"><span class="pre"><out-var></span></code>.</p> <div class="highlight-cmake notranslate" id="json-set"><div class="highlight"><pre><span></span><span class="nf">string(</span><span class="no">JSON</span><span class="w"> </span><span class="nv"><out-var></span><span class="w"> </span><span class="p">[</span><span class="no">ERROR_VARIABLE</span><span class="w"> </span><span class="nv"><error-variable></span><span class="p">]</span><span class="w"></span> <span class="w"> </span><span class="no">SET</span><span class="w"> </span><span class="nv"><json-string></span><span class="w"> </span><span class="o"><</span><span class="nb">member</span><span class="p">|</span><span class="nb">index</span><span class="o">></span><span class="w"> </span><span class="p">[</span><span class="o"><</span><span class="nb">member</span><span class="p">|</span><span class="nb">index</span><span class="o">></span><span class="w"> </span><span class="p">...]</span><span class="w"> </span><span class="nv"><value></span><span class="nf">)</span><span class="w"></span> </pre></div> </div> <p>Set an element in <code class="docutils literal notranslate"><span class="pre"><json-string></span></code> at the location given by the list of <code class="docutils literal notranslate"><span class="pre"><member|index></span></code> arguments to <code class="docutils literal notranslate"><span class="pre"><value></span></code>. The contents of <code class="docutils literal notranslate"><span class="pre"><value></span></code> should be valid JSON.</p> <div class="highlight-cmake notranslate" id="json-equal"><div class="highlight"><pre><span></span><span class="nf">string(</span><span class="no">JSON</span><span class="w"> </span><span class="nv"><out-var></span><span class="w"> </span><span class="p">[</span><span class="no">ERROR_VARIABLE</span><span class="w"> </span><span class="nv"><error-var></span><span class="p">]</span><span class="w"></span> <span class="w"> </span><span class="no">EQUAL</span><span class="w"> </span><span class="nv"><json-string1></span><span class="w"> </span><span class="nv"><json-string2></span><span class="nf">)</span><span class="w"></span> </pre></div> </div> <p>Compare the two JSON objects given by <code class="docutils literal notranslate"><span class="pre"><json-string1></span></code> and <code class="docutils literal notranslate"><span class="pre"><json-string2></span></code> for equality. The contents of <code class="docutils literal notranslate"><span class="pre"><json-string1></span></code> and <code class="docutils literal notranslate"><span class="pre"><json-string2></span></code> should be valid JSON. The <code class="docutils literal notranslate"><span class="pre"><out-var></span></code> will be set to a true value if the JSON objects are considered equal, or a false value otherwise.</p> </section> </section> <div class="clearer"></div> </div> </div> </div> <div class="sphinxsidebar" role="navigation" aria-label="main navigation"> <div class="sphinxsidebarwrapper"> <div> <h3><a href="../index.html">Table of Contents</a></h3> <ul> <li><a class="reference internal" href="#">string</a><ul> <li><a class="reference internal" href="#synopsis">Synopsis</a></li> <li><a class="reference internal" href="#search-and-replace">Search and Replace</a><ul> <li><a class="reference internal" href="#search-and-replace-with-plain-strings">Search and Replace With Plain Strings</a></li> <li><a class="reference internal" href="#search-and-replace-with-regular-expressions">Search and Replace With Regular Expressions</a></li> <li><a class="reference internal" href="#regex-specification">Regex Specification</a></li> </ul> </li> <li><a class="reference internal" href="#manipulation">Manipulation</a></li> <li><a class="reference internal" href="#comparison">Comparison</a></li> <li><a class="reference internal" href="#hashing">Hashing</a></li> <li><a class="reference internal" href="#generation">Generation</a></li> <li><a class="reference internal" href="#json">JSON</a></li> </ul> </li> </ul> </div> <div> <h4>Previous topic</h4> <p class="topless"><a href="site_name.html" title="previous chapter">site_name</a></p> </div> <div> <h4>Next topic</h4> <p class="topless"><a href="unset.html" title="next chapter">unset</a></p> </div> <div role="note" aria-label="source link"> <h3>This Page</h3> <ul class="this-page-menu"> <li><a href="../_sources/command/string.rst.txt" rel="nofollow">Show Source</a></li> </ul> </div> <div id="searchbox" style="display: none" role="search"> <h3 id="searchlabel">Quick search</h3> <div class="searchformwrapper"> <form class="search" action="../search.html" method="get"> <input type="text" name="q" aria-labelledby="searchlabel" autocomplete="off" autocorrect="off" autocapitalize="off" spellcheck="false"/> <input type="submit" value="Go" /> </form> </div> </div> <script>document.getElementById('searchbox').style.display = "block"</script> </div> </div> <div class="clearer"></div> </div> <div class="related" role="navigation" aria-label="related navigation"> <h3>Navigation</h3> <ul> <li class="right" style="margin-right: 10px"> <a href="../genindex.html" title="General Index" >index</a></li> <li class="right" > <a href="unset.html" title="unset" >next</a> |</li> <li class="right" > <a href="site_name.html" title="site_name" >previous</a> |</li> <li> <img src="../_static/cmake-logo-16.png" alt="" style="vertical-align: middle; margin-top: -2px" /> </li> <li> <a href="https://cmake.org/">CMake</a> » </li> <li> <a href="../index.html">3.26.3 Documentation</a> » </li> <li class="nav-item nav-item-1"><a href="../manual/cmake-commands.7.html" >cmake-commands(7)</a> »</li> <li class="nav-item nav-item-this"><a href="">string</a></li> </ul> </div> <div class="footer" role="contentinfo"> © Copyright 2000-2023 Kitware, Inc. and Contributors. Created using <a href="https://www.sphinx-doc.org/">Sphinx</a> 5.0.2. </div> </body> </html>