1 /*============================================================================
2 CMake - Cross Platform Makefile Generator
3 Copyright 2000-2009 Kitware, Inc., Insight Software Consortium
5 Distributed under the OSI-approved BSD License (the "License");
6 see accompanying file Copyright.txt for details.
8 This software is distributed WITHOUT ANY WARRANTY; without even the
9 implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
10 See the License for more information.
11 ============================================================================*/
12 #ifndef cmDependsFortran_h
13 #define cmDependsFortran_h
15 #include "cmDepends.h"
17 class cmDependsFortranInternals;
18 class cmDependsFortranSourceInfo;
20 /** \class cmDependsFortran
21 * \brief Dependency scanner for Fortran object files.
23 class cmDependsFortran: public cmDepends
26 /** Checking instances need to know the build directory name and the
27 relative path from the build directory to the target file. */
30 /** Scanning need to know the build directory name, the relative
31 path from the build directory to the target file, the source
32 file from which to start scanning, the include file search
33 path, and the target directory. */
34 cmDependsFortran(cmLocalGenerator* lg);
36 /** Virtual destructor to cleanup subclasses properly. */
37 virtual ~cmDependsFortran();
39 /** Callback from build system after a .mod file has been generated
40 by a Fortran90 compiler to copy the .mod file to the
41 corresponding stamp file. */
42 static bool CopyModule(const std::vector<std::string>& args);
44 /** Determine if a mod file and the corresponding mod.stamp file
45 are representing different module information. */
46 static bool ModulesDiffer(const char* modFile, const char* stampFile,
47 const char* compilerId);
49 /** Method to find an included file in the include path. Fortran
50 always searches the directory containing the including source
52 bool FindIncludeFile(const char* dir, const char* includeName,
53 std::string& fileName);
56 // Finalize the dependency information for the target.
57 virtual bool Finalize(std::ostream& makeDepends,
58 std::ostream& internalDepends);
60 // Find all the modules required by the target.
62 void MatchLocalModules();
63 void MatchRemoteModules(std::istream& fin, const char* stampDir);
64 void ConsiderModule(const char* name, const char* stampDir);
65 bool FindModule(std::string const& name, std::string& module);
67 // Implement writing/checking methods required by superclass.
68 virtual bool WriteDependencies(
69 const std::set<std::string>& sources, const std::string& file,
70 std::ostream& makeDepends, std::ostream& internalDepends);
72 // Actually write the depenencies to the streams.
73 bool WriteDependenciesReal(const char *obj,
74 cmDependsFortranSourceInfo const& info,
75 const char* mod_dir, const char* stamp_dir,
76 std::ostream& makeDepends,
77 std::ostream& internalDepends);
79 // The source file from which to start scanning.
80 std::string SourceFile;
82 std::vector<std::string> PPDefinitions;
84 // Internal implementation details.
85 cmDependsFortranInternals* Internal;
88 cmDependsFortran(cmDependsFortran const&); // Purposely not implemented.
89 void operator=(cmDependsFortran const&); // Purposely not implemented.