summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2016-09-19 15:30:34 -0400
committerBrad King <brad.king@kitware.com>2016-09-20 08:48:41 -0400
commit1777570fe5eb194d930f6716865bc909269da57e (patch)
tree5608cc4e62adcaee41f8ed776ee3d91c17856f8f
parent6b8812c27e6df1d10fa4bfc30cb3eadd08d7966b (diff)
downloadcmake-1777570fe5eb194d930f6716865bc909269da57e.tar.gz
cmGeneratorTarget: Refactor Fortran module directory lookup
Make `target_module_dir` and owned value so we can modify it.
-rw-r--r--Source/cmGeneratorTarget.cxx7
1 files changed, 5 insertions, 2 deletions
diff --git a/Source/cmGeneratorTarget.cxx b/Source/cmGeneratorTarget.cxx
index 1e21ac4923..bed0b115a9 100644
--- a/Source/cmGeneratorTarget.cxx
+++ b/Source/cmGeneratorTarget.cxx
@@ -3896,10 +3896,13 @@ std::string cmGeneratorTarget::GetFortranModuleDirectory() const
std::string cmGeneratorTarget::CreateFortranModuleDirectory() const
{
std::string mod_dir;
- const char* target_mod_dir = this->GetProperty("Fortran_MODULE_DIRECTORY");
+ std::string target_mod_dir;
+ if (const char* prop = this->GetProperty("Fortran_MODULE_DIRECTORY")) {
+ target_mod_dir = prop;
+ }
const char* moddir_flag =
this->Makefile->GetDefinition("CMAKE_Fortran_MODDIR_FLAG");
- if (target_mod_dir && moddir_flag) {
+ if (!target_mod_dir.empty() && moddir_flag) {
// Compute the full path to the module directory.
if (cmSystemTools::FileIsFullPath(target_mod_dir)) {
// Already a full path.