diff --git a/Source/cmExportLibraryDependencies.cxx b/Source/cmExportLibraryDependencies.cxx index 7dab94073..6c56c3cd9 100644 --- a/Source/cmExportLibraryDependencies.cxx +++ b/Source/cmExportLibraryDependencies.cxx @@ -60,14 +60,16 @@ void cmExportLibraryDependenciesCommand::FinalPass() std::auto_ptr foutPtr; if(append) { - foutPtr.reset(new std::ofstream(fname.c_str(), std::ios::app)); + std::auto_ptr ap( + new std::ofstream(fname.c_str(), std::ios::app)); + foutPtr = ap; } else { std::auto_ptr ap( new cmGeneratedFileStream(fname.c_str(), true)); ap->SetCopyIfDifferent(true); - foutPtr.reset(ap.release()); + foutPtr = ap; } std::ostream& fout = *foutPtr.get();