cmCommonTargetGenerator: Return string from GetFortranModuleDirectory
This commit is contained in:
parent
613bc08ac1
commit
7371d8f3b4
|
@ -101,7 +101,7 @@ void cmCommonTargetGenerator::AddModuleDefinitionFlag(std::string& flags)
|
||||||
}
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------------
|
//----------------------------------------------------------------------------
|
||||||
const char* cmCommonTargetGenerator::GetFortranModuleDirectory()
|
std::string cmCommonTargetGenerator::GetFortranModuleDirectory()
|
||||||
{
|
{
|
||||||
// Compute the module directory.
|
// Compute the module directory.
|
||||||
if(!this->FortranModuleDirectoryComputed)
|
if(!this->FortranModuleDirectoryComputed)
|
||||||
|
@ -134,14 +134,7 @@ const char* cmCommonTargetGenerator::GetFortranModuleDirectory()
|
||||||
}
|
}
|
||||||
|
|
||||||
// Return the computed directory.
|
// Return the computed directory.
|
||||||
if(this->FortranModuleDirectory.empty())
|
return this->FortranModuleDirectory;
|
||||||
{
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
return this->FortranModuleDirectory.c_str();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------------
|
//----------------------------------------------------------------------------
|
||||||
|
@ -155,19 +148,24 @@ void cmCommonTargetGenerator::AddFortranFlags(std::string& flags)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Add a module output directory flag if necessary.
|
// Add a module output directory flag if necessary.
|
||||||
const char* mod_dir = this->GetFortranModuleDirectory();
|
std::string mod_dir = this->GetFortranModuleDirectory();
|
||||||
if(!mod_dir)
|
if (!mod_dir.empty())
|
||||||
{
|
{
|
||||||
mod_dir = this->Makefile->GetDefinition("CMAKE_Fortran_MODDIR_DEFAULT");
|
mod_dir = this->Convert(mod_dir,
|
||||||
|
cmLocalGenerator::START_OUTPUT,
|
||||||
|
cmLocalGenerator::SHELL);
|
||||||
}
|
}
|
||||||
if(mod_dir)
|
else
|
||||||
|
{
|
||||||
|
mod_dir =
|
||||||
|
this->Makefile->GetSafeDefinition("CMAKE_Fortran_MODDIR_DEFAULT");
|
||||||
|
}
|
||||||
|
if (!mod_dir.empty())
|
||||||
{
|
{
|
||||||
const char* moddir_flag =
|
const char* moddir_flag =
|
||||||
this->Makefile->GetRequiredDefinition("CMAKE_Fortran_MODDIR_FLAG");
|
this->Makefile->GetRequiredDefinition("CMAKE_Fortran_MODDIR_FLAG");
|
||||||
std::string modflag = moddir_flag;
|
std::string modflag = moddir_flag;
|
||||||
modflag += this->Convert(mod_dir,
|
modflag += mod_dir;
|
||||||
cmLocalGenerator::START_OUTPUT,
|
|
||||||
cmLocalGenerator::SHELL);
|
|
||||||
this->LocalGenerator->AppendFlags(flags, modflag);
|
this->LocalGenerator->AppendFlags(flags, modflag);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -59,7 +59,7 @@ protected:
|
||||||
// Target-wide Fortran module output directory.
|
// Target-wide Fortran module output directory.
|
||||||
bool FortranModuleDirectoryComputed;
|
bool FortranModuleDirectoryComputed;
|
||||||
std::string FortranModuleDirectory;
|
std::string FortranModuleDirectory;
|
||||||
const char* GetFortranModuleDirectory();
|
std::string GetFortranModuleDirectory();
|
||||||
|
|
||||||
// Compute target-specific Fortran language flags.
|
// Compute target-specific Fortran language flags.
|
||||||
void AddFortranFlags(std::string& flags);
|
void AddFortranFlags(std::string& flags);
|
||||||
|
|
|
@ -1069,14 +1069,11 @@ void cmMakefileTargetGenerator::WriteTargetDependRules()
|
||||||
<< " )\n";
|
<< " )\n";
|
||||||
}
|
}
|
||||||
|
|
||||||
// Check for a target-specific module output directory.
|
|
||||||
if(const char* mdir = this->GetFortranModuleDirectory())
|
|
||||||
{
|
|
||||||
*this->InfoFileStream
|
*this->InfoFileStream
|
||||||
<< "\n"
|
<< "\n"
|
||||||
<< "# Fortran module output directory.\n"
|
<< "# Fortran module output directory.\n"
|
||||||
<< "set(CMAKE_Fortran_TARGET_MODULE_DIR \"" << mdir << "\")\n";
|
<< "set(CMAKE_Fortran_TARGET_MODULE_DIR \""
|
||||||
}
|
<< this->GetFortranModuleDirectory() << "\")\n";
|
||||||
|
|
||||||
// and now write the rule to use it
|
// and now write the rule to use it
|
||||||
std::vector<std::string> depends;
|
std::vector<std::string> depends;
|
||||||
|
|
Loading…
Reference in New Issue