From 990f77eab35675f323fb320a75e843eb7bddee21 Mon Sep 17 00:00:00 2001 From: Peter Kuemmel Date: Fri, 6 Jul 2012 09:46:00 +0200 Subject: [PATCH 1/4] Ninja: remove int/size_t warning --- Source/cmGlobalNinjaGenerator.cxx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Source/cmGlobalNinjaGenerator.cxx b/Source/cmGlobalNinjaGenerator.cxx index 23f42e440..b405905f7 100644 --- a/Source/cmGlobalNinjaGenerator.cxx +++ b/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) From e3b1be24a808fdb3dc0482a33fe423c0eb945a7b Mon Sep 17 00:00:00 2001 From: Nicolas Despres Date: Mon, 2 Apr 2012 12:35:55 +0200 Subject: [PATCH 2/4] Ninja: Clean all symlink created for libraries. 'ninja -t clean' only cleans built output and dep files so all file created as a side effect and not mentioned in the 'build' statement would be omitted. --- Source/cmNinjaNormalTargetGenerator.cxx | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/Source/cmNinjaNormalTargetGenerator.cxx b/Source/cmNinjaNormalTargetGenerator.cxx index 6befb051c..4787cb31b 100644 --- a/Source/cmNinjaNormalTargetGenerator.cxx +++ b/Source/cmNinjaNormalTargetGenerator.cxx @@ -508,11 +508,20 @@ void cmNinjaNormalTargetGenerator::WriteLinkStatement() emptyDeps, symlinkVars); } else { - symlinkVars["SONAME"] = this->GetTargetFilePath(this->TargetNameSO); + cmNinjaDeps outputs; + 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"] = ""; + outputs.push_back(soName); + } + outputs.push_back(targetOutput); cmGlobalNinjaGenerator::WriteBuild(this->GetBuildFileStream(), "Create library symlink " + targetOutput, "CMAKE_SYMLINK_LIBRARY", - cmNinjaDeps(1, targetOutput), + outputs, cmNinjaDeps(1, targetOutputReal), emptyDeps, emptyDeps, From 9b311fbee66d98b5396f6327305d5163ab78285c Mon Sep 17 00:00:00 2001 From: Peter Kuemmel Date: Tue, 3 Jul 2012 15:01:06 +0200 Subject: [PATCH 3/4] Ninja: add soname test case --- Tests/LibName/CMakeLists.txt | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/Tests/LibName/CMakeLists.txt b/Tests/LibName/CMakeLists.txt index 3dca0b003..07499a14d 100644 --- a/Tests/LibName/CMakeLists.txt +++ b/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) From 6b31d395513fe8ea7b17489b7235c16c1ebad7e1 Mon Sep 17 00:00:00 2001 From: Peter Kuemmel Date: Fri, 6 Jul 2012 10:16:45 +0200 Subject: [PATCH 4/4] Ninja: don't shadow 'outputs' variable --- Source/cmNinjaNormalTargetGenerator.cxx | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/Source/cmNinjaNormalTargetGenerator.cxx b/Source/cmNinjaNormalTargetGenerator.cxx index 4787cb31b..0cf90aa8f 100644 --- a/Source/cmNinjaNormalTargetGenerator.cxx +++ b/Source/cmNinjaNormalTargetGenerator.cxx @@ -508,20 +508,20 @@ void cmNinjaNormalTargetGenerator::WriteLinkStatement() emptyDeps, symlinkVars); } else { - cmNinjaDeps outputs; + 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"] = ""; - outputs.push_back(soName); + symlinks.push_back(soName); } - outputs.push_back(targetOutput); + symlinks.push_back(targetOutput); cmGlobalNinjaGenerator::WriteBuild(this->GetBuildFileStream(), "Create library symlink " + targetOutput, "CMAKE_SYMLINK_LIBRARY", - outputs, + symlinks, cmNinjaDeps(1, targetOutputReal), emptyDeps, emptyDeps,