~ubuntu-branches/ubuntu/hoary/cmake/hoary

« back to all changes in this revision

Viewing changes to Source/cmExportLibraryDependencies.cxx

  • Committer: Bazaar Package Importer
  • Author(s): A. Maitland Bottoms
  • Date: 2004-08-12 09:21:32 UTC
  • mfrom: (1.1.2 upstream)
  • Revision ID: james.westby@ubuntu.com-20040812092132-qus2c27xt84ypfx4
Tags: 2.0.3-1
* New upstream release
* finds QT's moc, gets bug closing syntax right (Closes: #250000)

Show diffs side-by-side

added added

removed removed

Lines of Context:
3
3
  Program:   CMake - Cross-Platform Makefile Generator
4
4
  Module:    $RCSfile: cmExportLibraryDependencies.cxx,v $
5
5
  Language:  C++
6
 
  Date:      $Date: 2003/08/01 13:11:04 $
7
 
  Version:   $Revision: 1.3 $
 
6
  Date:      $Date: 2004/03/16 17:54:39 $
 
7
  Version:   $Revision: 1.5 $
8
8
 
9
9
  Copyright (c) 2002 Kitware, Inc., Insight Consortium.  All rights reserved.
10
10
  See Copyright.txt or http://www.cmake.org/HTML/Copyright.html for details.
17
17
#include "cmExportLibraryDependencies.h"
18
18
#include "cmGlobalGenerator.h"
19
19
#include "cmLocalGenerator.h"
 
20
#include "cmGeneratedFileStream.h"
20
21
#include "cmake.h"
21
22
 
 
23
#include <memory> // auto_ptr
 
24
 
22
25
// cmExecutableCommand
23
26
bool cmExportLibraryDependenciesCommand::InitialPass(std::vector<std::string> const& args)
24
27
{
49
52
    }
50
53
    
51
54
 
52
 
  // Create a full path filename for output Testfile
 
55
  // Create a full path filename for output
53
56
  std::string fname = m_Args[0];
54
57
  bool append = false;
55
58
  if(m_Args.size() > 1)
59
62
      append = true;
60
63
      }
61
64
    }
62
 
  // Open the output Testfile
63
 
  std::ofstream fout;
 
65
 
 
66
  // Use copy-if-different if not appending.
 
67
  std::ostream* foutPtr;
 
68
  std::auto_ptr<cmGeneratedFileStream> foutNew;
64
69
  if(append)
65
70
    {
66
 
    fout.open(fname.c_str(), std::ios::app);
 
71
    foutPtr = new std::ofstream(fname.c_str(), std::ios::app);
67
72
    }
68
73
  else
69
74
    {
70
 
      fout.open(fname.c_str());
 
75
    std::auto_ptr<cmGeneratedFileStream> ap(
 
76
      new cmGeneratedFileStream(fname.c_str()));
 
77
    foutNew = ap;
 
78
    foutPtr = &foutNew->GetStream();
71
79
    }
 
80
  std::ostream& fout = *foutPtr;
 
81
 
72
82
  if (!fout)
73
83
    {
74
84
    cmSystemTools::Error("Error Writing ", fname.c_str());
116
126
        }
117
127
      }
118
128
    }
119
 
  fout.close();
120
129
  return;
121
130
}