Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Simulate autotools behaviour in SO-NAME and symlink generation. #483

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

coldtobi
Copy link

This patch aligns cmake so that the SONAME and library name matches the output of autotools:

With autotools: (build and then make install DESTDIR=sometmpdir)

tobi@isildor:~/workspace/deb/packages/log4cplus/upstream/log4cplus/build/tmp/usr/local/lib$ ls -la 
insgesamt 21448
drwxr-xr-x 3 tobi tobi     4096 28. Okt 18:08 .
drwxr-xr-x 4 tobi tobi     4096 28. Okt 18:08 ..
lrwxrwxrwx 1 tobi tobi       25 28. Okt 18:08 liblog4cplus-3.0.so.0 -> liblog4cplus-3.0.so.0.0.0
-rwxr-xr-x 1 tobi tobi 10671368 28. Okt 18:08 liblog4cplus-3.0.so.0.0.0
-rwxr-xr-x 1 tobi tobi      967 28. Okt 18:08 liblog4cplus.la
lrwxrwxrwx 1 tobi tobi       25 28. Okt 18:08 liblog4cplus.so -> liblog4cplus-3.0.so.0.0.0
drwxr-xr-x 2 tobi tobi     4096 28. Okt 18:08 pkgconfig

(the unicode flavour libs has been removed from above ls to illustrate the point better)

With CMake: (build and then make install DESTDIR=sometmpdir)

tobi@isildor:~/workspace/deb/packages/log4cplus/upstream/log4cplus/build_cmake/tmp/usr/local/lib$ ls -lah
insgesamt 6,4M
drwxr-xr-x 3 tobi tobi 4,0K 28. Okt 18:14 .
drwxr-xr-x 5 tobi tobi 4,0K 28. Okt 18:14 ..
drwxr-xr-x 3 tobi tobi 4,0K 28. Okt 18:14 cmake
lrwxrwxrwx 1 tobi tobi   21 28. Okt 18:14 liblog4cplus-3.0.so -> liblog4cplus-3.0.so.3
-rw-r--r-- 1 tobi tobi 6,4M 28. Okt 18:13 liblog4cplus-3.0.so.0.0.0
lrwxrwxrwx 1 tobi tobi   25 28. Okt 18:14 liblog4cplus-3.0.so.3 -> liblog4cplus-3.0.so.0.0.0

Please note that there is still one discrepancy: Autotools generates a SO-Version of zero (as configured in configure.ac) and CMake does a SO-Version of 3 (as you recently changed in wilx@aa1a04c) I left this to you to decide whether it sould be "zero" or "three", but it should be aligned.

Thanks!

set(lib ${CMAKE_SHARED_LIBRARY_PREFIX})
set(so ${CMAKE_SHARED_LIBRARY_SUFFIX})
install(CODE "execute_process(
COMMAND bash -c \"set -e
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This will not work with many platforms.

Copy link
Author

@coldtobi coldtobi Nov 9, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

right, this should be wrapped in some if(LINUX) or like…

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants