diff options
Diffstat (limited to 'Source')
-rw-r--r-- | Source/cmGlobalGenerator.cxx | 13 | ||||
-rw-r--r-- | Source/cmLocalVisualStudio7Generator.cxx | 47 | ||||
-rw-r--r-- | Source/cmMakefile.h | 4 | ||||
-rw-r--r-- | Source/cmMakefileTargetGenerator.cxx | 4 | ||||
-rw-r--r-- | Source/cmake.cxx | 2 |
5 files changed, 47 insertions, 23 deletions
diff --git a/Source/cmGlobalGenerator.cxx b/Source/cmGlobalGenerator.cxx index 1ad42ca..812ed51 100644 --- a/Source/cmGlobalGenerator.cxx +++ b/Source/cmGlobalGenerator.cxx @@ -1309,10 +1309,13 @@ void cmGlobalGenerator::CreateDefaultGlobalTargets(cmTargets* targets) { depends.push_back("preinstall"); } + if(cmSystemTools::FileExists(configFile.c_str())) + { (*targets)[this->GetPackageTargetName()] = this->CreateGlobalTarget(this->GetPackageTargetName(), - "Run CPack packaging tool...", &cpackCommandLines, depends); - + "Run CPack packaging tool...", + &cpackCommandLines, depends); + } // CPack source const char* packageSourceTargetName = this->GetPackageSourceTargetName(); if ( packageSourceTargetName ) @@ -1324,11 +1327,15 @@ void cmGlobalGenerator::CreateDefaultGlobalTargets(cmTargets* targets) singleLine.push_back("--config"); configFile = mf->GetStartOutputDirectory();; configFile += "/CPackSourceConfig.cmake"; + if(cmSystemTools::FileExists(configFile.c_str())) + { singleLine.push_back(configFile); cpackCommandLines.push_back(singleLine); (*targets)[packageSourceTargetName] = this->CreateGlobalTarget(packageSourceTargetName, - "Run CPack packaging tool for source...", &cpackCommandLines, depends); + "Run CPack packaging tool for source...", + &cpackCommandLines, depends); + } } // Test diff --git a/Source/cmLocalVisualStudio7Generator.cxx b/Source/cmLocalVisualStudio7Generator.cxx index 1f40847..96b609a 100644 --- a/Source/cmLocalVisualStudio7Generator.cxx +++ b/Source/cmLocalVisualStudio7Generator.cxx @@ -864,18 +864,32 @@ cmLocalVisualStudio7Generator for(std::vector<cmStdString>::const_iterator d = dirs.begin(); d != dirs.end(); ++d) { + // Remove any trailing slash and skip empty paths. std::string dir = *d; - if(!dir.empty()) + if(dir[dir.size()-1] == '/') { - if(dir[dir.size()-1] != '/') + dir = dir.substr(0, dir.size()-1); + } + if(dir.empty()) { - dir += "/"; + continue; } - dir += "$(OutDir)"; - fout << comma << this->ConvertToXMLOutputPath(dir.c_str()) - << "," << this->ConvertToXMLOutputPath(d->c_str()); - comma = ","; + + // Switch to a relative path specification if it is shorter. + if(cmSystemTools::FileIsFullPath(dir.c_str())) + { + std::string rel = this->Convert(dir.c_str(), START_OUTPUT, UNCHANGED); + if(rel.size() < dir.size()) + { + dir = rel; + } } + + // First search a configuration-specific subdirectory and then the + // original directory. + fout << comma << this->ConvertToXMLOutputPath((dir+"/$(OutDir)").c_str()) + << "," << this->ConvertToXMLOutputPath(dir.c_str()); + comma = ","; } } @@ -992,7 +1006,7 @@ void cmLocalVisualStudio7Generator::WriteGroup(const cmSourceGroup *sg, cmTarget } // Loop through each source in the source group. - std::string sourceName; + std::string objectName; for(std::vector<const cmSourceFile *>::const_iterator sf = sourceFiles.begin(); sf != sourceFiles.end(); ++sf) { @@ -1000,15 +1014,16 @@ void cmLocalVisualStudio7Generator::WriteGroup(const cmSourceGroup *sg, cmTarget const cmCustomCommand *command = (*sf)->GetCustomCommand(); std::string compileFlags; std::string additionalDeps; - sourceName = (*sf)->GetSourceName(); - if(sourceName.find("/") != sourceName.npos) + objectName = (*sf)->GetSourceName(); + if(!(*sf)->GetPropertyAsBool("HEADER_FILE_ONLY" ) + && objectName.find("/") != objectName.npos) { - cmSystemTools::ReplaceString(sourceName, "/", "_"); - sourceName += ".obj"; + cmSystemTools::ReplaceString(objectName, "/", "_"); + objectName += ".obj"; } else { - sourceName = ""; + objectName = ""; } // Add per-source flags. @@ -1061,7 +1076,7 @@ void cmLocalVisualStudio7Generator::WriteGroup(const cmSourceGroup *sg, cmTarget comment.c_str(), command->GetDepends(), command->GetOutputs(), flags); } - else if(compileFlags.size() || additionalDeps.length() || sourceName.size()) + else if(compileFlags.size() || additionalDeps.length() || objectName.size()) { const char* aCompilerTool = "VCCLCompilerTool"; std::string ext = (*sf)->GetSourceExtension(); @@ -1095,10 +1110,10 @@ void cmLocalVisualStudio7Generator::WriteGroup(const cmSourceGroup *sg, cmTarget fout << "\t\t\t\t\tAdditionalDependencies=\"" << additionalDeps.c_str() << "\"\n"; } - if(sourceName.size()) + if(objectName.size()) { fout << "\t\t\t\t\tObjectFile=\"$(IntDir)/" - << sourceName.c_str() << "\"\n"; + << objectName.c_str() << "\"\n"; } fout << "\t\t\t\t\t/>\n" << "\t\t\t\t</FileConfiguration>\n"; diff --git a/Source/cmMakefile.h b/Source/cmMakefile.h index 1651b49..4c3888d 100644 --- a/Source/cmMakefile.h +++ b/Source/cmMakefile.h @@ -341,6 +341,8 @@ public: { this->cmStartDirectory = dir; cmSystemTools::ConvertToUnixSlashes(this->cmStartDirectory); + this->cmStartDirectory = + cmSystemTools::CollapseFullPath(this->cmStartDirectory.c_str()); this->AddDefinition("CMAKE_CURRENT_SOURCE_DIR", this->cmStartDirectory.c_str()); } @@ -352,6 +354,8 @@ public: { this->StartOutputDirectory = lib; cmSystemTools::ConvertToUnixSlashes(this->StartOutputDirectory); + this->StartOutputDirectory = + cmSystemTools::CollapseFullPath(this->StartOutputDirectory.c_str()); cmSystemTools::MakeDirectory(this->StartOutputDirectory.c_str()); this->AddDefinition("CMAKE_CURRENT_BINARY_DIR", this->StartOutputDirectory.c_str()); diff --git a/Source/cmMakefileTargetGenerator.cxx b/Source/cmMakefileTargetGenerator.cxx index f114b73..a73213a 100644 --- a/Source/cmMakefileTargetGenerator.cxx +++ b/Source/cmMakefileTargetGenerator.cxx @@ -245,9 +245,7 @@ void cmMakefileTargetGenerator::WriteObjectRuleFiles(cmSourceFile& source) const char* lang = this->LocalGenerator->GetSourceFileLanguage(source); if(!lang) { - // If language is not known, this is an error. - cmSystemTools::Error("Source file \"", source.GetFullPath().c_str(), - "\" has unknown type."); + // don't know anything about this file so skip it return; } diff --git a/Source/cmake.cxx b/Source/cmake.cxx index 0948959..2c08ae3 100644 --- a/Source/cmake.cxx +++ b/Source/cmake.cxx @@ -1432,7 +1432,7 @@ int cmake::Configure() this->CacheManager->RemoveCacheEntry("CMAKE_GENERATOR"); } // only save the cache if there were no fatal errors - if ( !this->ScriptMode && !cmSystemTools::GetFatalErrorOccured() ) + if ( !this->ScriptMode ) { this->CacheManager->SaveCache(this->GetHomeOutputDirectory()); } |