summaryrefslogtreecommitdiffstats
path: root/Modules/FindPkgConfig.cmake
diff options
context:
space:
mode:
authorAlex Birch <51103-Birchlabs@users.noreply.gitlab.kitware.com>2021-12-31 16:48:56 (GMT)
committerBrad King <brad.king@kitware.com>2022-05-12 16:26:04 (GMT)
commit5cfbc763716c1e15ee20a24c503b9b7371a2da28 (patch)
tree72220ba4c1036cccb0e9c933d5f59575a9d33dec /Modules/FindPkgConfig.cmake
parent364fde65ee93588cb519ece09b161c0e8e826c3c (diff)
downloadCMake-5cfbc763716c1e15ee20a24c503b9b7371a2da28.zip
CMake-5cfbc763716c1e15ee20a24c503b9b7371a2da28.tar.gz
CMake-5cfbc763716c1e15ee20a24c503b9b7371a2da28.tar.bz2
FindPkgConfig: Fix parsing of backslash-escaped spaces in pkg-config output
Treat backslash-escaped spaces as "space within argument" rather than "space delimiting arguments". Update our `FindPkgConfig_LIBRARY_PATH` test case to escape spaces in the path, and run it unconditionally.
Diffstat (limited to 'Modules/FindPkgConfig.cmake')
-rw-r--r--Modules/FindPkgConfig.cmake4
1 files changed, 3 insertions, 1 deletions
diff --git a/Modules/FindPkgConfig.cmake b/Modules/FindPkgConfig.cmake
index 547bc52..ffcd8b7 100644
--- a/Modules/FindPkgConfig.cmake
+++ b/Modules/FindPkgConfig.cmake
@@ -143,7 +143,9 @@ macro(_pkgconfig_invoke _pkglist _prefix _varname _regexp)
string(REGEX REPLACE "${_regexp}" " " _pkgconfig_invoke_result "${_pkgconfig_invoke_result}")
endif()
- separate_arguments(_pkgconfig_invoke_result)
+ # pkg-config can represent "spaces within an argument" by backslash-escaping the space.
+ # UNIX_COMMAND mode treats backslash-escaped spaces as "not a space that delimits arguments".
+ separate_arguments(_pkgconfig_invoke_result UNIX_COMMAND "${_pkgconfig_invoke_result}")
#message(STATUS " ${_varname} ... ${_pkgconfig_invoke_result}")
set(_pkgconfig_${_varname} ${_pkgconfig_invoke_result})