Browse Source

Merge topic 'ninja-fixes'

6b31d39 Ninja: don't shadow 'outputs' variable
9b311fb Ninja: add soname test case
e3b1be2 Ninja: Clean all symlink created for libraries.
990f77e Ninja: remove int/size_t warning
David Cole 13 years ago
parent
commit
2e43272187

+ 1 - 1
Source/cmGlobalNinjaGenerator.cxx

@@ -558,7 +558,7 @@ void cmGlobalNinjaGenerator::AddRule(const std::string& name,
                                     restat,
                                     generator);
 
-  this->RuleCmdLength[name] = command.size();
+  this->RuleCmdLength[name] = (int) command.size();
 }
 
 bool cmGlobalNinjaGenerator::HasRule(const std::string &name)

+ 11 - 2
Source/cmNinjaNormalTargetGenerator.cxx

@@ -508,11 +508,20 @@ void cmNinjaNormalTargetGenerator::WriteLinkStatement()
                                          emptyDeps,
                                          symlinkVars);
     } else {
-      symlinkVars["SONAME"] = this->GetTargetFilePath(this->TargetNameSO);
+      cmNinjaDeps symlinks;
+      const std::string soName = this->GetTargetFilePath(this->TargetNameSO);
+      // If one link has to be created.
+      if (targetOutputReal == soName || targetOutput == soName) {
+        symlinkVars["SONAME"] = soName;
+      } else {
+        symlinkVars["SONAME"] = "";
+        symlinks.push_back(soName);
+      }
+      symlinks.push_back(targetOutput);
       cmGlobalNinjaGenerator::WriteBuild(this->GetBuildFileStream(),
                                       "Create library symlink " + targetOutput,
                                          "CMAKE_SYMLINK_LIBRARY",
-                                         cmNinjaDeps(1, targetOutput),
+                                         symlinks,
                                          cmNinjaDeps(1, targetOutputReal),
                                          emptyDeps,
                                          emptyDeps,

+ 13 - 0
Tests/LibName/CMakeLists.txt

@@ -3,11 +3,24 @@ project(LibName)
 # LIBRARY_OUTPUT_PATH and EXECUTABLE_OUTPUT_PATH work
 set(LIBRARY_OUTPUT_PATH  lib)
 set(EXECUTABLE_OUTPUT_PATH lib)
+
 add_library(bar SHARED bar.c)
+
 add_library(foo SHARED foo.c)
 target_link_libraries(foo bar)
+
 add_executable(foobar foobar.c)
 target_link_libraries(foobar foo)
 IF(UNIX)
   target_link_libraries(foobar -L/usr/local/lib)
 ENDIF(UNIX)
+
+
+# check with lib version
+
+add_library(verFoo SHARED foo.c)
+target_link_libraries(verFoo bar)
+set_target_properties(verFoo PROPERTIES VERSION 3.1.4 SOVERSION 3)
+
+add_executable(verFoobar foobar.c)
+target_link_libraries(verFoobar verFoo)