summaryrefslogtreecommitdiff
path: root/Source
diff options
context:
space:
mode:
authorBill Hoffman <bill.hoffman@kitware.com>2008-05-01 12:35:40 -0400
committerBill Hoffman <bill.hoffman@kitware.com>2008-05-01 12:35:40 -0400
commitc89ebb4240a711fb269f006b5005d530e920b95a (patch)
tree1ab93dec63b05a90743fac386870826191dbce40 /Source
parent1bab9241ec64170b345478d349e5230141cc06f2 (diff)
downloadcmake-c89ebb4240a711fb269f006b5005d530e920b95a.tar.gz
ENH: merge from cvs create yikes RC 10! (I hope this is the last RC...)
Diffstat (limited to 'Source')
-rw-r--r--Source/cmAuxSourceDirectoryCommand.cxx2
-rw-r--r--Source/cmComputeLinkDepends.cxx16
-rw-r--r--Source/cmComputeLinkDepends.h5
-rw-r--r--Source/cmComputeLinkInformation.cxx5
-rw-r--r--Source/cmComputeLinkInformation.h1
-rw-r--r--Source/cmExportFileGenerator.cxx6
-rw-r--r--Source/cmExportLibraryDependencies.cxx2
-rw-r--r--Source/cmFileCommand.cxx1
-rw-r--r--Source/cmFileCommand.h4
-rw-r--r--Source/cmGlobalGenerator.cxx1
-rw-r--r--Source/cmGlobalVisualStudio71Generator.cxx13
-rw-r--r--Source/cmGlobalVisualStudio7Generator.cxx19
-rw-r--r--Source/cmGlobalVisualStudioGenerator.cxx14
-rw-r--r--Source/cmGlobalVisualStudioGenerator.h3
-rw-r--r--Source/cmGlobalXCodeGenerator.cxx23
-rw-r--r--Source/cmListFileCache.cxx3
-rw-r--r--Source/cmLocalGenerator.cxx35
-rw-r--r--Source/cmLocalUnixMakefileGenerator3.cxx13
-rw-r--r--Source/cmLocalVisualStudio7Generator.cxx302
-rw-r--r--Source/cmLocalVisualStudio7Generator.h3
-rw-r--r--Source/cmMakefile.cxx46
-rw-r--r--Source/cmMakefile.h12
-rw-r--r--Source/cmSourceFile.cxx51
-rw-r--r--Source/cmSourceFile.h1
-rw-r--r--Source/cmWriteFileCommand.cxx1
-rw-r--r--Source/cmake.cxx17
-rw-r--r--Source/cmake.h6
-rw-r--r--Source/kwsys/System.c21
-rw-r--r--Source/kwsys/SystemInformation.cxx16
29 files changed, 504 insertions, 138 deletions
diff --git a/Source/cmAuxSourceDirectoryCommand.cxx b/Source/cmAuxSourceDirectoryCommand.cxx
index 1fc3467fd0..9004459209 100644
--- a/Source/cmAuxSourceDirectoryCommand.cxx
+++ b/Source/cmAuxSourceDirectoryCommand.cxx
@@ -33,7 +33,7 @@ bool cmAuxSourceDirectoryCommand::InitialPass
std::string templateDirectory = args[0];
this->Makefile->AddExtraDirectory(templateDirectory.c_str());
std::string tdir;
- if(!cmSystemTools::FileExists(templateDirectory.c_str()))
+ if(!cmSystemTools::FileIsFullPath(templateDirectory.c_str()))
{
tdir = this->Makefile->GetCurrentDirectory();
tdir += "/";
diff --git a/Source/cmComputeLinkDepends.cxx b/Source/cmComputeLinkDepends.cxx
index 72dd1982be..305c06d67d 100644
--- a/Source/cmComputeLinkDepends.cxx
+++ b/Source/cmComputeLinkDepends.cxx
@@ -24,6 +24,7 @@
#include "cmake.h"
#include <cmsys/stl/algorithm>
+#include <cmsys/RegularExpression.hxx>
#include <assert.h>
@@ -198,6 +199,12 @@ void cmComputeLinkDepends::SetOldLinkDirMode(bool b)
}
//----------------------------------------------------------------------------
+void cmComputeLinkDepends::SetSharedRegex(std::string const& regex)
+{
+ this->SharedRegexString = regex;
+}
+
+//----------------------------------------------------------------------------
std::vector<cmComputeLinkDepends::LinkEntry> const&
cmComputeLinkDepends::Compute()
{
@@ -874,6 +881,9 @@ void cmComputeLinkDepends::CheckWrongConfigItem(std::string const& item)
//----------------------------------------------------------------------------
void cmComputeLinkDepends::PreserveOriginalEntries()
{
+ // Regular expression to match shared libraries.
+ cmsys::RegularExpression shared_lib(this->SharedRegexString.c_str());
+
// Skip the part of the input sequence that already appears in the
// output.
std::vector<int>::const_iterator in = this->OriginalEntries.begin();
@@ -882,7 +892,8 @@ void cmComputeLinkDepends::PreserveOriginalEntries()
out != this->FinalLinkOrder.end())
{
cmTarget* tgt = this->EntryList[*in].Target;
- if(tgt && tgt->GetType() != cmTarget::STATIC_LIBRARY)
+ if((tgt && tgt->GetType() != cmTarget::STATIC_LIBRARY) ||
+ (!tgt && shared_lib.find(this->EntryList[*in].Item)))
{
// Skip input items known to not be static libraries.
++in;
@@ -905,7 +916,8 @@ void cmComputeLinkDepends::PreserveOriginalEntries()
while(in != this->OriginalEntries.end())
{
cmTarget* tgt = this->EntryList[*in].Target;
- if(tgt && tgt->GetType() != cmTarget::STATIC_LIBRARY)
+ if((tgt && tgt->GetType() != cmTarget::STATIC_LIBRARY) ||
+ (!tgt && shared_lib.find(this->EntryList[*in].Item)))
{
// Skip input items known to not be static libraries.
++in;
diff --git a/Source/cmComputeLinkDepends.h b/Source/cmComputeLinkDepends.h
index 3e42580df8..1b2809bd46 100644
--- a/Source/cmComputeLinkDepends.h
+++ b/Source/cmComputeLinkDepends.h
@@ -58,6 +58,10 @@ public:
std::set<cmTarget*> const& GetOldWrongConfigItems() const
{ return this->OldWrongConfigItems; }
+ /** Set a regular expression that matches strings ending in a shared
+ library extension. */
+ void SetSharedRegex(std::string const& regex);
+
private:
// Context information.
@@ -137,6 +141,7 @@ private:
// Preservation of original link line.
std::vector<int> OriginalEntries;
void PreserveOriginalEntries();
+ std::string SharedRegexString;
// Compatibility help.
bool OldLinkDirMode;
diff --git a/Source/cmComputeLinkInformation.cxx b/Source/cmComputeLinkInformation.cxx
index 5e105371a2..b133e3570b 100644
--- a/Source/cmComputeLinkInformation.cxx
+++ b/Source/cmComputeLinkInformation.cxx
@@ -511,6 +511,7 @@ bool cmComputeLinkInformation::Compute()
// Compute the ordered link line items.
cmComputeLinkDepends cld(this->Target, this->Config);
cld.SetOldLinkDirMode(this->OldLinkDirMode);
+ cld.SetSharedRegex(this->SharedRegexString);
cmComputeLinkDepends::EntryVector const& linkEntries = cld.Compute();
// Add the link line items.
@@ -864,7 +865,9 @@ void cmComputeLinkInformation::ComputeItemParserInfo()
if(!this->SharedLinkExtensions.empty())
{
std::string reg_shared = reg;
- reg_shared += this->CreateExtensionRegex(this->SharedLinkExtensions);
+ this->SharedRegexString =
+ this->CreateExtensionRegex(this->SharedLinkExtensions);
+ reg_shared += this->SharedRegexString;
#ifdef CM_COMPUTE_LINK_INFO_DEBUG
fprintf(stderr, "shared regex [%s]\n", reg_shared.c_str());
#endif
diff --git a/Source/cmComputeLinkInformation.h b/Source/cmComputeLinkInformation.h
index 31d0e33594..0ac0afc674 100644
--- a/Source/cmComputeLinkInformation.h
+++ b/Source/cmComputeLinkInformation.h
@@ -129,6 +129,7 @@ private:
cmsys::RegularExpression ExtractStaticLibraryName;
cmsys::RegularExpression ExtractSharedLibraryName;
cmsys::RegularExpression ExtractAnyLibraryName;
+ std::string SharedRegexString;
void AddLinkPrefix(const char* p);
void AddLinkExtension(const char* e, LinkType type);
std::string CreateExtensionRegex(std::vector<std::string> const& exts);
diff --git a/Source/cmExportFileGenerator.cxx b/Source/cmExportFileGenerator.cxx
index 1e0a8d92cb..e1bbe29d9c 100644
--- a/Source/cmExportFileGenerator.cxx
+++ b/Source/cmExportFileGenerator.cxx
@@ -79,6 +79,12 @@ bool cmExportFileGenerator::GenerateImportFile()
}
std::ostream& os = *foutPtr;
+ // Protect that file against use with older CMake versions.
+ os << "# Generated by CMake " << cmVersion::GetCMakeVersion() << "\n\n";
+ os << "IF(\"${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION}\" LESS 2.5)\n"
+ << " MESSAGE(FATAL_ERROR \"CMake >= 2.6.0 required\")\n"
+ << "ENDIF(\"${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION}\" LESS 2.5)\n";
+
// Isolate the file policy level.
// We use 2.6 here instead of the current version because newer
// versions of CMake should be able to export files imported by 2.6
diff --git a/Source/cmExportLibraryDependencies.cxx b/Source/cmExportLibraryDependencies.cxx
index cd36e06477..87570d95aa 100644
--- a/Source/cmExportLibraryDependencies.cxx
+++ b/Source/cmExportLibraryDependencies.cxx
@@ -19,6 +19,7 @@
#include "cmLocalGenerator.h"
#include "cmGeneratedFileStream.h"
#include "cmake.h"
+#include "cmVersion.h"
#include <cmsys/auto_ptr.hxx>
@@ -172,6 +173,7 @@ void cmExportLibraryDependenciesCommand::ConstFinalPass() const
// versions.
const char* vertest =
"\"${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION}\" GREATER 2.4";
+ fout << "# Generated by CMake " << cmVersion::GetCMakeVersion() << "\n\n";
fout << "IF(" << vertest << ")\n";
fout << " # Information for CMake 2.6 and above.\n";
for(std::map<cmStdString, cmStdString>::const_iterator
diff --git a/Source/cmFileCommand.cxx b/Source/cmFileCommand.cxx
index 3cf6c0be68..d6c6f563f9 100644
--- a/Source/cmFileCommand.cxx
+++ b/Source/cmFileCommand.cxx
@@ -213,7 +213,6 @@ bool cmFileCommand::HandleWriteCommand(std::vector<std::string> const& args,
file << message;
file.close();
cmSystemTools::SetPermissions(fileName.c_str(), mode);
- this->Makefile->AddWrittenFile(fileName.c_str());
return true;
}
diff --git a/Source/cmFileCommand.h b/Source/cmFileCommand.h
index 3f72cd2867..4173859876 100644
--- a/Source/cmFileCommand.h
+++ b/Source/cmFileCommand.h
@@ -90,10 +90,6 @@ public:
"if it does not exist.\n"
"APPEND will write a message into a file same as WRITE, except "
"it will append it to the end of the file\n"
- "NOTE: When using file WRITE and file APPEND, the produced file "
- "cannot be used as an input to CMake (configure_file, source file ...) "
- "because it will lead to an infinite loop. Use configure_file if you "
- "want to generate input files to CMake.\n"
"READ will read the content of a file and store it into the "
"variable. It will start at the given offset and read up to numBytes. "
"If the argument HEX is given, the binary data will be converted to "
diff --git a/Source/cmGlobalGenerator.cxx b/Source/cmGlobalGenerator.cxx
index cf9d0a9d30..b5893327cb 100644
--- a/Source/cmGlobalGenerator.cxx
+++ b/Source/cmGlobalGenerator.cxx
@@ -912,7 +912,6 @@ void cmGlobalGenerator::CheckLocalGenerators()
}
this->CMakeInstance->UpdateProgress
("Configuring", 0.9f+0.1f*(i+1.0f)/this->LocalGenerators.size());
- this->LocalGenerators[i]->GetMakefile()->CheckInfiniteLoops();
}
if(notFoundMap.size())
diff --git a/Source/cmGlobalVisualStudio71Generator.cxx b/Source/cmGlobalVisualStudio71Generator.cxx
index b3abec7a21..78bc0ec74c 100644
--- a/Source/cmGlobalVisualStudio71Generator.cxx
+++ b/Source/cmGlobalVisualStudio71Generator.cxx
@@ -153,10 +153,19 @@ cmGlobalVisualStudio71Generator::WriteProject(std::ostream& fout,
const char* dir,
cmTarget& t)
{
- fout << "Project(\"{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}\") = \""
+ // check to see if this is a fortran build
+ const char* ext = ".vcproj";
+ const char* project = "Project(\"{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}\") = \"";
+ if(this->TargetIsFortranOnly(t))
+ {
+ ext = ".vfproj";
+ project = "Project(\"{6989167D-11E4-40FE-8C1A-2192A86A7E90}\") = \"";
+ }
+
+ fout << project
<< dspname << "\", \""
<< this->ConvertToSolutionPath(dir)
- << "\\" << dspname << ".vcproj\", \"{"
+ << "\\" << dspname << ext << "\", \"{"
<< this->GetGUID(dspname) << "}\"\n";
fout << "\tProjectSection(ProjectDependencies) = postProject\n";
this->WriteProjectDepends(fout, dspname, dir, t);
diff --git a/Source/cmGlobalVisualStudio7Generator.cxx b/Source/cmGlobalVisualStudio7Generator.cxx
index 3432622d62..fa883392de 100644
--- a/Source/cmGlobalVisualStudio7Generator.cxx
+++ b/Source/cmGlobalVisualStudio7Generator.cxx
@@ -35,7 +35,7 @@ void cmGlobalVisualStudio7Generator
mf->AddDefinition("CMAKE_GENERATOR_CXX", "cl");
mf->AddDefinition("CMAKE_GENERATOR_RC", "rc");
mf->AddDefinition("CMAKE_GENERATOR_NO_COMPILER_ENV", "1");
- mf->AddDefinition("CMAKE_GENERATOR_Fortran", "ifort");
+ mf->AddDefinition("CMAKE_GENERATOR_FC", "ifort");
this->AddPlatformDefinitions(mf);
@@ -482,12 +482,21 @@ cmGlobalVisualStudio7Generator::ConvertToSolutionPath(const char* path)
// the libraries it uses are also done here
void cmGlobalVisualStudio7Generator::WriteProject(std::ostream& fout,
const char* dspname,
- const char* dir, cmTarget&)
-{
- fout << "Project(\"{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}\") = \""
+ const char* dir, cmTarget& target)
+{
+ // check to see if this is a fortran build
+ const char* ext = ".vcproj";
+ const char* project = "Project(\"{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}\") = \"";
+ if(this->TargetIsFortranOnly(target))
+ {
+ ext = ".vfproj";
+ project = "Project(\"{6989167D-11E4-40FE-8C1A-2192A86A7E90}\") = \"";
+ }
+
+ fout << project
<< dspname << "\", \""
<< this->ConvertToSolutionPath(dir)
- << "\\" << dspname << ".vcproj\", \"{"
+ << "\\" << dspname << ext << "\", \"{"
<< this->GetGUID(dspname) << "}\"\nEndProject\n";
}
diff --git a/Source/cmGlobalVisualStudioGenerator.cxx b/Source/cmGlobalVisualStudioGenerator.cxx
index efa9adfbc5..e28b293302 100644
--- a/Source/cmGlobalVisualStudioGenerator.cxx
+++ b/Source/cmGlobalVisualStudioGenerator.cxx
@@ -704,3 +704,17 @@ void RegisterVisualStudioMacros(const std::string& macrosFile,
}
}
}
+bool cmGlobalVisualStudioGenerator::TargetIsFortranOnly(cmTarget& target)
+{
+ // check to see if this is a fortran build
+ std::set<cmStdString> languages;
+ target.GetLanguages(languages);
+ if(languages.size() == 1)
+ {
+ if(*languages.begin() == "Fortran")
+ {
+ return true;
+ }
+ }
+ return false;
+}
diff --git a/Source/cmGlobalVisualStudioGenerator.h b/Source/cmGlobalVisualStudioGenerator.h
index 750418c20d..ce03049f16 100644
--- a/Source/cmGlobalVisualStudioGenerator.h
+++ b/Source/cmGlobalVisualStudioGenerator.h
@@ -63,6 +63,9 @@ public:
*/
virtual void CallVisualStudioMacro(MacroName m,
const char* vsSolutionFile = 0);
+
+ // return true if target is fortran only
+ bool TargetIsFortranOnly(cmTarget& t);
protected:
virtual void CreateGUID(const char*) {}
diff --git a/Source/cmGlobalXCodeGenerator.cxx b/Source/cmGlobalXCodeGenerator.cxx
index 33820aa05f..3e31a42fa9 100644
--- a/Source/cmGlobalXCodeGenerator.cxx
+++ b/Source/cmGlobalXCodeGenerator.cxx
@@ -2451,14 +2451,29 @@ void cmGlobalXCodeGenerator
this->CurrentMakefile->GetDefinition("CMAKE_OSX_ARCHITECTURES");
const char* sysroot =
this->CurrentMakefile->GetDefinition("CMAKE_OSX_SYSROOT");
+ const char* sysrootDefault =
+ this->CurrentMakefile->GetDefinition("CMAKE_OSX_SYSROOT_DEFAULT");
if(osxArch && sysroot)
{
+ bool flagsUsed = false;
// recompute this as it may have been changed since enable language
this->Architectures.clear();
cmSystemTools::ExpandListArgument(std::string(osxArch),
this->Architectures);
- if(this->Architectures.size() > 1)
+ bool addArchFlag = true;
+ if(this->Architectures.size() == 1)
{
+ const char* archOrig =
+ this->
+ CurrentMakefile->GetSafeDefinition("CMAKE_OSX_ARCHITECTURES_DEFAULT");
+ if(this->Architectures[0] == archOrig)
+ {
+ addArchFlag = false;
+ }
+ }
+ if(addArchFlag)
+ {
+ flagsUsed = true;
buildSettings->AddAttribute("SDKROOT",
this->CreateString(sysroot));
std::string archString;
@@ -2472,6 +2487,12 @@ void cmGlobalXCodeGenerator
buildSettings->AddAttribute("ARCHS",
this->CreateString(archString.c_str()));
}
+ if(!flagsUsed && sysrootDefault &&
+ strcmp(sysroot, sysrootDefault) != 0)
+ {
+ buildSettings->AddAttribute("SDKROOT",
+ this->CreateString(sysroot));
+ }
}
for( std::vector<cmXCodeObject*>::iterator i = configs.begin();
i != configs.end(); ++i)
diff --git a/Source/cmListFileCache.cxx b/Source/cmListFileCache.cxx
index c7383eafe4..a11ab98361 100644
--- a/Source/cmListFileCache.cxx
+++ b/Source/cmListFileCache.cxx
@@ -134,7 +134,8 @@ bool cmListFile::ParseFile(const char* filename,
break;
}
}
- // if no policy command is found this is an error if they use any non advanced functions or a lot of functions
+ // if no policy command is found this is an error if they use any
+ // non advanced functions or a lot of functions
if(!hasVersion)
{
bool isProblem = true;
diff --git a/Source/cmLocalGenerator.cxx b/Source/cmLocalGenerator.cxx
index d8069786c8..b934126f9c 100644
--- a/Source/cmLocalGenerator.cxx
+++ b/Source/cmLocalGenerator.cxx
@@ -1627,6 +1627,9 @@ void cmLocalGenerator::AddLanguageFlags(std::string& flags,
this->Makefile->GetDefinition("CMAKE_OSX_ARCHITECTURES");
const char* sysroot =
this->Makefile->GetDefinition("CMAKE_OSX_SYSROOT");
+ const char* sysrootDefault =
+ this->Makefile->GetDefinition("CMAKE_OSX_SYSROOT_DEFAULT");
+ bool flagsUsed = false;
if(osxArch && sysroot && lang && lang[0] =='C')
{
std::vector<std::string> archs;
@@ -1656,8 +1659,15 @@ void cmLocalGenerator::AddLanguageFlags(std::string& flags,
}
flags += " -isysroot ";
flags += sysroot;
+ flagsUsed = true;
}
}
+ if(!flagsUsed && sysroot && sysrootDefault &&
+ strcmp(sysroot, sysrootDefault) != 0)
+ {
+ flags += " -isysroot ";
+ flags += sysroot;
+ }
}
this->AddConfigVariableFlags(flags, flagsVar.c_str(), config);
}
@@ -2535,9 +2545,32 @@ std::string cmLocalGenerator::EscapeForShellOldStyle(const char* str)
}
//----------------------------------------------------------------------------
+static bool cmLocalGeneratorIsShellOperator(const char* str)
+{
+ if(strcmp(str, "<") == 0 ||
+ strcmp(str, ">") == 0 ||
+ strcmp(str, "<<") == 0 ||
+ strcmp(str, ">>") == 0 ||
+ strcmp(str, "|") == 0 ||
+ strcmp(str, "&>") == 0 ||
+ strcmp(str, "2>&1") == 0 ||
+ strcmp(str, "1>&2") == 0)
+ {
+ return true;
+ }
+ return false;
+}
+
+//----------------------------------------------------------------------------
std::string cmLocalGenerator::EscapeForShell(const char* str, bool makeVars,
bool forEcho)
{
+ // Do not escape shell operators.
+ if(cmLocalGeneratorIsShellOperator(str))
+ {
+ return str;
+ }
+
// Compute the flags for the target shell environment.
int flags = 0;
if(this->WindowsVSIDE)
@@ -2583,7 +2616,7 @@ std::string cmLocalGenerator::EscapeForShell(const char* str, bool makeVars,
else
{
cmsysSystem_Shell_GetArgumentForUnix(str, &arg[0], flags);
- }
+ }
return std::string(&arg[0]);
}
diff --git a/Source/cmLocalUnixMakefileGenerator3.cxx b/Source/cmLocalUnixMakefileGenerator3.cxx
index 14201a45d2..c4f7d0ebfa 100644
--- a/Source/cmLocalUnixMakefileGenerator3.cxx
+++ b/Source/cmLocalUnixMakefileGenerator3.cxx
@@ -1019,6 +1019,19 @@ cmLocalUnixMakefileGenerator3
// without the current directory being in the search path.
cmd = "./" + cmd;
}
+ if(this->WatcomWMake &&
+ cmSystemTools::FileIsFullPath(cmd.c_str()) &&
+ cmd.find(" ") != cmd.npos)
+ {
+ // On Watcom WMake use the windows short path for the command
+ // name. This is needed to avoid funny quoting problems on
+ // lines with shell redirection operators.
+ std::string scmd;
+ if(cmSystemTools::GetShortPath(cmd.c_str(), scmd))
+ {
+ cmd = scmd;
+ }
+ }
cmd = this->Convert(cmd.c_str(),NONE,SHELL);
for(unsigned int j=1; j < commandLine.size(); ++j)
{
diff --git a/Source/cmLocalVisualStudio7Generator.cxx b/Source/cmLocalVisualStudio7Generator.cxx
index 8c5b87f874..d25962ba05 100644
--- a/Source/cmLocalVisualStudio7Generator.cxx
+++ b/Source/cmLocalVisualStudio7Generator.cxx
@@ -68,6 +68,7 @@ void cmLocalVisualStudio7Generator::AddHelperCommands()
lang.insert("RC");
lang.insert("IDL");
lang.insert("DEF");
+ lang.insert("Fortran");
this->CreateCustomTargetsAndCommands(lang);
this->FixGlobalTargets();
}
@@ -200,6 +201,9 @@ void cmLocalVisualStudio7Generator::WriteStampFiles()
void cmLocalVisualStudio7Generator
::CreateSingleVCProj(const char *lname, cmTarget &target)
{
+ this->FortranProject =
+ static_cast<cmGlobalVisualStudioGenerator*>(this->GlobalGenerator)
+ ->TargetIsFortranOnly(target);
// add to the list of projects
std::string pname = lname;
target.SetProperty("GENERATOR_FILE_NAME",lname);
@@ -208,7 +212,14 @@ void cmLocalVisualStudio7Generator
fname = this->Makefile->GetStartOutputDirectory();
fname += "/";
fname += lname;
- fname += ".vcproj";
+ if(this->FortranProject)
+ {
+ fname += ".vfproj";
+ }
+ else
+ {
+ fname += ".vcproj";
+ }
// Generate the project file and replace it atomically with
// copy-if-different. We use a separate timestamp so that the IDE
@@ -286,7 +297,61 @@ void cmLocalVisualStudio7Generator::WriteConfigurations(std::ostream& fout,
}
fout << "\t</Configurations>\n";
}
-
+cmVS7FlagTable cmLocalVisualStudio7GeneratorFortranFlagTable[] =
+{
+ {"Preprocess", "fpp", "Run Preprocessor on files", "preprocessYes", 0},
+ {"SuppressStartupBanner", "nologo", "SuppressStartupBanner", "true", 0},
+ {"DebugInformationFormat", "Zi", "full debug", "debugEnabled", 0},
+ {"DebugInformationFormat", "debug:full", "full debug", "debugEnabled", 0},
+ {"DebugInformationFormat", "Z7", "c7 compat", "debugOldStyleInfo", 0},
+ {"DebugInformationFormat", "Zd", "line numbers", "debugLineInfoOnly", 0},
+ {"Optimization", "Od", "disable optimization", "optimizeDisabled", 0},
+ {"Optimization", "O1", "min space", "optimizeMinSpace", 0},
+ {"Optimization", "O3", "full optimize", "optimizeFull", 0},
+ {"GlobalOptimizations", "Og", "global optimize", "true", 0},
+ {"InlineFunctionExpansion", "Ob0", "", "expandDisable", 0},
+ {"InlineFunctionExpansion", "Ob1", "", "expandOnlyInline", 0},
+ {"FavorSizeOrSpeed", "Os", "", "favorSize", 0},
+ {"OmitFramePointers", "Oy-", "", "false", 0},
+ {"OptimizeForProcessor", "GB", "", "procOptimizeBlended", 0},
+ {"OptimizeForProcessor", "G5", "", "procOptimizePentium", 0},
+ {"OptimizeForProcessor", "G6", "", "procOptimizePentiumProThruIII", 0},
+ {"UseProcessorExtensions", "QzxK", "", "codeForStreamingSIMD", 0},
+ {"OptimizeForProcessor", "QaxN", "", "codeForPentium4", 0},
+ {"OptimizeForProcessor", "QaxB", "", "codeForPentiumM", 0},
+ {"OptimizeForProcessor", "QaxP", "", "codeForCodeNamedPrescott", 0},
+ {"OptimizeForProcessor", "QaxT", "", "codeForCore2Duo", 0},
+ {"OptimizeForProcessor", "QxK", "", "codeExclusivelyStreamingSIMD", 0},
+ {"OptimizeForProcessor", "QxN", "", "codeExclusivelyPentium4", 0},
+ {"OptimizeForProcessor", "QxB", "", "codeExclusivelyPentiumM", 0},
+ {"OptimizeForProcessor", "QxP", "", "codeExclusivelyCodeNamedPrescott", 0},
+ {"OptimizeForProcessor", "QxT", "", "codeExclusivelyCore2Duo", 0},
+ {"OptimizeForProcessor", "QxO", "", "codeExclusivelyCore2StreamingSIMD", 0},
+ {"OptimizeForProcessor", "QxS", "", "codeExclusivelyCore2StreamingSIMD4", 0},
+
+ {"ModulePath", "module:", "", "",
+ cmVS7FlagTable::UserValueRequired},
+ {"LoopUnrolling", "Qunroll:", "", "",
+ cmVS7FlagTable::UserValueRequired},
+ {"AutoParallelThreshold", "Qpar-threshold:", "", "",
+ cmVS7FlagTable::UserValueRequired},
+ {"HeapArrays", "heap-arrays:", "", "",
+ cmVS7FlagTable::UserValueRequired},
+ {"ObjectText", "bintext:", "", "",
+ cmVS7FlagTable::UserValueRequired},
+ {"Parallelization", "Qparallel", "", "true", 0},
+ {"PrefetchInsertion", "Qprefetch-", "", "false", 0},
+ {"BufferedIO", "assume:buffered_io", "", "true", 0},
+ {"CallingConvention", "iface:stdcall", "", "callConventionStdCall", 0},
+ {"CallingConvention", "iface:cref", "", "callConventionCRef", 0},
+ {"CallingConvention", "iface:stdref", "", "callConventionStdRef", 0},
+ {"CallingConvention", "iface:stdcall", "", "callConventionStdCall", 0},
+ {"CallingConvention", "iface:cvf", "", "callConventionCVF", 0},
+ {"EnableRecursion", "recursive", "", "true", 0},
+ {"ReentrantCode", "reentrancy", "", "true", 0},
+ // done up to Language
+ {0,0,0,0,0}
+};
// fill the table here currently the comment field is not used for
// anything other than documentation NOTE: Make sure the longer
// commandFlag comes FIRST!
@@ -379,6 +444,8 @@ cmVS7FlagTable cmLocalVisualStudio7GeneratorFlagTable[] =
{0,0,0,0,0}
};
+
+
cmVS7FlagTable cmLocalVisualStudio7GeneratorLinkFlagTable[] =
{
// option flags (some flags map to the same option)
@@ -404,7 +471,8 @@ public:
enum Tool
{
Compiler,
- Linker
+ Linker,
+ FortranCompiler
};
cmLocalVisualStudio7GeneratorOptions(cmLocalVisualStudio7Generator* lg,
int version,
@@ -485,13 +553,16 @@ void cmLocalVisualStudio7Generator::WriteConfiguration(std::ostream& fout,
// 1 == executable
// 10 == utility
const char* configType = "10";
+ const char* projectType = 0;
switch(target.GetType())
{
case cmTarget::STATIC_LIBRARY:
+ projectType = "typeStaticLibrary";
configType = "4";
break;
case cmTarget::SHARED_LIBRARY:
case cmTarget::MODULE_LIBRARY:
+ projectType = "typeDynamicLibrary";
configType = "2";
break;
case cmTarget::EXECUTABLE:
@@ -503,7 +574,10 @@ void cmLocalVisualStudio7Generator::WriteConfiguration(std::ostream& fout,
default:
break;
}
-
+ if(this->FortranProject && projectType)
+ {
+ configType = projectType;
+ }
std::string flags;
if(strcmp(configType, "10") != 0)
{
@@ -516,7 +590,8 @@ void cmLocalVisualStudio7Generator::WriteConfiguration(std::ostream& fout,
target.GetName());
return;
}
- if(strcmp(linkLanguage, "C") == 0 || strcmp(linkLanguage, "CXX") == 0)
+ if(strcmp(linkLanguage, "C") == 0 || strcmp(linkLanguage, "CXX") == 0
+ || strcmp(linkLanguage, "Fortran") == 0)
{
std::string baseFlagVar = "CMAKE_";
baseFlagVar += linkLanguage;
@@ -551,9 +626,12 @@ void cmLocalVisualStudio7Generator::WriteConfiguration(std::ostream& fout,
// Get preprocessor definitions for this directory.
std::string defineFlags = this->Makefile->GetDefineFlags();
-
- // Construct a set of build options for this target.
- Options targetOptions(this, this->Version, Options::Compiler, this->ExtraFlagTable);
+ Options::Tool t = Options::Compiler;
+ if(this->FortranProject)
+ {
+ t = Options::FortranCompiler;
+ }
+ Options targetOptions(this, this->Version, t, this->ExtraFlagTable);
targetOptions.FixExceptionHandlingDefault();
targetOptions.Parse(flags.c_str());
targetOptions.Parse(defineFlags.c_str());
@@ -599,9 +677,31 @@ void cmLocalVisualStudio7Generator::WriteConfiguration(std::ostream& fout,
{
fout << "\t\t\tCharacterSet=\"2\">\n";
}
-
+ const char* tool = "VCCLCompilerTool";
+ if(this->FortranProject)
+ {
+ tool = "VFFortranCompilerTool";
+ }
fout << "\t\t\t<Tool\n"
- << "\t\t\t\tName=\"VCCLCompilerTool\"\n";
+ << "\t\t\t\tName=\"" << tool << "\"\n";
+ if(this->FortranProject)
+ {
+ const char* target_mod_dir =
+ target.GetProperty("Fortran_MODULE_DIRECTORY");
+ std::string modDir;
+ if(target_mod_dir)
+ {
+ modDir = this->Convert(target_mod_dir,
+ cmLocalGenerator::START_OUTPUT,
+ cmLocalGenerator::UNCHANGED);
+ }
+ else
+ {
+ modDir = ".";
+ }
+ fout << "\t\t\t\tModulePath=\""
+ << this->ConvertToXMLOutputPath(modDir.c_str()) << "\\$(ConfigurationName)\"\n";
+ }
targetOptions.OutputAdditionalOptions(fout, "\t\t\t\t", "\n");
fout << "\t\t\t\tAdditionalIncludeDirectories=\"";
std::vector<std::string> includes;
@@ -609,8 +709,18 @@ void cmLocalVisualStudio7Generator::WriteConfiguration(std::ostream& fout,
std::vector<std::string>::iterator i = includes.begin();
for(;i != includes.end(); ++i)
{
+ // output the include path
std::string ipath = this->ConvertToXMLOutputPath(i->c_str());
fout << ipath << ";";
+ // if this is fortran then output the include with
+ // a ConfigurationName on the end of it.
+ if(this->FortranProject)
+ {
+ ipath = i->c_str();
+ ipath += "/$(ConfigurationName)";
+ ipath = this->ConvertToXMLOutputPath(ipath.c_str());
+ fout << ipath << ";";
+ }
}
fout << "\"\n";
targetOptions.OutputFlagMap(fout, "\t\t\t\t");
@@ -629,8 +739,18 @@ void cmLocalVisualStudio7Generator::WriteConfiguration(std::ostream& fout,
<< target.GetPDBName(configName) << "\"\n";
}
fout << "/>\n"; // end of <Tool Name=VCCLCompilerTool
- fout << "\t\t\t<Tool\n\t\t\t\tName=\"VCCustomBuildTool\"/>\n";
- fout << "\t\t\t<Tool\n\t\t\t\tName=\"VCResourceCompilerTool\"\n"
+ tool = "VCCustomBuildTool";
+ if(this->FortranProject)
+ {
+ tool = "VFCustomBuildTool";
+ }
+ fout << "\t\t\t<Tool\n\t\t\t\tName=\"" << tool << "\"/>\n";
+ tool = "VCResourceCompilerTool";
+ if(this->FortranProject)
+ {
+ tool = "VFResourceCompilerTool";
+ }
+ fout << "\t\t\t<Tool\n\t\t\t\tName=\"" << tool << "\"\n"
<< "\t\t\t\tAdditionalIncludeDirectories=\"";
for(i = includes.begin();i != includes.end(); ++i)
{
@@ -641,8 +761,12 @@ void cmLocalVisualStudio7Generator::WriteConfiguration(std::ostream& fout,
fout << "\"";
targetOptions.OutputPreprocessorDefinitions(fout, "\n\t\t\t\t", "");
fout << "/>\n";
-
- fout << "\t\t\t<Tool\n\t\t\t\tName=\"VCMIDLTool\"\n";
+ tool = "VCMIDLTool";
+ if(this->FortranProject)
+ {
+ tool = "VFMIDLTool";
+ }
+ fout << "\t\t\t<Tool\n\t\t\t\tName=\"" << tool << "\"\n";
targetOptions.OutputPreprocessorDefinitions(fout, "\t\t\t\t", "\n");
fout << "\t\t\t\tMkTypLibCompatible=\"FALSE\"\n";
if( this->PlatformName == "x64" )
@@ -675,8 +799,13 @@ void cmLocalVisualStudio7Generator::WriteConfiguration(std::ostream& fout,
// Add a flag telling the manifest tool to use a workaround
// for FAT32 file systems, which can cause an empty manifest
// to be embedded into the resulting executable. See CMake
- // bug #2617.
- fout << "\t\t\t<Tool\n\t\t\t\tName=\"VCManifestTool\"\n"
+ // bug #2617.
+ const char* tool = "VCManifestTool";
+ if(this->FortranProject)
+ {
+ tool = "VFManifestTool";
+ }
+ fout << "\t\t\t<Tool\n\t\t\t\tName=\"" << tool << "\"\n"
<< "\t\t\t\tUseFAT32Workaround=\"true\"\n"
<< "\t\t\t/>\n";
}
@@ -757,8 +886,13 @@ void cmLocalVisualStudio7Generator::OutputBuildTool(std::ostream& fout,
std::string libpath = target.GetDirectory(configName);
libpath += "/";
libpath += targetNameFull;
+ const char* tool = "VCLibrarianTool";
+ if(this->FortranProject)
+ {
+ tool = "VFLibrarianTool";
+ }
fout << "\t\t\t<Tool\n"
- << "\t\t\t\tName=\"VCLibrarianTool\"\n";
+ << "\t\t\t\tName=\"" << tool << "\"\n";
if(const char* libflags = target.GetProperty("STATIC_LIBRARY_FLAGS"))
{
fout << "\t\t\t\tAdditionalOptions=\"" << libflags << "\"\n";
@@ -792,9 +926,13 @@ void cmLocalVisualStudio7Generator::OutputBuildTool(std::ostream& fout,
std::string standardLibsVar = "CMAKE_";
standardLibsVar += linkLanguage;
standardLibsVar += "_STANDARD_LIBRARIES";
-
+ const char* tool = "VCLinkerTool";
+ if(this->FortranProject)
+ {
+ tool = "VFLinkerTool";
+ }
fout << "\t\t\t<Tool\n"
- << "\t\t\t\tName=\"VCLinkerTool\"\n";
+ << "\t\t\t\tName=\"" << tool << "\"\n";
linkOptions.OutputAdditionalOptions(fout, "\t\t\t\t", "\n");
// Use the NOINHERIT macro to avoid getting VS project default
// libraries which may be set by the user to something bad.
@@ -861,9 +999,13 @@ void cmLocalVisualStudio7Generator::OutputBuildTool(std::ostream& fout,
std::string standardLibsVar = "CMAKE_";
standardLibsVar += linkLanguage;
standardLibsVar += "_STANDARD_LIBRARIES";
-
+ const char* tool = "VCLinkerTool";
+ if(this->FortranProject)
+ {
+ tool = "VFLinkerTool";
+ }
fout << "\t\t\t<Tool\n"
- << "\t\t\t\tName=\"VCLinkerTool\"\n";
+ << "\t\t\t\tName=\"" << tool << "\"\n";
linkOptions.OutputAdditionalOptions(fout, "\t\t\t\t", "\n");
// Use the NOINHERIT macro to avoid getting VS project default
// libraries which may be set by the user to something bad.
@@ -1263,14 +1405,26 @@ void cmLocalVisualStudio7Generator
if(ext == "idl")
{
aCompilerTool = "VCMIDLTool";
+ if(this->FortranProject)
+ {
+ aCompilerTool = "VFMIDLTool";
+ }
}
if(ext == "rc")
{
- aCompilerTool = "VCResourceCompilerTool";
+ aCompilerTool = "VCResourceCompilerTool";
+ if(this->FortranProject)
+ {
+ aCompilerTool = "VFResourceCompilerTool";
+ }
}
if(ext == "def")
{
aCompilerTool = "VCCustomBuildTool";
+ if(this->FortranProject)
+ {
+ aCompilerTool = "VFCustomBuildTool";
+ }
}
for(std::map<cmStdString, cmLVS7GFileConfig>::const_iterator
fci = fcinfo.FileConfigMap.begin();
@@ -1346,7 +1500,16 @@ WriteCustomRule(std::ostream& fout,
std::vector<std::string> *configs =
static_cast<cmGlobalVisualStudio7Generator *>
(this->GlobalGenerator)->GetConfigurations();
-
+ const char* compileTool = "VCCLCompilerTool";
+ if(this->FortranProject)
+ {
+ compileTool = "VFCLCompilerTool";
+ }
+ const char* customTool = "VCCustomBuildTool";
+ if(this->FortranProject)
+ {
+ customTool = "VFCustomBuildTool";
+ }
for(i = configs->begin(); i != configs->end(); ++i)
{
cmLVS7GFileConfig const& fc = fcinfo.FileConfigMap[*i];
@@ -1355,7 +1518,7 @@ WriteCustomRule(std::ostream& fout,
if(!fc.CompileFlags.empty())
{
fout << "\t\t\t\t\t<Tool\n"
- << "\t\t\t\t\tName=\"VCCLCompilerTool\"\n"
+ << "\t\t\t\t\tName=\"" << compileTool << "\"\n"
<< "\t\t\t\t\tAdditionalOptions=\""
<< this->EscapeForXML(fc.CompileFlags.c_str()) << "\"/>\n";
}
@@ -1367,7 +1530,7 @@ WriteCustomRule(std::ostream& fout,
command.GetEscapeOldStyle(),
command.GetEscapeAllowMakeVars());
fout << "\t\t\t\t\t<Tool\n"
- << "\t\t\t\t\tName=\"VCCustomBuildTool\"\n"
+ << "\t\t\t\t\tName=\"" << customTool << "\"\n"
<< "\t\t\t\t\tDescription=\""
<< this->EscapeForXML(comment.c_str()) << "\"\n"
<< "\t\t\t\t\tCommandLine=\""
@@ -1450,9 +1613,13 @@ void cmLocalVisualStudio7Generator
{
return;
}
-
+ const char* tool = "VCPreBuildEventTool";
+ if(this->FortranProject)
+ {
+ tool = "VFPreBuildEventTool";
+ }
// add the pre build rules
- fout << "\t\t\t<Tool\n\t\t\t\tName=\"VCPreBuildEventTool\"";
+ fout << "\t\t\t<Tool\n\t\t\t\tName=\"" << tool << "\"";
bool init = false;
for (std::vector<cmCustomCommand>::const_iterator cr =
target.GetPreBuildCommands().begin();
@@ -1488,7 +1655,12 @@ void cmLocalVisualStudio7Generator
fout << "/>\n";
// add the pre Link rules
- fout << "\t\t\t<Tool\n\t\t\t\tName=\"VCPreLinkEventTool\"";
+ tool = "VCPreLinkEventTool";
+ if(this->FortranProject)
+ {
+ tool = "VFPreLinkEventTool";
+ }
+ fout << "\t\t\t<Tool\n\t\t\t\tName=\"" << tool << "\"";
init = false;
for (std::vector<cmCustomCommand>::const_iterator cr =
target.GetPreLinkCommands().begin();
@@ -1524,7 +1696,12 @@ void cmLocalVisualStudio7Generator
fout << "/>\n";
// add the PostBuild rules
- fout << "\t\t\t<Tool\n\t\t\t\tName=\"VCPostBuildEventTool\"";
+ tool = "VCPostBuildEventTool";
+ if(this->FortranProject)
+ {
+ tool = "VFPostBuildEventTool";
+ }
+ fout << "\t\t\t<Tool\n\t\t\t\tName=\"" << tool << "\"";
init = false;
for (std::vector<cmCustomCommand>::const_iterator cr =
target.GetPostBuildCommands().begin();
@@ -1561,11 +1738,76 @@ void cmLocalVisualStudio7Generator
}
void
+cmLocalVisualStudio7Generator
+::WriteProjectStartFortran(std::ostream& fout,
+ const char *libName,
+ cmTarget & target)
+{
+
+ cmGlobalVisualStudio7Generator* gg =
+ static_cast<cmGlobalVisualStudio7Generator *>(this->GlobalGenerator);
+ fout << "<?xml version=\"1.0\" encoding = \"Windows-1252\"?>\n"
+ << "<VisualStudioProject\n"
+ << "\tProjectCreator=\"Intel Fortran\"\n"
+ << "\tVersion=\"9.10\"\n";
+ const char* keyword = target.GetProperty("VS_KEYWORD");
+ if(!keyword)
+ {
+ keyword = "Console Application";
+ }
+ const char* projectType = 0;
+ switch(target.GetType())
+ {
+ case cmTarget::STATIC_LIBRARY:
+ projectType = "typeStaticLibrary";
+ if(keyword)
+ {
+ keyword = "Static Library";
+ }
+ break;
+ case cmTarget::SHARED_LIBRARY:
+ case cmTarget::MODULE_LIBRARY:
+ projectType = "typeDynamicLibrary";
+ if(!keyword)
+ {
+ keyword = "Dll";
+ }
+ break;
+ case cmTarget::EXECUTABLE:
+ if(!keyword)
+ {
+ keyword = "Console Application";
+ }
+ projectType = 0;
+ break;
+ case cmTarget::UTILITY:
+ case cmTarget::GLOBAL_TARGET:
+ default:
+ break;
+ }
+ if(projectType)
+ {
+ fout << "\tProjectType=\"" << projectType << "\">\n";
+ }
+ fout<< "\tKeyword=\"" << keyword << "\">\n"
+ << "\tProjectGUID=\"{" << gg->GetGUID(libName) << "}\">\n"
+ << "\t<Platforms>\n"
+ << "\t\t<Platform\n\t\t\tName=\"" << this->PlatformName << "\"/>\n"
+ << "\t</Platforms>\n";
+}
+
+
+void
cmLocalVisualStudio7Generator::WriteProjectStart(std::ostream& fout,
const char *libName,
cmTarget & target,
std::vector<cmSourceGroup> &)
{
+ if(this->FortranProject)
+ {
+ this->WriteProjectStartFortran(fout, libName, target);
+ return;
+ }
fout << "<?xml version=\"1.0\" encoding = \"Windows-1252\"?>\n"
<< "<VisualStudioProject\n"
<< "\tProjectType=\"Visual C++\"\n";
@@ -1777,6 +2019,8 @@ cmLocalVisualStudio7GeneratorOptions
this->FlagTable = cmLocalVisualStudio7GeneratorFlagTable; break;
case Linker:
this->FlagTable = cmLocalVisualStudio7GeneratorLinkFlagTable; break;
+ case FortranCompiler:
+ this->FlagTable = cmLocalVisualStudio7GeneratorFortranFlagTable;
default: break;
}
}
diff --git a/Source/cmLocalVisualStudio7Generator.h b/Source/cmLocalVisualStudio7Generator.h
index b59936245e..edb90aa878 100644
--- a/Source/cmLocalVisualStudio7Generator.h
+++ b/Source/cmLocalVisualStudio7Generator.h
@@ -102,6 +102,8 @@ private:
void OutputModuleDefinitionFile(std::ostream& fout, cmTarget &target);
void WriteProjectStart(std::ostream& fout, const char *libName,
cmTarget &tgt, std::vector<cmSourceGroup> &sgs);
+ void WriteProjectStartFortran(std::ostream& fout, const char *libName,
+ cmTarget &tgt);
void WriteVCProjBeginGroup(std::ostream& fout,
const char* group,
const char* filter);
@@ -124,6 +126,7 @@ private:
cmVS7FlagTable const* ExtraFlagTable;
std::string ModuleDefinitionFile;
int Version;
+ bool FortranProject;
std::string PlatformName; // Win32 or x64
cmLocalVisualStudio7GeneratorInternals* Internal;
};
diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx
index 135dc287d9..bc60955bb3 100644
--- a/Source/cmMakefile.cxx
+++ b/Source/cmMakefile.cxx
@@ -83,7 +83,7 @@ cmMakefile::cmMakefile()
this->AddSourceGroup("", "^.*$");
this->AddSourceGroup
("Source Files",
- "\\.(C|M|c|c\\+\\+|cc|cpp|cxx|m|mm|rc|def|r|odl|idl|hpj|bat)$");
+ "\\.(C|M|c|c\\+\\+|cc|cpp|cxx|f|f90|for|fpp|ftn|m|mm|rc|def|r|odl|idl|hpj|bat)$");
this->AddSourceGroup("Header Files",
"\\.(h|hh|h\\+\\+|hm|hpp|hxx|in|txx|inl)$");
this->AddSourceGroup("CMake Rules", "\\.rule$");
@@ -299,12 +299,21 @@ void cmMakefile::IssueMessage(cmake::MessageType t,
}
this->GetBacktrace(backtrace);
}
- else if(!this->ListFileStack.empty())
+ else
{
- // We are processing the project but are not currently executing a
- // command. Add whatever context information we have.
cmListFileContext lfc;
- lfc.FilePath = this->ListFileStack.back();
+ if(this->ListFileStack.empty())
+ {
+ // We are not processing the project. Add the directory-level context.
+ lfc.FilePath = this->GetCurrentDirectory();
+ lfc.FilePath += "/CMakeLists.txt";
+ }
+ else
+ {
+ // We are processing the project but are not currently executing a
+ // command. Add whatever context information we have.
+ lfc.FilePath = this->ListFileStack.back();
+ }
lfc.Line = 0;
if(!this->GetCMakeInstance()->GetIsInTryCompile())
{
@@ -2787,33 +2796,6 @@ int cmMakefile::ConfigureFile(const char* infile, const char* outfile,
return res;
}
-void cmMakefile::AddWrittenFile(const char* file)
-{ this->GetCMakeInstance()->AddWrittenFile(file); }
-
-bool cmMakefile::HasWrittenFile(const char* file)
-{ return this->GetCMakeInstance()->HasWrittenFile(file); }
-
-bool cmMakefile::CheckInfiniteLoops()
-{
- std::vector<std::string>::iterator it;
- for ( it = this->ListFiles.begin();
- it != this->ListFiles.end();
- ++ it )
- {
- if ( this->HasWrittenFile(it->c_str()) )
- {
- cmOStringStream str;
- str << "File " << it->c_str() <<
- " is written by WRITE_FILE (or FILE WRITE) command and should "
- "not be used as input to CMake. Please use CONFIGURE_FILE to "
- "be safe. Refer to the note next to FILE WRITE command.";
- cmSystemTools::Error(str.str().c_str());
- return false;
- }
- }
- return true;
-}
-
void cmMakefile::SetProperty(const char* prop, const char* value)
{
if (!prop)
diff --git a/Source/cmMakefile.h b/Source/cmMakefile.h
index d8873f4c6b..4f54f7134e 100644
--- a/Source/cmMakefile.h
+++ b/Source/cmMakefile.h
@@ -94,18 +94,6 @@ public:
void RemoveFunctionBlocker(const cmListFileFunction& lff);
/**
- * Add file to the written file list. These file should not be in the list
- * of dependencies because they cause infinite loops.
- */
- void AddWrittenFile(const char* file);
- bool HasWrittenFile(const char* file);
-
- /**
- * Check if there are any infinite loops
- */
- bool CheckInfiniteLoops();
-
- /**
* Try running cmake and building a file. This is used for dynalically
* loaded commands, not as part of the usual build process.
*/
diff --git a/Source/cmSourceFile.cxx b/Source/cmSourceFile.cxx
index 1cc2b2c1ce..0a848f6783 100644
--- a/Source/cmSourceFile.cxx
+++ b/Source/cmSourceFile.cxx
@@ -46,10 +46,28 @@ std::string const& cmSourceFile::GetExtension() const
//----------------------------------------------------------------------------
const char* cmSourceFile::GetLanguage()
{
- // Compute the final location of the file if necessary.
- if(this->FullPath.empty())
+ // If the language was set explicitly by the user then use it.
+ if(const char* lang = this->GetProperty("LANGUAGE"))
{
- this->GetFullPath();
+ return lang;
+ }
+
+ // Perform computation needed to get the language if necessary.
+ if(this->FullPath.empty() && this->Language.empty())
+ {
+ if(this->Location.ExtensionIsAmbiguous())
+ {
+ // Finalize the file location to get the extension and set the
+ // language.
+ this->GetFullPath();
+ }
+ else
+ {
+ // Use the known extension to get the language if possible.
+ std::string ext =
+ cmSystemTools::GetFilenameLastExtension(this->Location.GetName());
+ this->CheckLanguage(ext);
+ }
}
// Now try to determine the language.
@@ -167,9 +185,19 @@ bool cmSourceFile::FindFullPath()
}
}
+ // If the user provided a full path, trust it. If the file is not
+ // there the native tool will complain at build time.
+ if(!this->Location.DirectoryIsAmbiguous())
+ {
+ this->FullPath = this->Location.GetDirectory();
+ this->FullPath += "/";
+ this->FullPath += this->Location.GetName();
+ return true;
+ }
+
cmOStringStream e;
e << "Cannot find source file \"" << this->Location.GetName() << "\"";
- e << "\n\nTried extensions";
+ e << ". Tried extensions";
for(std::vector<std::string>::const_iterator ext = srcExts.begin();
ext != srcExts.end(); ++ext)
{
@@ -180,7 +208,7 @@ bool cmSourceFile::FindFullPath()
{
e << " ." << *ext;
}
- cmSystemTools::Error(e.str().c_str());
+ this->Location.GetMakefile()->IssueMessage(cmake::FATAL_ERROR, e.str());
this->FindFullPathFailed = true;
return false;
}
@@ -242,8 +270,19 @@ void cmSourceFile::CheckExtension()
}
// Try to identify the source file language from the extension.
+ if(this->Language.empty())
+ {
+ this->CheckLanguage(this->Extension);
+ }
+}
+
+//----------------------------------------------------------------------------
+void cmSourceFile::CheckLanguage(std::string const& ext)
+{
+ // Try to identify the source file language from the extension.
+ cmMakefile* mf = this->Location.GetMakefile();
cmGlobalGenerator* gg = mf->GetLocalGenerator()->GetGlobalGenerator();
- if(const char* l = gg->GetLanguageFromExtension(this->Extension.c_str()))
+ if(const char* l = gg->GetLanguageFromExtension(ext.c_str()))
{
this->Language = l;
}
diff --git a/Source/cmSourceFile.h b/Source/cmSourceFile.h
index 1eca56ef36..59cb7db08e 100644
--- a/Source/cmSourceFile.h
+++ b/Source/cmSourceFile.h
@@ -116,6 +116,7 @@ private:
bool FindFullPath();
bool TryFullPath(const char* tryPath, const char* ext);
void CheckExtension();
+ void CheckLanguage(std::string const& ext);
std::vector<std::string> Depends;
};
diff --git a/Source/cmWriteFileCommand.cxx b/Source/cmWriteFileCommand.cxx
index 8afd7586a0..2fba5081c6 100644
--- a/Source/cmWriteFileCommand.cxx
+++ b/Source/cmWriteFileCommand.cxx
@@ -97,7 +97,6 @@ bool cmWriteFileCommand
file << message << std::endl;
file.close();
cmSystemTools::SetPermissions(fileName.c_str(), mode);
- this->Makefile->AddWrittenFile(fileName.c_str());
return true;
}
diff --git a/Source/cmake.cxx b/Source/cmake.cxx
index 5e5859b3b0..08fbe9da6b 100644
--- a/Source/cmake.cxx
+++ b/Source/cmake.cxx
@@ -2081,8 +2081,6 @@ int cmake::ActualConfigure()
this->GlobalGenerator->ClearEnabledLanguages();
}
- this->CleanupWrittenFiles();
-
// Truncate log files
if (!this->InTryCompile)
{
@@ -2533,21 +2531,6 @@ void cmake::GetGeneratorDocumentation(std::vector<cmDocumentationEntry>& v)
}
}
-void cmake::AddWrittenFile(const char* file)
-{
- this->WrittenFiles.insert(file);
-}
-
-bool cmake::HasWrittenFile(const char* file)
-{
- return this->WrittenFiles.find(file) != this->WrittenFiles.end();
-}
-
-void cmake::CleanupWrittenFiles()
-{
- this->WrittenFiles.clear();
-}
-
void cmake::UpdateConversionPathTable()
{
// Update the path conversion table with any specified file:
diff --git a/Source/cmake.h b/Source/cmake.h
index c1e9a728b0..8dd5ad12bd 100644
--- a/Source/cmake.h
+++ b/Source/cmake.h
@@ -294,11 +294,6 @@ class cmake
bool GetDebugTryCompile(){return this->DebugTryCompile;}
void DebugTryCompileOn(){this->DebugTryCompile = true;}
- ///! Get the list of files written by CMake using FILE(WRITE / WRITE_FILE
- void AddWrittenFile(const char* file);
- bool HasWrittenFile(const char* file);
- void CleanupWrittenFiles();
-
/**
* Generate CMAKE_ROOT and CMAKE_COMMAND cache entries
*/
@@ -389,7 +384,6 @@ protected:
std::string StartOutputDirectory;
bool SuppressDevWarnings;
bool DoSuppressDevWarnings;
- std::set<cmStdString> WrittenFiles;
///! return true if the same cmake was used to make the cache.
bool CacheVersionMatches();
diff --git a/Source/kwsys/System.c b/Source/kwsys/System.c
index de85c3a5d2..d205c960c7 100644
--- a/Source/kwsys/System.c
+++ b/Source/kwsys/System.c
@@ -75,6 +75,13 @@ static int kwsysSystem_Shell__CharNeedsQuotesOnUnix(char c)
}
/*--------------------------------------------------------------------------*/
+static int kwsysSystem_Shell__CharNeedsQuotesOnWindows(char c)
+{
+ return ((c == '\'') || (c == '#') || (c == '&') ||
+ (c == '<') || (c == '>') || (c == '|') || (c == '^'));
+}
+
+/*--------------------------------------------------------------------------*/
static int kwsysSystem_Shell__CharNeedsQuotes(char c, int isUnix, int flags)
{
/* On Windows the built-in command shell echo never needs quotes. */
@@ -99,14 +106,10 @@ static int kwsysSystem_Shell__CharNeedsQuotes(char c, int isUnix, int flags)
}
else
{
- /* On Windows single-quotes must be escaped in some make
- environments, such as in mingw32-make. */
- if(flags & kwsysSystem_Shell_Flag_Make)
+ /* On Windows several special characters need quotes to preserve them. */
+ if(kwsysSystem_Shell__CharNeedsQuotesOnWindows(c))
{
- if(c == '\'')
- {
- return 1;
- }
+ return 1;
}
}
return 0;
@@ -380,6 +383,10 @@ static char* kwsysSystem_Shell__GetArgument(const char* in, char* out,
*out++ = *c++;
}
+ /* The make variable reference eliminates any escaping needed
+ for preceding backslashes. */
+ windows_backslashes = 0;
+
/* Stop if we have reached the end of the string. */
if(!*c)
{
diff --git a/Source/kwsys/SystemInformation.cxx b/Source/kwsys/SystemInformation.cxx
index 1055313741..2d9fee66b2 100644
--- a/Source/kwsys/SystemInformation.cxx
+++ b/Source/kwsys/SystemInformation.cxx
@@ -1963,16 +1963,16 @@ bool SystemInformationImplementation::RetrieveClassicalCPUIdentity()
case 6:
switch (this->ChipID.Model)
{
- case 1: sprintf (this->ChipID.ProcessorName,"Athlon™ (0.25 micron)"); break;
- case 2: sprintf (this->ChipID.ProcessorName,"Athlon™ (0.18 micron)"); break;
- case 3: sprintf (this->ChipID.ProcessorName,"Duron™ (SF core)"); break;
- case 4: sprintf (this->ChipID.ProcessorName,"Athlon™ (Thunderbird core)"); break;
- case 6: sprintf (this->ChipID.ProcessorName,"Athlon™ (Palomino core)"); break;
- case 7: sprintf (this->ChipID.ProcessorName,"Duron™ (Morgan core)"); break;
+ case 1: sprintf (this->ChipID.ProcessorName,"Athlon- (0.25 micron)"); break;
+ case 2: sprintf (this->ChipID.ProcessorName,"Athlon- (0.18 micron)"); break;
+ case 3: sprintf (this->ChipID.ProcessorName,"Duron- (SF core)"); break;
+ case 4: sprintf (this->ChipID.ProcessorName,"Athlon- (Thunderbird core)"); break;
+ case 6: sprintf (this->ChipID.ProcessorName,"Athlon- (Palomino core)"); break;
+ case 7: sprintf (this->ChipID.ProcessorName,"Duron- (Morgan core)"); break;
case 8:
if (this->Features.ExtendedFeatures.SupportsMP)
- sprintf (this->ChipID.ProcessorName,"Athlon™ MP (Thoroughbred core)");
- else sprintf (this->ChipID.ProcessorName,"Athlon™ XP (Thoroughbred core)");
+ sprintf (this->ChipID.ProcessorName,"Athlon - MP (Thoroughbred core)");
+ else sprintf (this->ChipID.ProcessorName,"Athlon - XP (Thoroughbred core)");
break;
default: sprintf (this->ChipID.ProcessorName,"Unknown K7 family"); return false;
}