Jussi Pakkanen wrote:
On Wed, Feb 17, 2010 at 11:57 AM, Martin Hollmichel
<[email protected]> wrote:

usually I analyse the build logs for understanding these kind of mechanisms,
here's my extract for sal module on Linux:
...
tr -d "\015" < sal.map | awk -f ...../solenv/bin/addsym.awk >
../unxlngi6.pro/misc/sal_uno_sal.map
....
Making: ../unxlngi6.pro/lib/libuno_sal.so.3
g++ -Wl,-z,noexecstack -Wl,-z,combreloc -Wl,-z,defs -Wl,-Bsymbolic-functions
-Wl,--dynamic-list-cpp-new -Wl,--dynamic-list-cpp-typeinfo
-Wl,--hash-style=both -Wl,-rpath,'$ORIGIN' "-Wl,-hlibuno_sal.so.3" -shared
-Wl,-O1 -Wl,--version-script ../unxlngi6.pro/misc/sal_uno_sal.map .......

There seem to be two phases in this. First you generate the target
file with awk and then pass it to the linker. The first one is
straightforward.

The latter is a bit trickier but not very hard. First you set a
dependency between the shared library and the generated version file.
Then you need to pass the file to the linker. CMake allows you to
define custom linker flags per target. To get the above you would add
something like this:

set_target_properties(sal PROPERTIES LINK_FLAGS "-Wl,--version-script
${GENERATED_SAL_MAP_FILE}")

the process for Windows (MSVC) is very similar, I already invented a function add_mapfile(<libname> <map>) to do the job. I guess this approach will work for all other platforms as well.

thanks,

Martin

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]



---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to