| 
					
				 | 
			
			
				@@ -15,6 +15,7 @@ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 #include "cmGlobalCommonGenerator.h" 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 #include "cmLocalCommonGenerator.h" 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 #include "cmMakefile.h" 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+#include "cmSystemTools.h" 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 #include "cmTarget.h" 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 cmCommonTargetGenerator::cmCommonTargetGenerator(cmGeneratorTarget* gt) 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -26,6 +27,7 @@ cmCommonTargetGenerator::cmCommonTargetGenerator(cmGeneratorTarget* gt) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                       gt->LocalGenerator->GetGlobalGenerator())) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				   , ConfigName(LocalGenerator->GetConfigName()) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				   , ModuleDefinitionFile(GeneratorTarget->GetModuleDefinitionFile(ConfigName)) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+  , FortranModuleDirectoryComputed(false) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -95,3 +97,98 @@ void cmCommonTargetGenerator::AddModuleDefinitionFlag(std::string& flags) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				              this->ModuleDefinitionFile)); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				   this->LocalGenerator->AppendFlags(flags, flag); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+//---------------------------------------------------------------------------- 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+const char* cmCommonTargetGenerator::GetFortranModuleDirectory() 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+{ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+  // Compute the module directory. 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+  if(!this->FortranModuleDirectoryComputed) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    const char* target_mod_dir = 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+      this->Target->GetProperty("Fortran_MODULE_DIRECTORY"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    const char* moddir_flag = 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+      this->Makefile->GetDefinition("CMAKE_Fortran_MODDIR_FLAG"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    if(target_mod_dir && moddir_flag) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+      { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+      // Compute the full path to the module directory. 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+      if(cmSystemTools::FileIsFullPath(target_mod_dir)) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        // Already a full path. 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        this->FortranModuleDirectory = target_mod_dir; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+      else 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        // Interpret relative to the current output directory. 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        this->FortranModuleDirectory = 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+          this->Makefile->GetCurrentBinaryDirectory(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        this->FortranModuleDirectory += "/"; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        this->FortranModuleDirectory += target_mod_dir; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+      // Make sure the module output directory exists. 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+      cmSystemTools::MakeDirectory(this->FortranModuleDirectory.c_str()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+      } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    this->FortranModuleDirectoryComputed = true; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+  // Return the computed directory. 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+  if(this->FortranModuleDirectory.empty()) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    return 0; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+  else 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    return this->FortranModuleDirectory.c_str(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+} 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+//---------------------------------------------------------------------------- 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+void cmCommonTargetGenerator::AddFortranFlags(std::string& flags) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+{ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+  // Enable module output if necessary. 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+  if(const char* modout_flag = 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+     this->Makefile->GetDefinition("CMAKE_Fortran_MODOUT_FLAG")) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    this->LocalGenerator->AppendFlags(flags, modout_flag); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+  // Add a module output directory flag if necessary. 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+  const char* mod_dir = this->GetFortranModuleDirectory(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+  if(!mod_dir) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    mod_dir = this->Makefile->GetDefinition("CMAKE_Fortran_MODDIR_DEFAULT"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+  if(mod_dir) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    const char* moddir_flag = 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+      this->Makefile->GetRequiredDefinition("CMAKE_Fortran_MODDIR_FLAG"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    std::string modflag = moddir_flag; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    modflag += this->Convert(mod_dir, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                             cmLocalGenerator::START_OUTPUT, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                             cmLocalGenerator::SHELL); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    this->LocalGenerator->AppendFlags(flags, modflag); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+  // If there is a separate module path flag then duplicate the 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+  // include path with it.  This compiler does not search the include 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+  // path for modules. 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+  if(const char* modpath_flag = 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+     this->Makefile->GetDefinition("CMAKE_Fortran_MODPATH_FLAG")) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    std::vector<std::string> includes; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    const std::string& config = 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+      this->Makefile->GetSafeDefinition("CMAKE_BUILD_TYPE"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    this->LocalGenerator->GetIncludeDirectories(includes, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                                this->GeneratorTarget, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                                "C", config); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    for(std::vector<std::string>::const_iterator idi = includes.begin(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        idi != includes.end(); ++idi) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+      { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+      std::string flg = modpath_flag; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+      flg += this->Convert(*idi, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                           cmLocalGenerator::NONE, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                           cmLocalGenerator::SHELL); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+      this->LocalGenerator->AppendFlags(flags, flg); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+      } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+} 
			 |