:: commit 3ac85a6c4ee44573f6d8932d9d5d1bc3351f81db

Nobuhiro Iwamatsu <iwamatsu@nigauri.org> — 2025-08-18 11:18

parents: 2b9b3b504b

cmake: Set the same soname as Makefile.am (#168)

In Makefile.am, soname is set to 1:0:0, but in CMake it is set to 0:0:0.
This means that when building with CMake, libraries with different sonames will
be built. This will not maintain library compatibility.
This sets the same soname in cmake as well.

Before:
```
$ mkdir t && cd t && cmake .. && make
$ ls *.so*
libbzip3.so  libbzip3.so.0  libbzip3.so.0.0.0
$ objdump -p libbzip3.so
  SONAME               libbzip3.so.0.0.0
$ cd .. && autoreconf -ivf && ./configure && make
$ ls .libs/*.so*
.libs/libbzip3.so .libs/libbzip3.so.1 .libs/libbzip3.so.1.0.0
$ objdump -p ./.libs/libbzip3.so | grep SONAME
  SONAME               libbzip3.so.1
```

After:
```
$ mkdir t && cd t && cmake .. && make
$ ls *.so*
libbzip3.so  libbzip3.so.1  libbzip3.so.1.0.0
$ objdump -p libbzip3.so
  SONAME               libbzip3.so.1
```

Signed-off-by: Nobuhiro Iwamatsu <iwamatsu@nigauri.org>
diff --git a/CMakeLists.txt b/CMakeLists.txt
index bf6499c..262a792 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -82,9 +82,9 @@ endif()
 set_target_properties(
   bz3
   PROPERTIES OUTPUT_NAME bzip3
-             SOVERSION "0.0.0"
+             SOVERSION "1"
              PUBLIC_HEADER include/libbz3.h
-             VERSION "0")
+             VERSION "1.0.0")
 if(BUILD_SHARED_LIBS)
   set_target_properties(bz3 PROPERTIES POSITION_INDEPENDENT_CODE ON)
 endif()
tab: 248 wrap: offon