diff options
author | Marc Chevrier <marc.chevrier@gmail.com> | 2022-05-18 12:15:03 (GMT) |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2022-05-18 16:43:58 (GMT) |
commit | 98af010b5c8857d59912595bced08c9dab0b7d18 (patch) | |
tree | 935ea766b4c6b68ac76bfb4735ee8743038ad002 | |
parent | 9f469d533d4532bcbea350052b5a7054e94c7de0 (diff) | |
download | CMake-98af010b5c8857d59912595bced08c9dab0b7d18.zip CMake-98af010b5c8857d59912595bced08c9dab0b7d18.tar.gz CMake-98af010b5c8857d59912595bced08c9dab0b7d18.tar.bz2 |
Help: Avoid duplicating registry query syntax in multiple find_* commands
In commit 8d7e80cf3d (find_* commands: add control over Windows registry
views, 2022-04-16) we added documentation that is repeated by multiple
find commands. Move it to a dedicated manual section to avoid duplication.
-rw-r--r-- | Help/command/FIND_XXX.txt | 6 | ||||
-rw-r--r-- | Help/command/FIND_XXX_REGISTRY_QUERY.txt | 43 | ||||
-rw-r--r-- | Help/command/find_package.rst | 7 | ||||
-rw-r--r-- | Help/manual/cmake-developer.7.rst | 63 |
4 files changed, 68 insertions, 51 deletions
diff --git a/Help/command/FIND_XXX.txt b/Help/command/FIND_XXX.txt index ab5f860..6683edb 100644 --- a/Help/command/FIND_XXX.txt +++ b/Help/command/FIND_XXX.txt @@ -54,10 +54,8 @@ Options include: .. versionchanged:: 3.24 On ``Windows`` platform, it is possible to include registry queries as part - of the directories. Such specifications will be ignored on all other - platforms. - - .. include:: FIND_XXX_REGISTRY_QUERY.txt + of the directories, using a :ref:`dedicated syntax <Find Using Windows Registry>`. + Such specifications will be ignored on all other platforms. ``REGISTRY_VIEW`` .. versionadded:: 3.24 diff --git a/Help/command/FIND_XXX_REGISTRY_QUERY.txt b/Help/command/FIND_XXX_REGISTRY_QUERY.txt deleted file mode 100644 index 04a087a..0000000 --- a/Help/command/FIND_XXX_REGISTRY_QUERY.txt +++ /dev/null @@ -1,43 +0,0 @@ -The formal syntax, as specified using -`BNF <https://en.wikipedia.org/wiki/Backus%E2%80%93Naur_form>`_ notation with -the regular extensions, for registry query is the following: - -.. parsed-literal:: - - registry_query ::= '[' `sep_definition`_? `root_key`_ - ((`key_separator`_ `sub_key`_)? (`value_separator`_ `value_name`_)?)? ']' - _`sep_definition` ::= '{' `value_separator`_ '}' - _`root_key` ::= 'HKLM' | 'HKEY_LOCAL_MACHINE' | 'HKCU' | 'HKEY_CURRENT_USER' | - 'HKCR' | 'HKEY_CLASSES_ROOT' | 'HKCC' | 'HKEY_CURRENT_CONFIG' | - 'HKU' | 'HKEY_USERS' - _`sub_key` ::= `element`_ (`key_separator`_ `element`_)* - _`key_separator` ::= '/' | '\\' - _`value_separator` ::= `element`_ | ';' - _`value_name` ::= `element`_ | '(default)' - _`element` ::= `character`_\+ - _`character` ::= <any character except `key_separator`_ and `value_separator`_> - -The `sep_definition`_ optional item offers the possibility to specify the -string used to separate the `sub_key`_ from the `value_name`_ item. If -not specified, the character ``;`` is used. - -.. parsed-literal:: - - # example using default separator - |FIND_XXX| (... **PATHS** "/root/[HKLM/Stuff;InstallDir]/lib[HKLM\\\\Stuff;Architecture]") - - # example using different specified separators - |FIND_XXX| (... **HINTS** "/root/[{|}HKCU/Stuff|InstallDir]/lib[{@@}HKCU\\\\Stuff@@Architecture]") - -If the `value_name`_ item is not specified or has the special name -``(default)``, the content of the default value, if any, will be returned. The -supported types for the `value_name`_ are: - -* ``REG_SZ``. -* ``REG_EXPAND_SZ``. The returned data is expanded. -* ``REG_DWORD``. -* ``REG_QWORD``. - -When the registry query failed, typically because the key does not exist or -the data type is not supported, the string ``/REGISTRY-NOTFOUND`` is substituted -to the ``[]`` query expression. diff --git a/Help/command/find_package.rst b/Help/command/find_package.rst index 8ce6529..a7d7d00 100644 --- a/Help/command/find_package.rst +++ b/Help/command/find_package.rst @@ -309,10 +309,9 @@ that order). .. versionchanged:: 3.24 On ``Windows`` platform, it is possible to include registry queries as part - of the directories specified through ``HINTS`` and ``PATHS`` keywords. Such - specifications will be ignored on all other platforms. - -.. include:: FIND_XXX_REGISTRY_QUERY.txt + of the directories specified through ``HINTS`` and ``PATHS`` keywords, using + a :ref:`dedicated syntax <Find Using Windows Registry>`. Such specifications + will be ignored on all other platforms. .. versionadded:: 3.24 ``REGISTRY_VIEW`` can be specified to manage ``Windows`` registry queries diff --git a/Help/manual/cmake-developer.7.rst b/Help/manual/cmake-developer.7.rst index fe146de..2c6cd96 100644 --- a/Help/manual/cmake-developer.7.rst +++ b/Help/manual/cmake-developer.7.rst @@ -242,6 +242,69 @@ backwards compatibility for any old names that were actually in use. Make sure you comment them as deprecated, so that no-one starts using them. +.. _`Find Using Windows Registry`: + +Find Using Windows Registry +--------------------------- + +.. versionchanged:: 3.24 + +Options ``HINTS`` and ``PATHS`` of :command:`find_file`, +:command:`find_library`, :command:`find_path`, :command:`find_program`, and +:command:`find_package` commands offer the possibility, on ``Windows`` +platform, to query the registry. + +The formal syntax, as specified using +`BNF <https://en.wikipedia.org/wiki/Backus%E2%80%93Naur_form>`_ notation with +the regular extensions, for registry query is the following: + +.. raw:: latex + + \begin{small} + +.. productionlist:: + registry_query: '[' `sep_definition`? `root_key` + : ((`key_separator` `sub_key`)? (`value_separator` `value_name`_)?)? ']' + sep_definition: '{' `value_separator` '}' + root_key: 'HKLM' | 'HKEY_LOCAL_MACHINE' | 'HKCU' | 'HKEY_CURRENT_USER' | + : 'HKCR' | 'HKEY_CLASSES_ROOT' | 'HKCC' | 'HKEY_CURRENT_CONFIG' | + : 'HKU' | 'HKEY_USERS' + sub_key: `element` (`key_separator` `element`)* + key_separator: '/' | '\\' + value_separator: `element` | ';' + value_name: `element` | '(default)' + element: `character`\+ + character: <any character except `key_separator` and `value_separator`> + +.. raw:: latex + + \end{small} + +The :token:`sep_definition` optional item offers the possibility to specify +the string used to separate the :token:`sub_key` from the :token:`value_name` +item. If not specified, the character ``;`` is used. Multiple +:token:`registry_query` items can be specified as part of a path. + +.. code-block:: cmake + + # example using default separator + find_file(... PATHS "/root/[HKLM/Stuff;InstallDir]/lib[HKLM\\\\Stuff;Architecture]") + + # example using different specified separators + find_library(... HINTS "/root/[{|}HKCU/Stuff|InstallDir]/lib[{@@}HKCU\\\\Stuff@@Architecture]") + +If the :token:`value_name` item is not specified or has the special name +``(default)``, the content of the default value, if any, will be returned. The +supported types for the :token:`value_name` are: + +* ``REG_SZ``. +* ``REG_EXPAND_SZ``. The returned data is expanded. +* ``REG_DWORD``. +* ``REG_QWORD``. + +When the registry query failed, typically because the key does not exist or +the data type is not supported, the string ``/REGISTRY-NOTFOUND`` is substituted +to the ``[]`` query expression. A Sample Find Module -------------------- |