diff options
author | Matthieu Rogez <matthieu.rogez@fivesgroup.com> | 2023-03-24 14:18:59 +0100 |
---|---|---|
committer | Eli Schwartz <eschwartz@archlinux.org> | 2023-07-13 15:39:44 -0400 |
commit | b92858a5beba687478e56850269bc89bc61b3954 (patch) | |
tree | bbad0e6ece098873101f0b217939b09ba2947d6c /test cases/cmake | |
parent | d2d31c3cc2c22a4ca1dd6464a6f9ecc40a725f0f (diff) | |
download | meson-b92858a5beba687478e56850269bc89bc61b3954.zip meson-b92858a5beba687478e56850269bc89bc61b3954.tar.gz meson-b92858a5beba687478e56850269bc89bc61b3954.tar.bz2 |
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 'test cases/cmake')
3 files changed, 25 insertions, 0 deletions
diff --git a/test cases/cmake/26 cmake package prefix dir/cmakePackagePrefixDirConfig.cmake.in b/test cases/cmake/26 cmake package prefix dir/cmakePackagePrefixDirConfig.cmake.in new file mode 100644 index 0000000..a18cb7d --- /dev/null +++ b/test cases/cmake/26 cmake package prefix dir/cmakePackagePrefixDirConfig.cmake.in @@ -0,0 +1 @@ +@PACKAGE_INIT@ diff --git a/test cases/cmake/26 cmake package prefix dir/meson.build b/test cases/cmake/26 cmake package prefix dir/meson.build new file mode 100644 index 0000000..851371b --- /dev/null +++ b/test cases/cmake/26 cmake package prefix dir/meson.build @@ -0,0 +1,19 @@ +project('cmakePackagePrefixDir', 'c', version: '1.0.0') + +cmake = import('cmake') + +cmake.configure_package_config_file( + name: 'cmakePackagePrefixDir', + input: 'cmakePackagePrefixDirConfig.cmake.in', + configuration: configuration_data(), +) + +# NOTE: can't use fs.read because cmakePackagePrefixDirConfig.cmake is in build_dir +python = find_program('python3') +lines = run_command(python, '-c', + '[print(line, end="") for line in open("@0@")]'.format(meson.current_build_dir() / 'cmakePackagePrefixDirConfig.cmake'), check : true, +).stdout().split('\n') + +message(lines) + +assert(lines[5] == 'get_filename_component(PACKAGE_PREFIX_DIR "${CMAKE_CURRENT_LIST_DIR}/../../.." ABSOLUTE)') diff --git a/test cases/cmake/26 cmake package prefix dir/test.json b/test cases/cmake/26 cmake package prefix dir/test.json new file mode 100644 index 0000000..d6a9505 --- /dev/null +++ b/test cases/cmake/26 cmake package prefix dir/test.json @@ -0,0 +1,5 @@ +{ + "installed": [ + {"type": "file", "file": "usr/lib/cmake/cmakePackagePrefixDir/cmakePackagePrefixDirConfig.cmake"} + ] +} |