Qmake version format for libraries



  • Hello,

    Is there a way to change the way that qmake generates versions for libraries?

    For example: The lib I am building with qmake outputs something like this given VERSION=1

    libfoo.so
    libfoo.so.1 (link to libfoo.so)
    libfoo.so.1.0 (link to libfoo.so)
    libfoo.so.1.0.0 (link to libfoo.so)

    I'd like it to do this:

    libfoo.so
    libfoo.so.1 (link to libfoo.so)

    I can't find anything in the documentation that suggests a way to do this...

    Thanks...



  • The links work this way on my Linux machine:
    @libsimple_example.so -> libsimple_example.so.1.0.0
    libsimple_example.so.1 -> libsimple_example.so.1.0.0
    libsimple_example.so.1.0 -> libsimple_example.so.1.0.0
    libsimple_example.so.1.0.0 ### this is the real file
    @

    I don't know where your link scheme has come from. The creation of symbolic links is hard coded into qmake for most UNIX-like systems. This is absolutely standard behaviour on these machines.

    You can suppress the links using something like:
    @QMAKE_LN_SHLIB = echo Skipping@

    but you will still get a target library name containing the full version number.

    Why do you think you need to avoid behaving in expected ways?



  • I need to conform to my company's naming conventions... not everyone around here uses Unix systems and not everything uses qmake.

    Another way around this would be to change the format of the version number to be JUST the major version. I tried changing VER_MAJ and VER_PAT to 0 and undefined, but it always uses the same format and defaults to 0 when undefined. Is it possible to change the version format or is this also hardcoded?



  • Feel free to rename the library file and ignore the symlinks in your install script.

    Or, write a short shell script that renames and creates the desired links. Have it called after linking with:
    @QMAKE_POST_LINK = ./post_link_script.sh $$quote($(TARGET)) @

    @#!/bin/bash

    TARGET_X_Y_Z=${1}
    TARGET_X_Y=${TARGET_X_Y_Z%.}
    TARGET_X=${TARGET_X_Y%.
    }
    TARGET=${TARGET_X%.*}

    rm $TARGET_X_Y $TARGET_X $TARGET
    mv $TARGET_X_Y_Z $TARGET
    ln -s $TARGET $TARGET_X@


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.