summaryrefslogtreecommitdiff
path: root/mesonbuild/modules
diff options
context:
space:
mode:
authorMatthieu Rogez <matthieu.rogez@fivesgroup.com>2023-03-24 14:18:59 +0100
committerEli Schwartz <eschwartz@archlinux.org>2023-07-13 15:39:44 -0400
commitb92858a5beba687478e56850269bc89bc61b3954 (patch)
treebbad0e6ece098873101f0b217939b09ba2947d6c /mesonbuild/modules
parentd2d31c3cc2c22a4ca1dd6464a6f9ecc40a725f0f (diff)
downloadmeson-b92858a5beba687478e56850269bc89bc61b3954.tar.gz
cmake: fix directory separators in generated packageConfig.cmake files
On windows, meson would mix posix and windows dir separators in the computed PACKAGE_RELATIVE_PATH. Here we force posix directory separator even on Windows. This matches the CMake behavior and fixes interpretation of the resulting path. Fixes #6955 Fixes #9702
Diffstat (limited to 'mesonbuild/modules')
-rw-r--r--mesonbuild/modules/cmake.py3
1 files changed, 2 insertions, 1 deletions
diff --git a/mesonbuild/modules/cmake.py b/mesonbuild/modules/cmake.py
index d37c832ab..c6048f925 100644
--- a/mesonbuild/modules/cmake.py
+++ b/mesonbuild/modules/cmake.py
@@ -391,7 +391,8 @@ class CmakeModule(ExtensionModule):
if not os.path.isabs(abs_install_dir):
abs_install_dir = os.path.join(prefix, install_dir)
- PACKAGE_RELATIVE_PATH = os.path.relpath(prefix, abs_install_dir)
+ # path used in cmake scripts are POSIX even on Windows
+ PACKAGE_RELATIVE_PATH = pathlib.PurePath(os.path.relpath(prefix, abs_install_dir)).as_posix()
extra = ''
if re.match('^(/usr)?/lib(64)?/.+', abs_install_dir):
extra = PACKAGE_INIT_EXT.replace('@absInstallDir@', abs_install_dir)