Browse Source

Ninja: Add OS X dylib versioning (#14140)

Teach the Ninja generator to add the `-current_version` and the
`-compatibility_version` flags based on the VERSION and SOVERSION target
properties just as the Makefile generators do.

Signed-off-by: Bruce Stephens <[email protected]>
Bruce Stephens 9 years ago
parent
commit
9e165a64ad
1 changed files with 10 additions and 0 deletions
  1. 10 0
      Source/cmNinjaNormalTargetGenerator.cxx

+ 10 - 0
Source/cmNinjaNormalTargetGenerator.cxx

@@ -504,6 +504,16 @@ void cmNinjaNormalTargetGenerator::WriteLinkStatement()
       }
     }
 
+  // Add OS X version flags, if any.
+  if(this->GeneratorTarget->GetType() == cmState::SHARED_LIBRARY ||
+     this->GeneratorTarget->GetType() == cmState::MODULE_LIBRARY)
+    {
+    this->AppendOSXVerFlag(vars["LINK_FLAGS"], this->TargetLinkLanguage,
+                           "COMPATIBILITY", true);
+    this->AppendOSXVerFlag(vars["LINK_FLAGS"], this->TargetLinkLanguage,
+                           "CURRENT", false);
+    }
+
   this->addPoolNinjaVariable("JOB_POOL_LINK", &gt, vars);
 
   this->AddModuleDefinitionFlag(vars["LINK_FLAGS"]);