[CMake] How to create libfoo.so.1 style names for OS X shared libraries
Blair Zajac
blair at orcaware.com
Fri Feb 15 16:02:12 EST 2013
We have an existing deployment of a large amount of internal software on
Linux using custom build and link tools that expect a certain naming
layout. We're porting it over to OS X and to be consistent we want to
name shared libraries with the Linux style, that is, libOpenImageIO.so.32.
OpenImageIO uses CMake and it works great on Linux in creating
libOpenImageIO.so.32 but on Mac OS X it is creating libOpenImageIO.32.so
instead. I'm setting SUFFIX to .so to create .so instead of .dylib:
set_target_properties(OpenImageIO PROPERTIES SUFFIX .so)
But am unable to get CMake to switch the .so and SOVERSION order.
$ find -name lib\* \! -type d
./build/macosx/libOpenImageIO/libOpenImageIO.1.2.0.so
./build/macosx/libOpenImageIO/libOpenImageIO.32.so
./build/macosx/libOpenImageIO/libOpenImageIO.so
./dist/macosx/lib/libOpenImageIO.1.2.0.so
./dist/macosx/lib/libOpenImageIO.32.so
./dist/macosx/lib/libOpenImageIO.so
Trying to use OUTPUT_NAME doesn't work. This code:
set_target_properties(OpenImageIO
PROPERTIES
OUTPUT_NAME libOpenImageIO.so.${SOVERSION})
creates build/macosx/libOpenImageIO/liblibOpenImageIO.so.32.1.2.0.so,
suggests that OUTPUT_NAME is only for the base part of the shared
library and CMake will always reverse the order of SUFFIX and VERSION.
Any suggestions?
There's a stack overflow question for this at [2].
Thanks,
Blair
[1] https://sites.google.com/site/openimageio/
[2] http://stackoverflow.com/q/14902773/80731
More information about the CMake
mailing list