diff -Nru cmake-2.8.12/debian/changelog cmake-2.8.12/debian/changelog --- cmake-2.8.12/debian/changelog 2013-10-31 08:46:45.000000000 -0400 +++ cmake-2.8.12/debian/changelog 2013-11-05 10:14:07.000000000 -0500 @@ -1,3 +1,10 @@ +cmake (2.8.12-0ubuntu2) UNRELEASED; urgency=low + + * Imported upstream fix to resolve FTBFS in projects using linker flags + (lp: #1247787). + + -- Stephen M. Webb Tue, 05 Nov 2013 10:13:10 -0500 + cmake (2.8.12-0ubuntu1) trusty; urgency=low * New upstream release LP: #1246701 diff -Nru cmake-2.8.12/debian/patches/series cmake-2.8.12/debian/patches/series --- cmake-2.8.12/debian/patches/series 2013-10-10 06:54:37.000000000 -0400 +++ cmake-2.8.12/debian/patches/series 2013-11-05 10:10:33.000000000 -0500 @@ -4,3 +4,4 @@ multiarch-python-include-dirs.diff qt_import_dir_variable.diff boost-multiarch.patch +valid-interface-link-libraries.patch diff -Nru cmake-2.8.12/debian/patches/valid-interface-link-libraries.patch cmake-2.8.12/debian/patches/valid-interface-link-libraries.patch --- cmake-2.8.12/debian/patches/valid-interface-link-libraries.patch 1969-12-31 19:00:00.000000000 -0500 +++ cmake-2.8.12/debian/patches/valid-interface-link-libraries.patch 2013-11-05 10:11:53.000000000 -0500 @@ -0,0 +1,95 @@ +From: Stephen Kelly +Date: Sun, 20 Oct 2013 20:39:16 +0200 +Bug-Ubuntu: https://bugs.launchpad.net/ubuntu/+source/cmake/+bug/1247787 +Subject: [PATCH] Don't add invalid content to static lib INTERFACE_LINK_LIBRARIES. + +Only valid target names or generator expressions may appear in +the target field of a LINK_ONLY expression. + +Other content like link flags should still be added to that property +(wrapped in config-specific generator expressions), but not wrapped +in LINK_ONLY. Otherwise undue warnings would be issued for the +policy CMP0022. + +The LINK_ONLY expression only has an effect for actual target +names anyway, so there is no logical deficit. +--- + Source/cmTarget.cxx | 15 ++++++++++----- + Source/cmTargetLinkLibrariesCommand.cxx | 11 ++++++++--- + .../target_link_libraries/cmp0022/CMakeLists.txt | 3 +++ + Tests/RunCMake/CMP0022/CMP0022-NOWARN-static.cmake | 6 +++++- + 4 files changed, 26 insertions(+), 9 deletions(-) + +--- a/Source/cmTarget.cxx ++++ b/Source/cmTarget.cxx +@@ -2331,15 +2331,20 @@ + i += this->PrevLinkedLibraries.size(); + for( ; i != libs.end(); ++i ) + { ++ const char *lib = i->first.c_str(); + // We call this so that the dependencies get written to the cache +- this->AddLinkLibrary( mf, selfname, i->first.c_str(), i->second ); ++ this->AddLinkLibrary( mf, selfname, lib, i->second ); + + if (this->GetType() == cmTarget::STATIC_LIBRARY) + { +- this->AppendProperty("INTERFACE_LINK_LIBRARIES", +- ("$GetDebugGeneratorExpressions(i->first.c_str(), i->second) + +- ">").c_str()); ++ std::string configLib = this->GetDebugGeneratorExpressions(lib, ++ i->second); ++ if (cmGeneratorExpression::IsValidTargetName(lib) ++ || cmGeneratorExpression::Find(lib) != std::string::npos) ++ { ++ configLib = "$"; ++ } ++ this->AppendProperty("INTERFACE_LINK_LIBRARIES", configLib.c_str()); + } + } + this->PrevLinkedLibraries = libs; +--- a/Source/cmTargetLinkLibrariesCommand.cxx ++++ b/Source/cmTargetLinkLibrariesCommand.cxx +@@ -384,10 +384,15 @@ + { + if (this->Target->GetType() == cmTarget::STATIC_LIBRARY) + { ++ std::string configLib = this->Target ++ ->GetDebugGeneratorExpressions(lib, llt); ++ if (cmGeneratorExpression::IsValidTargetName(lib) ++ || cmGeneratorExpression::Find(lib) != std::string::npos) ++ { ++ configLib = "$"; ++ } + this->Target->AppendProperty("INTERFACE_LINK_LIBRARIES", +- ("$Target->GetDebugGeneratorExpressions(lib, llt) + +- ">").c_str()); ++ configLib.c_str()); + } + // Not a 'public' or 'interface' library. Do not add to interface + // property. +--- a/Tests/CMakeCommands/target_link_libraries/cmp0022/CMakeLists.txt ++++ b/Tests/CMakeCommands/target_link_libraries/cmp0022/CMakeLists.txt +@@ -22,6 +22,9 @@ + add_library(staticlib2 STATIC staticlib2.cpp) + generate_export_header(staticlib2) + target_link_libraries(staticlib1 LINK_PUBLIC staticlib2) ++if (CMAKE_CXX_COMPILER_ID MATCHES GNU OR CMAKE_CXX_COMPILER_ID MATCHES Clang) ++ target_link_libraries(staticlib1 LINK_PRIVATE "-Wl,-v") ++endif() + + add_executable(staticlib_exe staticlib_exe.cpp) + target_link_libraries(staticlib_exe staticlib1) +--- a/Tests/RunCMake/CMP0022/CMP0022-NOWARN-static.cmake ++++ b/Tests/RunCMake/CMP0022/CMP0022-NOWARN-static.cmake +@@ -5,4 +5,8 @@ + add_library(bar STATIC empty_vs6_2.cpp) + add_library(bat STATIC empty_vs6_3.cpp) + target_link_libraries(foo bar) +-target_link_libraries(bar bat) ++# The last element here needs to contain a space so that it is a single ++# element which is not a valid target name. As bar is a STATIC library, ++# this tests that the LINK_ONLY generator expression is not used for ++# that element, creating an error. ++target_link_libraries(bar bat "-lz -lm")