diff options
author | Johel Ernesto Guerrero Peña <johelegp@gmail.com> | 2021-08-28 14:49:28 (GMT) |
---|---|---|
committer | Johel Ernesto Guerrero Peña <johelegp@gmail.com> | 2021-08-28 14:49:28 (GMT) |
commit | d186797cf6d084ad8c198475757aaa6a33ddbcc7 (patch) | |
tree | e210ac635d73dde214f149d86ba10e2ec59f102f /Help | |
parent | 33d4ec1282c240a81e253924ca04ff58c0626f1a (diff) | |
download | CMake-d186797cf6d084ad8c198475757aaa6a33ddbcc7.zip CMake-d186797cf6d084ad8c198475757aaa6a33ddbcc7.tar.gz CMake-d186797cf6d084ad8c198475757aaa6a33ddbcc7.tar.bz2 |
Help: Fix regex in example of cmake-packages(7)
This change makes it work as intended as opposed to make the condition always true.
This can be confirmed by running the following script:
```
[johel@sundown tmp]$ cat x.cmake
function(f)
set(valid_inputs abc 123)
foreach(input ${ARGV})
if(";${valid_inputs};" MATCHES input)
message("old valid: ${input}")
endif()
if(";${valid_inputs};" MATCHES ";${input};")
message("new valid: ${input}")
endif()
endforeach()
endfunction()
f("0;z;123;12;abc;ab;13;ac")
set(_supported_components Plot Table)
set(ClimbingStats_FIND_COMPONENTS Plot Table P T)
foreach(_comp ${ClimbingStats_FIND_COMPONENTS})
if(NOT ";${_supported_components};" MATCHES _comp)
message("old invalid: set(ClimbingStats_NOT_FOUND_MESSAGE \"Unsupported component: ${_comp}\")")
endif()
if(NOT ";${_supported_components};" MATCHES ";${_comp};")
message("new invalid: set(ClimbingStats_NOT_FOUND_MESSAGE \"Unsupported component: ${_comp}\")")
endif()
endforeach()
[johel@sundown tmp]$ cmake -P x.cmake
new valid: 123
new valid: abc
old invalid: set(ClimbingStats_NOT_FOUND_MESSAGE "Unsupported component: Plot")
old invalid: set(ClimbingStats_NOT_FOUND_MESSAGE "Unsupported component: Table")
old invalid: set(ClimbingStats_NOT_FOUND_MESSAGE "Unsupported component: P")
new invalid: set(ClimbingStats_NOT_FOUND_MESSAGE "Unsupported component: P")
old invalid: set(ClimbingStats_NOT_FOUND_MESSAGE "Unsupported component: T")
new invalid: set(ClimbingStats_NOT_FOUND_MESSAGE "Unsupported component: T")
```
Diffstat (limited to 'Help')
-rw-r--r-- | Help/manual/cmake-packages.7.rst | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/Help/manual/cmake-packages.7.rst b/Help/manual/cmake-packages.7.rst index 5262105..5c109ff 100644 --- a/Help/manual/cmake-packages.7.rst +++ b/Help/manual/cmake-packages.7.rst @@ -449,7 +449,7 @@ be true. This can be tested with logic in the package configuration file: set(_supported_components Plot Table) foreach(_comp ${ClimbingStats_FIND_COMPONENTS}) - if (NOT ";${_supported_components};" MATCHES _comp) + if (NOT ";${_supported_components};" MATCHES ";${_comp};") set(ClimbingStats_FOUND False) set(ClimbingStats_NOT_FOUND_MESSAGE "Unsupported component: ${_comp}") endif() |