summaryrefslogtreecommitdiff
path: root/test cases/cmake
diff options
context:
space:
mode:
authorJulianne Swinoga <jswinoga@kepler.space>2025-06-05 17:47:51 -0400
committerEli Schwartz <eschwartz93@gmail.com>2025-08-26 01:35:18 -0400
commit8992d4fdf5b7a2c2d37d2d61d7a640d8e4c09f2b (patch)
tree4ddf057a96c166a015dda393a9fd64e8c8d134af /test cases/cmake
parent01884547172ff0182e34f4d7212913459210cf09 (diff)
downloadmeson-8992d4fdf5b7a2c2d37d2d61d7a640d8e4c09f2b.tar.gz
Set version, soversion from cmake if available
Diffstat (limited to 'test cases/cmake')
-rw-r--r--test cases/cmake/2 advanced/meson.build18
1 files changed, 18 insertions, 0 deletions
diff --git a/test cases/cmake/2 advanced/meson.build b/test cases/cmake/2 advanced/meson.build
index 39da0c6ad..43b5f8b30 100644
--- a/test cases/cmake/2 advanced/meson.build
+++ b/test cases/cmake/2 advanced/meson.build
@@ -27,3 +27,21 @@ test('test3', sub_pro.target('testEXE'))
# Test that we can add a new target with the same name as the CMake subproject
exe4 = executable('testEXE', ['main.cpp'], dependencies: [sub_sta])
test('test4', exe4)
+
+# Test if libraries are named correctly
+assert(sub_pro.target_type('cmModLib') == 'shared_library', 'Type should be shared_library')
+expected_soversion_str = '1'
+expected_version_str = '1.0.1'
+lib_file_name = import('fs').name(sub_pro.target('cmModLib').full_path())
+if host_machine.system() == 'linux'
+ # Linux shared libraries end with their version: libcmModLib.so.1.0.1
+ lib_version_ok = lib_file_name.endswith(expected_version_str)
+elif host_machine.system() == 'darwin'
+ # MacOS shared libraries are suffixed with their soversion: libcmModLib.1.dylib
+ lib_version_ok = lib_file_name.split('.')[1] == expected_soversion_str
+else
+ # Don't try to assert anything about the library version, either unknown host
+ # system or host system doesn't support versioning of shared libraries
+ lib_version_ok = true
+endif
+assert(lib_version_ok, f'Shared library version @lib_file_name@ not picked up correctly')