FindPkgConfig: Backslashes in pkg-config output on Windows
When getting a string from pkg-config in FindPkgConfig.cmake
, which contains a path from backslashes (windows). It normalizes this with: -LC:\gtk-build\gtk\x64\release/lib
→ C:gtk-buildgtkx64release/lib
This also happens later on path normalization. Therefore, the PkgConfig
produces broken targets on Windows.
Tested it with:
FindPkgConfig.cmake(137,1):
if (_pkgconfig_failed)
set(_pkgconfig_${_varname} "")
_pkgconfig_unset(${_prefix}_${_varname})
else()
+ if (WIN32)
+ string(REGEX REPLACE "\\" "/" _pkgconfig_invoke_result "${_pkgconfig_invoke_result}")
+ endif()
+ message(STATUS "_pkgconfig_invoke_result: ${_pkgconfig_invoke_result}")
string(REGEX REPLACE "[\r\n]" " " _pkgconfig_invoke_result "${_pkgconfig_invoke_result}")
Note that this works as expected:
string(REPLACE "\\" "/" _pkgconfig_invoke_result "${_pkgconfig_invoke_result}")
Edited by Brad King