[CMake] How to create libfoo.so.1 style names for OS X shared libraries

Blair Zajac blair at orcaware.com
Fri Feb 15 18:42:39 EST 2013


On 02/15/2013 01:02 PM, Blair Zajac wrote:
> 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 found the code doing this:

void cmTarget::ComputeVersionedName(std::string& vName,
                                     std::string const& prefix,
                                     std::string const& base,
                                     std::string const& suffix,
                                     std::string const& name,
                                     const char* version)
{

   vName = this->IsApple? (prefix+base) : name;
   if(version)
     {
     vName += ".";
     vName += version;
     }
   vName += this->IsApple? suffix : std::string();
}

I'd like to submit a pull request that would disable or ignore the check 
for IsApple and treat Apple as other operating systems.  What name 
should I use for this?  CMAKE_APPLE_VERSIONED_NAMES, which would be true 
by default on Apple and false otherwise?

Blair




More information about the CMake mailing list