|  | @@ -1463,32 +1463,34 @@ void cmLocalGenerator::OutputLinkLibraries(
 | 
											
												
													
														|  |      linkLibs += " ";
 |  |      linkLibs += " ";
 | 
											
												
													
														|  |    }
 |  |    }
 | 
											
												
													
														|  |  
 |  |  
 | 
											
												
													
														|  | 
 |  | +  std::string rpath;
 | 
											
												
													
														|  | 
 |  | +
 | 
											
												
													
														|  |    // Check what kind of rpath flags to use.
 |  |    // Check what kind of rpath flags to use.
 | 
											
												
													
														|  |    if (cli.GetRuntimeSep().empty()) {
 |  |    if (cli.GetRuntimeSep().empty()) {
 | 
											
												
													
														|  |      // Each rpath entry gets its own option ("-R a -R b -R c")
 |  |      // Each rpath entry gets its own option ("-R a -R b -R c")
 | 
											
												
													
														|  |      std::vector<std::string> runtimeDirs;
 |  |      std::vector<std::string> runtimeDirs;
 | 
											
												
													
														|  |      cli.GetRPath(runtimeDirs, relink);
 |  |      cli.GetRPath(runtimeDirs, relink);
 | 
											
												
													
														|  |  
 |  |  
 | 
											
												
													
														|  | -    std::string rpath;
 |  | 
 | 
											
												
													
														|  |      for (std::vector<std::string>::iterator ri = runtimeDirs.begin();
 |  |      for (std::vector<std::string>::iterator ri = runtimeDirs.begin();
 | 
											
												
													
														|  |           ri != runtimeDirs.end(); ++ri) {
 |  |           ri != runtimeDirs.end(); ++ri) {
 | 
											
												
													
														|  |        rpath += cli.GetRuntimeFlag();
 |  |        rpath += cli.GetRuntimeFlag();
 | 
											
												
													
														|  |        rpath += this->ConvertToOutputFormat(*ri, shellFormat);
 |  |        rpath += this->ConvertToOutputFormat(*ri, shellFormat);
 | 
											
												
													
														|  |        rpath += " ";
 |  |        rpath += " ";
 | 
											
												
													
														|  |      }
 |  |      }
 | 
											
												
													
														|  | -    fout << rpath;
 |  | 
 | 
											
												
													
														|  |    } else {
 |  |    } else {
 | 
											
												
													
														|  |      // All rpath entries are combined ("-Wl,-rpath,a:b:c").
 |  |      // All rpath entries are combined ("-Wl,-rpath,a:b:c").
 | 
											
												
													
														|  | -    std::string rpath = cli.GetRPathString(relink);
 |  | 
 | 
											
												
													
														|  | 
 |  | +    std::string rpathString = cli.GetRPathString(relink);
 | 
											
												
													
														|  |  
 |  |  
 | 
											
												
													
														|  |      // Store the rpath option in the stream.
 |  |      // Store the rpath option in the stream.
 | 
											
												
													
														|  | -    if (!rpath.empty()) {
 |  | 
 | 
											
												
													
														|  | -      fout << cli.GetRuntimeFlag();
 |  | 
 | 
											
												
													
														|  | -      fout << this->EscapeForShell(rpath, escapeAllowMakeVars);
 |  | 
 | 
											
												
													
														|  | -      fout << " ";
 |  | 
 | 
											
												
													
														|  | 
 |  | +    if (!rpathString.empty()) {
 | 
											
												
													
														|  | 
 |  | +      rpath += cli.GetRuntimeFlag();
 | 
											
												
													
														|  | 
 |  | +      rpath += this->EscapeForShell(rpathString, escapeAllowMakeVars);
 | 
											
												
													
														|  | 
 |  | +      rpath += " ";
 | 
											
												
													
														|  |      }
 |  |      }
 | 
											
												
													
														|  |    }
 |  |    }
 | 
											
												
													
														|  |  
 |  |  
 | 
											
												
													
														|  | 
 |  | +  fout << rpath;
 | 
											
												
													
														|  | 
 |  | +
 | 
											
												
													
														|  |    // Write the library flags to the build rule.
 |  |    // Write the library flags to the build rule.
 | 
											
												
													
														|  |    fout << linkLibs;
 |  |    fout << linkLibs;
 | 
											
												
													
														|  |  
 |  |  
 |