summaryrefslogtreecommitdiffstats
path: root/Source
diff options
context:
space:
mode:
Diffstat (limited to 'Source')
-rw-r--r--Source/CMakeLists.txt4
-rw-r--r--Source/CPack/cmCPackNSISGenerator.cxx104
-rw-r--r--Source/CTest/cmCTestBuildHandler.cxx5
-rw-r--r--Source/CTest/cmCTestGIT.cxx57
-rw-r--r--Source/CTest/cmCTestLaunch.cxx7
-rw-r--r--Source/CTest/cmCTestMultiProcessHandler.cxx61
-rw-r--r--Source/CTest/cmCTestRunTest.cxx11
-rw-r--r--Source/CTest/cmCTestRunTest.h4
-rw-r--r--Source/CTest/cmCTestTestHandler.cxx79
-rw-r--r--Source/CTest/cmCTestTestHandler.h1
-rw-r--r--Source/CTest/cmCTestVC.cxx5
-rw-r--r--Source/CTest/cmCTestVC.h3
-rw-r--r--Source/CursesDialog/cmCursesMainForm.cxx45
-rw-r--r--Source/CursesDialog/form/frm_driver.c18
-rw-r--r--Source/CursesDialog/form/frm_post.c9
-rw-r--r--Source/QtDialog/CMakeSetupDialog.cxx153
-rw-r--r--Source/QtDialog/CMakeSetupDialog.h12
-rw-r--r--Source/QtDialog/QCMakeCacheView.cxx28
-rw-r--r--Source/QtDialog/QCMakeCacheView.h4
-rw-r--r--Source/cmAddCustomCommandCommand.h12
-rw-r--r--Source/cmAddTestCommand.cxx20
-rw-r--r--Source/cmAddTestCommand.h20
-rw-r--r--Source/cmBootstrapCommands.cxx2
-rw-r--r--Source/cmCMakePolicyCommand.h3
-rw-r--r--Source/cmCommands.cxx2
-rw-r--r--Source/cmCoreTryCompile.cxx74
-rw-r--r--Source/cmCustomCommand.cxx27
-rw-r--r--Source/cmCustomCommand.h11
-rw-r--r--Source/cmCustomCommandGenerator.cxx72
-rw-r--r--Source/cmCustomCommandGenerator.h40
-rw-r--r--Source/cmDepends.cxx2
-rw-r--r--Source/cmDependsC.cxx1
-rw-r--r--Source/cmDocumentCompileDefinitions.h34
-rw-r--r--Source/cmDocumentGeneratorExpressions.h30
-rw-r--r--Source/cmDocumentVariables.cxx68
-rw-r--r--Source/cmExtraEclipseCDT4Generator.cxx2
-rw-r--r--Source/cmFileCommand.h7
-rw-r--r--Source/cmGeneratorExpression.cxx8
-rw-r--r--Source/cmGeneratorExpression.h10
-rw-r--r--Source/cmGetCMakePropertyCommand.h11
-rw-r--r--Source/cmGetDirectoryPropertyCommand.h3
-rw-r--r--Source/cmGetSourceFilePropertyCommand.h4
-rw-r--r--Source/cmGetTargetPropertyCommand.h4
-rw-r--r--Source/cmGetTestPropertyCommand.h12
-rw-r--r--Source/cmGlobalGenerator.cxx46
-rw-r--r--Source/cmGlobalGenerator.h5
-rw-r--r--Source/cmGlobalMSYSMakefileGenerator.cxx7
-rw-r--r--Source/cmGlobalMinGWMakefileGenerator.cxx7
-rw-r--r--Source/cmGlobalVisualStudio10Generator.cxx15
-rw-r--r--Source/cmGlobalVisualStudio71Generator.cxx10
-rw-r--r--Source/cmGlobalVisualStudio7Generator.cxx17
-rw-r--r--Source/cmGlobalVisualStudio7Generator.h1
-rw-r--r--Source/cmGlobalVisualStudioGenerator.cxx5
-rw-r--r--Source/cmGlobalXCodeGenerator.cxx57
-rw-r--r--Source/cmGlobalXCodeGenerator.h3
-rw-r--r--Source/cmIfCommand.h89
-rw-r--r--Source/cmIncludeCommand.cxx16
-rw-r--r--Source/cmIncludeCommand.h18
-rw-r--r--Source/cmLocalGenerator.cxx18
-rw-r--r--Source/cmLocalGenerator.h5
-rw-r--r--Source/cmLocalUnixMakefileGenerator3.cxx27
-rw-r--r--Source/cmLocalVisualStudio10Generator.cxx6
-rw-r--r--Source/cmLocalVisualStudio10Generator.h4
-rw-r--r--Source/cmLocalVisualStudio6Generator.cxx17
-rw-r--r--Source/cmLocalVisualStudio7Generator.cxx53
-rw-r--r--Source/cmLocalVisualStudio7Generator.h1
-rw-r--r--Source/cmLocalVisualStudioGenerator.cxx61
-rw-r--r--Source/cmLocalVisualStudioGenerator.h13
-rw-r--r--Source/cmMakefile.cxx144
-rw-r--r--Source/cmPolicies.cxx83
-rw-r--r--Source/cmPolicies.h5
-rw-r--r--Source/cmSourceFile.cxx24
-rw-r--r--Source/cmTarget.cxx44
-rw-r--r--Source/cmTryCompileCommand.h45
-rw-r--r--Source/cmTryRunCommand.h5
-rw-r--r--Source/cmVisualStudio10TargetGenerator.cxx142
-rw-r--r--Source/cmVisualStudioGeneratorOptions.cxx14
-rw-r--r--Source/cmWin32ProcessExecution.cxx3
-rw-r--r--Source/kwsys/Registry.cxx3
-rw-r--r--Source/kwsys/SystemInformation.cxx451
-rw-r--r--Source/kwsys/SystemTools.cxx11
-rw-r--r--Source/kwsys/kwsysDateStamp.cmake6
82 files changed, 1667 insertions, 903 deletions
diff --git a/Source/CMakeLists.txt b/Source/CMakeLists.txt
index 718e52e..7722c19 100644
--- a/Source/CMakeLists.txt
+++ b/Source/CMakeLists.txt
@@ -131,6 +131,8 @@ SET(SRCS
cmComputeTargetDepends.cxx
cmCustomCommand.cxx
cmCustomCommand.h
+ cmCustomCommandGenerator.cxx
+ cmCustomCommandGenerator.h
cmDefinitions.cxx
cmDefinitions.h
cmDepends.cxx
@@ -156,6 +158,8 @@ SET(SRCS
cmDocumentationFormatterText.cxx
cmDocumentationFormatterUsage.cxx
cmDocumentationSection.cxx
+ cmDocumentCompileDefinitions.h
+ cmDocumentGeneratorExpressions.h
cmDocumentVariables.cxx
cmDynamicLoader.cxx
cmDynamicLoader.h
diff --git a/Source/CPack/cmCPackNSISGenerator.cxx b/Source/CPack/cmCPackNSISGenerator.cxx
index d0eda81..e5fe575 100644
--- a/Source/CPack/cmCPackNSISGenerator.cxx
+++ b/Source/CPack/cmCPackNSISGenerator.cxx
@@ -129,14 +129,21 @@ int cmCPackNSISGenerator::PackageFiles()
cmCPackLogger(cmCPackLog::LOG_VERBOSE, "Configure file: " << nsisInFileName
<< " to " << nsisFileName << std::endl);
if(this->IsSet("CPACK_NSIS_MUI_ICON")
- && this->IsSet("CPACK_NSIS_MUI_UNIICON"))
+ || this->IsSet("CPACK_NSIS_MUI_UNIICON"))
{
- std::string installerIconCode="!define MUI_ICON \"";
- installerIconCode += this->GetOption("CPACK_NSIS_MUI_ICON");
- installerIconCode += "\"\n";
- installerIconCode += "!define MUI_UNICON \"";
- installerIconCode += this->GetOption("CPACK_NSIS_MUI_UNIICON");
- installerIconCode += "\"\n";
+ std::string installerIconCode;
+ if(this->IsSet("CPACK_NSIS_MUI_ICON"))
+ {
+ installerIconCode += "!define MUI_ICON \"";
+ installerIconCode += this->GetOption("CPACK_NSIS_MUI_ICON");
+ installerIconCode += "\"\n";
+ }
+ if(this->IsSet("CPACK_NSIS_MUI_UNIICON"))
+ {
+ installerIconCode += "!define MUI_UNICON \"";
+ installerIconCode += this->GetOption("CPACK_NSIS_MUI_UNIICON");
+ installerIconCode += "\"\n";
+ }
this->SetOptionIfNotSet("CPACK_NSIS_INSTALLER_MUI_ICON_CODE",
installerIconCode.c_str());
}
@@ -149,6 +156,17 @@ int cmCPackNSISGenerator::PackageFiles()
installerIconCode.c_str());
}
+ if(this->IsSet("CPACK_NSIS_MUI_FINISHPAGE_RUN"))
+ {
+ std::string installerRunCode = "!define MUI_FINISHPAGE_RUN \"$INSTDIR\\";
+ installerRunCode += this->GetOption("CPACK_NSIS_EXECUTABLES_DIRECTORY");
+ installerRunCode += "\\";
+ installerRunCode += this->GetOption("CPACK_NSIS_MUI_FINISHPAGE_RUN");
+ installerRunCode += "\"\n";
+ this->SetOptionIfNotSet("CPACK_NSIS_INSTALLER_MUI_FINISHPAGE_RUN_CODE",
+ installerRunCode.c_str());
+ }
+
// Setup all of the component sections
if (this->Components.empty())
{
@@ -337,6 +355,7 @@ int cmCPackNSISGenerator::InitializeInternal()
<< std::endl);
std::vector<std::string> path;
std::string nsisPath;
+ bool gotRegValue = true;
#ifdef _WIN32
if ( !cmsys::SystemTools::ReadRegistryValue(
@@ -346,24 +365,37 @@ int cmCPackNSISGenerator::InitializeInternal()
if ( !cmsys::SystemTools::ReadRegistryValue(
"HKEY_LOCAL_MACHINE\\SOFTWARE\\NSIS", nsisPath) )
{
- cmCPackLogger
- (cmCPackLog::LOG_ERROR,
- "Cannot find NSIS registry value. This is usually caused by NSIS "
- "not being installed. Please install NSIS from "
- "http://nsis.sourceforge.net"
- << std::endl);
- return 0;
+ gotRegValue = false;
}
}
- path.push_back(nsisPath);
+
+ if (gotRegValue)
+ {
+ path.push_back(nsisPath);
+ }
#endif
+
nsisPath = cmSystemTools::FindProgram("makensis", path, false);
+
if ( nsisPath.empty() )
{
- cmCPackLogger(cmCPackLog::LOG_ERROR, "Cannot find NSIS compiler"
+ cmCPackLogger(cmCPackLog::LOG_ERROR,
+ "Cannot find NSIS compiler makensis: likely it is not installed, "
+ "or not in your PATH"
<< std::endl);
+
+ if (!gotRegValue)
+ {
+ cmCPackLogger(cmCPackLog::LOG_ERROR,
+ "Could not read NSIS registry value. This is usually caused by "
+ "NSIS not being installed. Please install NSIS from "
+ "http://nsis.sourceforge.net"
+ << std::endl);
+ }
+
return 0;
}
+
std::string nsisCmd = "\"" + nsisPath + "\" " NSIS_OPT "VERSION";
cmCPackLogger(cmCPackLog::LOG_VERBOSE, "Test NSIS version: "
<< nsisCmd.c_str() << std::endl);
@@ -400,10 +432,13 @@ int cmCPackNSISGenerator::InitializeInternal()
return 0;
}
this->SetOptionIfNotSet("CPACK_INSTALLER_PROGRAM", nsisPath.c_str());
+ this->SetOptionIfNotSet("CPACK_NSIS_EXECUTABLES_DIRECTORY", "bin");
const char* cpackPackageExecutables
= this->GetOption("CPACK_PACKAGE_EXECUTABLES");
const char* cpackPackageDeskTopLinks
= this->GetOption("CPACK_CREATE_DESKTOP_LINKS");
+ const char* cpackNsisExecutablesDirectory
+ = this->GetOption("CPACK_NSIS_EXECUTABLES_DIRECTORY");
std::vector<std::string> cpackPackageDesktopLinksVector;
if(cpackPackageDeskTopLinks)
{
@@ -426,12 +461,14 @@ int cmCPackNSISGenerator::InitializeInternal()
cmCPackLogger(cmCPackLog::LOG_DEBUG, "CPACK_CREATE_DESKTOP_LINKS: "
<< "not set" << std::endl);
}
+
+ cmOStringStream str;
+ cmOStringStream deleteStr;
+
if ( cpackPackageExecutables )
{
cmCPackLogger(cmCPackLog::LOG_DEBUG, "The cpackPackageExecutables: "
<< cpackPackageExecutables << "." << std::endl);
- cmOStringStream str;
- cmOStringStream deleteStr;
std::vector<std::string> cpackPackageExecutablesVector;
cmSystemTools::ExpandListArgument(cpackPackageExecutables,
cpackPackageExecutablesVector);
@@ -451,7 +488,8 @@ int cmCPackNSISGenerator::InitializeInternal()
++ it;
std::string linkName = *it;
str << " CreateShortCut \"$SMPROGRAMS\\$STARTMENU_FOLDER\\"
- << linkName << ".lnk\" \"$INSTDIR\\bin\\" << execName << ".exe\""
+ << linkName << ".lnk\" \"$INSTDIR\\"
+ << cpackNsisExecutablesDirectory << "\\" << execName << ".exe\""
<< std::endl;
deleteStr << " Delete \"$SMPROGRAMS\\$MUI_TEMP\\" << linkName
<< ".lnk\"" << std::endl;
@@ -465,18 +503,21 @@ int cmCPackNSISGenerator::InitializeInternal()
{
str << " StrCmp \"$INSTALL_DESKTOP\" \"1\" 0 +2\n";
str << " CreateShortCut \"$DESKTOP\\"
- << linkName << ".lnk\" \"$INSTDIR\\bin\\" << execName << ".exe\""
+ << linkName << ".lnk\" \"$INSTDIR\\"
+ << cpackNsisExecutablesDirectory << "\\" << execName << ".exe\""
<< std::endl;
deleteStr << " StrCmp \"$INSTALL_DESKTOP\" \"1\" 0 +2\n";
deleteStr << " Delete \"$DESKTOP\\" << linkName
<< ".lnk\"" << std::endl;
}
}
- this->CreateMenuLinks(str, deleteStr);
- this->SetOptionIfNotSet("CPACK_NSIS_CREATE_ICONS", str.str().c_str());
- this->SetOptionIfNotSet("CPACK_NSIS_DELETE_ICONS",
- deleteStr.str().c_str());
}
+
+ this->CreateMenuLinks(str, deleteStr);
+ this->SetOptionIfNotSet("CPACK_NSIS_CREATE_ICONS", str.str().c_str());
+ this->SetOptionIfNotSet("CPACK_NSIS_DELETE_ICONS",
+ deleteStr.str().c_str());
+
this->SetOptionIfNotSet("CPACK_NSIS_COMPRESSOR", "lzma");
return this->Superclass::InitializeInternal();
@@ -505,22 +546,25 @@ void cmCPackNSISGenerator::CreateMenuLinks( cmOStringStream& str,
"<icon name>." << std::endl);
return;
}
+
+ cmsys::RegularExpression urlRegex;
+ urlRegex.compile("^(mailto:|(ftps?|https?|news)://).*$");
+
std::vector<std::string>::iterator it;
for ( it = cpackMenuLinksVector.begin();
it != cpackMenuLinksVector.end();
++it )
{
std::string sourceName = *it;
- bool url = false;
- if(sourceName.find("http:") == 0)
- {
- url = true;
- }
- /* convert / to \\ */
+ const bool url = urlRegex.find(sourceName);
+
+ // Convert / to \ in filenames, but not in urls:
+ //
if(!url)
{
cmSystemTools::ReplaceString(sourceName, "/", "\\");
}
+
++ it;
std::string linkName = *it;
if(!url)
diff --git a/Source/CTest/cmCTestBuildHandler.cxx b/Source/CTest/cmCTestBuildHandler.cxx
index 3c5993d..9678ac4 100644
--- a/Source/CTest/cmCTestBuildHandler.cxx
+++ b/Source/CTest/cmCTestBuildHandler.cxx
@@ -43,6 +43,7 @@ static const char* cmCTestErrorMatches[] = {
"^[Bb]us [Ee]rror",
"^[Ss]egmentation [Vv]iolation",
"^[Ss]egmentation [Ff]ault",
+ ":.*[Pp]ermission [Dd]enied",
"([^ :]+):([0-9]+): ([^ \\t])",
"([^:]+): error[ \\t]*[0-9]+[ \\t]*:",
"^Error ([0-9]+):",
@@ -61,9 +62,9 @@ static const char* cmCTestErrorMatches[] = {
": syntax error ",
"^collect2: ld returned 1 exit status",
"ld terminated with signal",
- "Unsatisfied symbols:",
+ "Unsatisfied symbol",
"^Unresolved:",
- "Undefined symbols:",
+ "Undefined symbol",
"^Undefined[ \\t]+first referenced",
"^CMake Error.*:",
":[ \\t]cannot find",
diff --git a/Source/CTest/cmCTestGIT.cxx b/Source/CTest/cmCTestGIT.cxx
index a6f10ec..aa9e55b 100644
--- a/Source/CTest/cmCTestGIT.cxx
+++ b/Source/CTest/cmCTestGIT.cxx
@@ -503,28 +503,15 @@ private:
this->ParsePerson(this->Line.c_str()+7, author);
this->Rev.Author = author.Name;
this->Rev.EMail = author.EMail;
-
- // Convert the time to a human-readable format that is also easy
- // to machine-parse: "CCYY-MM-DD hh:mm:ss".
- time_t seconds = static_cast<time_t>(author.Time);
- struct tm* t = gmtime(&seconds);
- char dt[1024];
- sprintf(dt, "%04d-%02d-%02d %02d:%02d:%02d",
- t->tm_year+1900, t->tm_mon+1, t->tm_mday,
- t->tm_hour, t->tm_min, t->tm_sec);
- this->Rev.Date = dt;
-
- // Add the time-zone field "+zone" or "-zone".
- char tz[32];
- if(author.TimeZone >= 0)
- {
- sprintf(tz, " +%04ld", author.TimeZone);
- }
- else
- {
- sprintf(tz, " -%04ld", -author.TimeZone);
- }
- this->Rev.Date += tz;
+ this->Rev.Date = this->FormatDateTime(author);
+ }
+ else if(strncmp(this->Line.c_str(), "committer ", 10) == 0)
+ {
+ Person committer;
+ this->ParsePerson(this->Line.c_str()+10, committer);
+ this->Rev.Committer = committer.Name;
+ this->Rev.CommitterEMail = committer.EMail;
+ this->Rev.CommitDate = this->FormatDateTime(committer);
}
}
@@ -537,6 +524,32 @@ private:
}
this->Rev.Log += "\n";
}
+
+ std::string FormatDateTime(Person const& person)
+ {
+ // Convert the time to a human-readable format that is also easy
+ // to machine-parse: "CCYY-MM-DD hh:mm:ss".
+ time_t seconds = static_cast<time_t>(person.Time);
+ struct tm* t = gmtime(&seconds);
+ char dt[1024];
+ sprintf(dt, "%04d-%02d-%02d %02d:%02d:%02d",
+ t->tm_year+1900, t->tm_mon+1, t->tm_mday,
+ t->tm_hour, t->tm_min, t->tm_sec);
+ std::string out = dt;
+
+ // Add the time-zone field "+zone" or "-zone".
+ char tz[32];
+ if(person.TimeZone >= 0)
+ {
+ sprintf(tz, " +%04ld", person.TimeZone);
+ }
+ else
+ {
+ sprintf(tz, " -%04ld", -person.TimeZone);
+ }
+ out += tz;
+ return out;
+ }
};
char const cmCTestGIT::CommitParser::SectionSep[SectionCount] =
diff --git a/Source/CTest/cmCTestLaunch.cxx b/Source/CTest/cmCTestLaunch.cxx
index 8e305b7..9831d02 100644
--- a/Source/CTest/cmCTestLaunch.cxx
+++ b/Source/CTest/cmCTestLaunch.cxx
@@ -220,6 +220,13 @@ void cmCTestLaunch::ComputeFileNames()
//----------------------------------------------------------------------------
void cmCTestLaunch::RunChild()
{
+ // Ignore noopt make rules
+ if(this->RealArgs.empty() || this->RealArgs[0] == ":")
+ {
+ this->ExitCode = 0;
+ return;
+ }
+
// Prepare to run the real command.
cmsysProcess* cp = this->Process;
cmsysProcess_SetCommand(cp, this->RealArgV);
diff --git a/Source/CTest/cmCTestMultiProcessHandler.cxx b/Source/CTest/cmCTestMultiProcessHandler.cxx
index 93c2963..f3a4457 100644
--- a/Source/CTest/cmCTestMultiProcessHandler.cxx
+++ b/Source/CTest/cmCTestMultiProcessHandler.cxx
@@ -428,7 +428,10 @@ void cmCTestMultiProcessHandler::ReadCostData()
if(index == -1) continue;
this->Properties[index]->PreviousRuns = prev;
- if(this->Properties[index] && this->Properties[index]->Cost == 0)
+ // When not running in parallel mode, don't use cost data
+ if(this->ParallelLevel > 1 &&
+ this->Properties[index] &&
+ this->Properties[index]->Cost == 0)
{
this->Properties[index]->Cost = cost;
}
@@ -469,20 +472,19 @@ void cmCTestMultiProcessHandler::CreateTestCostList()
{
SortedTests.push_back(i->first);
- //If the test failed last time, it should be run first, so max the cost
- if(std::find(this->LastTestsFailed.begin(),
- this->LastTestsFailed.end(),
- this->Properties[i->first]->Name)
- != this->LastTestsFailed.end())
+ //If the test failed last time, it should be run first, so max the cost.
+ //Only do this for parallel runs; in non-parallel runs, avoid clobbering
+ //the test's explicitly set cost.
+ if(this->ParallelLevel > 1 &&
+ std::find(this->LastTestsFailed.begin(), this->LastTestsFailed.end(),
+ this->Properties[i->first]->Name) != this->LastTestsFailed.end())
{
this->Properties[i->first]->Cost = FLT_MAX;
}
}
- if(this->ParallelLevel > 1)
- {
- TestComparator comp(this);
- std::sort(SortedTests.begin(), SortedTests.end(), comp);
- }
+
+ TestComparator comp(this);
+ std::sort(SortedTests.begin(), SortedTests.end(), comp);
}
//---------------------------------------------------------
@@ -653,32 +655,37 @@ bool cmCTestMultiProcessHandler::CheckCycles()
it != this->Tests.end(); ++it)
{
//DFS from each element to itself
+ int root = it->first;
+ std::set<int> visited;
std::stack<int> s;
- std::vector<int> visited;
-
- s.push(it->first);
-
+ s.push(root);
while(!s.empty())
{
int test = s.top();
s.pop();
-
- for(TestSet::iterator d = this->Tests[test].begin();
- d != this->Tests[test].end(); ++d)
+ if(visited.insert(test).second)
{
- if(std::find(visited.begin(), visited.end(), *d) != visited.end())
+ for(TestSet::iterator d = this->Tests[test].begin();
+ d != this->Tests[test].end(); ++d)
{
- //cycle exists
- cmCTestLog(this->CTest, ERROR_MESSAGE, "Error: a cycle exists in "
- "the test dependency graph for the test \""
- << this->Properties[it->first]->Name << "\"." << std::endl
- << "Please fix the cycle and run ctest again." << std::endl);
- return false;
+ if(*d == root)
+ {
+ //cycle exists
+ cmCTestLog(this->CTest, ERROR_MESSAGE,
+ "Error: a cycle exists in the test dependency graph "
+ "for the test \"" << this->Properties[root]->Name <<
+ "\".\nPlease fix the cycle and run ctest again.\n");
+ return false;
+ }
+ else
+ {
+ s.push(*d);
+ }
}
- s.push(*d);
}
- visited.push_back(test);
}
}
+ cmCTestLog(this->CTest, HANDLER_VERBOSE_OUTPUT,
+ "Checking test dependency graph end" << std::endl);
return true;
}
diff --git a/Source/CTest/cmCTestRunTest.cxx b/Source/CTest/cmCTestRunTest.cxx
index 76ff23a..42a4cff 100644
--- a/Source/CTest/cmCTestRunTest.cxx
+++ b/Source/CTest/cmCTestRunTest.cxx
@@ -455,7 +455,8 @@ bool cmCTestRunTest::StartTest(size_t total)
{
return false;
}
- return this->ForkProcess(timeout, &this->TestProperties->Environment);
+ return this->ForkProcess(timeout, this->TestProperties->ExplicitTimeout,
+ &this->TestProperties->Environment);
}
//----------------------------------------------------------------------
@@ -598,7 +599,7 @@ double cmCTestRunTest::ResolveTimeout()
}
//----------------------------------------------------------------------
-bool cmCTestRunTest::ForkProcess(double testTimeOut,
+bool cmCTestRunTest::ForkProcess(double testTimeOut, bool explicitTimeout,
std::vector<std::string>* environment)
{
this->TestProcess = new cmProcess;
@@ -619,12 +620,16 @@ bool cmCTestRunTest::ForkProcess(double testTimeOut,
{
timeout = testTimeOut;
}
-
// always have at least 1 second if we got to here
if (timeout <= 0)
{
timeout = 1;
}
+ // handle timeout explicitly set to 0
+ if (testTimeOut == 0 && explicitTimeout)
+ {
+ timeout = 0;
+ }
cmCTestLog(this->CTest, HANDLER_VERBOSE_OUTPUT, this->Index << ": "
<< "Test timeout computed to be: " << timeout << "\n");
diff --git a/Source/CTest/cmCTestRunTest.h b/Source/CTest/cmCTestRunTest.h
index 66e6b7b..89456d5 100644
--- a/Source/CTest/cmCTestRunTest.h
+++ b/Source/CTest/cmCTestRunTest.h
@@ -63,8 +63,8 @@ private:
void ExeNotFound(std::string exe);
// Figures out a final timeout which is min(STOP_TIME, NOW+TIMEOUT)
double ResolveTimeout();
- bool ForkProcess(double testTimeOut,
- std::vector<std::string>* environment);
+ bool ForkProcess(double testTimeOut, bool explicitTimeout,
+ std::vector<std::string>* environment);
void WriteLogOutputTop(size_t completed, size_t total);
//Run post processing of the process output for MemCheck
void MemCheckPostProcess();
diff --git a/Source/CTest/cmCTestTestHandler.cxx b/Source/CTest/cmCTestTestHandler.cxx
index b8e38fb..87c75eb 100644
--- a/Source/CTest/cmCTestTestHandler.cxx
+++ b/Source/CTest/cmCTestTestHandler.cxx
@@ -26,6 +26,7 @@
#include "cmCommand.h"
#include "cmSystemTools.h"
#include "cmXMLSafe.h"
+#include "cm_utf8.h"
#include <stdlib.h>
#include <math.h>
@@ -438,6 +439,8 @@ void cmCTestTestHandler::Initialize()
this->TestsToRun.clear();
+ this->UseIncludeLabelRegExpFlag = false;
+ this->UseExcludeLabelRegExpFlag = false;
this->UseIncludeRegExpFlag = false;
this->UseExcludeRegExpFlag = false;
this->UseExcludeRegExpFirst = false;
@@ -1978,65 +1981,45 @@ void cmCTestTestHandler::SetTestsToRunInformation(const char* in)
}
}
-//----------------------------------------------------------------------
-bool cmCTestTestHandler::CleanTestOutput(std::string& output,
- size_t remove_threshold)
+//----------------------------------------------------------------------------
+bool cmCTestTestHandler::CleanTestOutput(std::string& output, size_t length)
{
- if ( remove_threshold == 0 )
+ if(!length || length >= output.size() ||
+ output.find("CTEST_FULL_OUTPUT") != output.npos)
{
return true;
}
- if ( output.find("CTEST_FULL_OUTPUT") != output.npos )
+
+ // Truncate at given length but do not break in the middle of a multi-byte
+ // UTF-8 encoding.
+ char const* const begin = output.c_str();
+ char const* const end = begin + output.size();
+ char const* const truncate = begin + length;
+ char const* current = begin;
+ while(current < truncate)
{
- return true;
- }
- cmOStringStream ostr;
- std::string::size_type cc;
- std::string::size_type skipsize = 0;
- int inTag = 0;
- int skipped = 0;
- for ( cc = 0; cc < output.size(); cc ++ )
- {
- int ch = output[cc];
- if ( ch < 0 || ch > 255 )
- {
- break;
- }
- if ( ch == '<' )
- {
- inTag = 1;
- }
- if ( !inTag )
+ unsigned int ch;
+ if(const char* next = cm_utf8_decode_character(current, end, &ch))
{
- int notskip = 0;
- // Skip
- if ( skipsize < remove_threshold )
- {
- ostr << static_cast<char>(ch);
- notskip = 1;
- }
- skipsize ++;
- if ( notskip && skipsize >= remove_threshold )
+ if(next > truncate)
{
- skipped = 1;
+ break;
}
+ current = next;
}
- else
- {
- ostr << static_cast<char>(ch);
- }
- if ( ch == '>' )
+ else // Bad byte will be handled by cmXMLSafe.
{
- inTag = 0;
+ ++current;
}
}
- if ( skipped )
- {
- ostr << "..." << std::endl << "The rest of the test output was removed "
- "since it exceeds the threshold of "
- << remove_threshold << " characters." << std::endl;
- }
- output = ostr.str();
+ output = output.substr(0, current - begin);
+
+ // Append truncation message.
+ cmOStringStream msg;
+ msg << "...\n"
+ "The rest of the test output was removed since it exceeds the threshold "
+ "of " << length << " bytes.\n";
+ output += msg.str();
return true;
}
@@ -2120,6 +2103,7 @@ bool cmCTestTestHandler::SetTestsProperties(
if ( key == "TIMEOUT" )
{
rtit->Timeout = atof(val.c_str());
+ rtit->ExplicitTimeout = true;
}
if ( key == "COST" )
{
@@ -2293,6 +2277,7 @@ bool cmCTestTestHandler::AddTest(const std::vector<std::string>& args)
test.WillFail = false;
test.RunSerial = false;
test.Timeout = 0;
+ test.ExplicitTimeout = false;
test.Cost = 0;
test.Processors = 1;
test.PreviousRuns = 0;
diff --git a/Source/CTest/cmCTestTestHandler.h b/Source/CTest/cmCTestTestHandler.h
index 7049564..7aa8522 100644
--- a/Source/CTest/cmCTestTestHandler.h
+++ b/Source/CTest/cmCTestTestHandler.h
@@ -99,6 +99,7 @@ public:
int PreviousRuns;
bool RunSerial;
double Timeout;
+ bool ExplicitTimeout;
int Index;
//Requested number of process slots
int Processors;
diff --git a/Source/CTest/cmCTestVC.cxx b/Source/CTest/cmCTestVC.cxx
index f9ad79a..fbee227 100644
--- a/Source/CTest/cmCTestVC.cxx
+++ b/Source/CTest/cmCTestVC.cxx
@@ -228,6 +228,11 @@ void cmCTestVC::WriteXMLEntry(std::ostream& xml,
<< "\t\t\t<CheckinDate>" << cmXMLSafe(rev.Date) << "</CheckinDate>\n"
<< "\t\t\t<Author>" << cmXMLSafe(rev.Author) << "</Author>\n"
<< "\t\t\t<Email>" << cmXMLSafe(rev.EMail) << "</Email>\n"
+ << "\t\t\t<Committer>" << cmXMLSafe(rev.Committer) << "</Committer>\n"
+ << "\t\t\t<CommitterEmail>" << cmXMLSafe(rev.CommitterEMail)
+ << "</CommitterEmail>\n"
+ << "\t\t\t<CommitDate>" << cmXMLSafe(rev.CommitDate)
+ << "</CommitDate>\n"
<< "\t\t\t<Log>" << cmXMLSafe(rev.Log) << "</Log>\n"
<< "\t\t\t<Revision>" << cmXMLSafe(rev.Rev) << "</Revision>\n"
<< "\t\t\t<PriorRevision>" << cmXMLSafe(prior) << "</PriorRevision>\n"
diff --git a/Source/CTest/cmCTestVC.h b/Source/CTest/cmCTestVC.h
index d36bc8f..44e1dac 100644
--- a/Source/CTest/cmCTestVC.h
+++ b/Source/CTest/cmCTestVC.h
@@ -74,6 +74,9 @@ protected:
std::string Date;
std::string Author;
std::string EMail;
+ std::string Committer;
+ std::string CommitterEMail;
+ std::string CommitDate;
std::string Log;
};
diff --git a/Source/CursesDialog/cmCursesMainForm.cxx b/Source/CursesDialog/cmCursesMainForm.cxx
index 71c06d5..e1876b9 100644
--- a/Source/CursesDialog/cmCursesMainForm.cxx
+++ b/Source/CursesDialog/cmCursesMainForm.cxx
@@ -334,32 +334,35 @@ void cmCursesMainForm::Render(int left, int top, int width, int height)
}
// Re-adjust the fields according to their place
- bool isNewPage;
- int i=0;
this->NumberOfPages = 1;
- std::vector<cmCursesCacheEntryComposite*>::iterator it;
- for (it = this->Entries->begin(); it != this->Entries->end(); ++it)
+ if (height > 0)
{
- cmCacheManager::CacheIterator mit =
- this->CMakeInstance->GetCacheManager()->GetCacheIterator((*it)->GetValue());
- if (mit.IsAtEnd() ||
- (!this->AdvancedMode && mit.GetPropertyAsBool("ADVANCED")))
+ bool isNewPage;
+ int i=0;
+ std::vector<cmCursesCacheEntryComposite*>::iterator it;
+ for (it = this->Entries->begin(); it != this->Entries->end(); ++it)
{
- continue;
- }
- int row = (i % height) + 1;
- int page = (i / height) + 1;
- isNewPage = ( page > 1 ) && ( row == 1 );
+ cmCacheManager::CacheIterator mit =
+ this->CMakeInstance->GetCacheManager()->GetCacheIterator((*it)->GetValue());
+ if (mit.IsAtEnd() ||
+ (!this->AdvancedMode && mit.GetPropertyAsBool("ADVANCED")))
+ {
+ continue;
+ }
+ int row = (i % height) + 1;
+ int page = (i / height) + 1;
+ isNewPage = ( page > 1 ) && ( row == 1 );
- if (isNewPage)
- {
- this->NumberOfPages++;
+ if (isNewPage)
+ {
+ this->NumberOfPages++;
+ }
+ (*it)->Label->Move(left, top+row-1, isNewPage);
+ (*it)->IsNewLabel->Move(left+32, top+row-1, false);
+ (*it)->Entry->Move(left+33, top+row-1, false);
+ (*it)->Entry->SetPage(this->NumberOfPages);
+ i++;
}
- (*it)->Label->Move(left, top+row-1, isNewPage);
- (*it)->IsNewLabel->Move(left+32, top+row-1, false);
- (*it)->Entry->Move(left+33, top+row-1, false);
- (*it)->Entry->SetPage(this->NumberOfPages);
- i++;
}
// Post the form
diff --git a/Source/CursesDialog/form/frm_driver.c b/Source/CursesDialog/form/frm_driver.c
index 0b53b5a..03896c2 100644
--- a/Source/CursesDialog/form/frm_driver.c
+++ b/Source/CursesDialog/form/frm_driver.c
@@ -357,8 +357,12 @@ static void Buffer_To_Window(const FIELD * field, WINDOW * win)
assert(win && field);
+#if defined(__LSB_VERSION__)
+ getmaxyx(win, height, width);
+#else
width = getmaxx(win);
height = getmaxy(win);
+#endif
for(row=0, pBuffer=field->buf;
row < height;
@@ -396,7 +400,11 @@ static void Window_To_Buffer(WINDOW * win, FIELD * field)
pad = field->pad;
p = field->buf;
+#if defined(__LSB_VERSION__)
+ { int width; getmaxyx(win, height, width); }
+#else
height = getmaxy(win);
+#endif
for(row=0; (row < height) && (row < field->drows); row++ )
{
@@ -871,7 +879,17 @@ static int Display_Or_Erase_Field(FIELD * field, bool bEraseFlag)
if (field->opts & O_VISIBLE)
Set_Field_Window_Attributes(field,win);
else
+ {
+#if defined(__LSB_VERSION__)
+ /* getattrs() would be handy, but it is not part of LSB 4.0 */
+ attr_t fwinAttrs;
+ short fwinPair;
+ wattr_get(fwin, &fwinAttrs, &fwinPair, 0);
+ wattr_set(win, fwinAttrs, fwinPair, 0);
+#else
wattrset(win,getattrs(fwin));
+#endif
+ }
werase(win);
}
diff --git a/Source/CursesDialog/form/frm_post.c b/Source/CursesDialog/form/frm_post.c
index 5ead942..3c63de7 100644
--- a/Source/CursesDialog/form/frm_post.c
+++ b/Source/CursesDialog/form/frm_post.c
@@ -51,6 +51,7 @@ int post_form(FORM * form)
WINDOW *formwin;
int err;
int page;
+ int height, width;
if (!form)
RETURN(E_BAD_ARGUMENT);
@@ -62,7 +63,13 @@ int post_form(FORM * form)
RETURN(E_NOT_CONNECTED);
formwin = Get_Form_Window(form);
- if ((form->cols > getmaxx(formwin)) || (form->rows > getmaxy(formwin)))
+#if defined(__LSB_VERSION__)
+ getmaxyx(formwin, height, width);
+#else
+ width = getmaxx(formwin);
+ height = getmaxy(formwin);
+#endif
+ if ((form->cols > width) || (form->rows > height))
RETURN(E_NO_ROOM);
/* reset form->curpage to an invald value. This forces Set_Form_Page
diff --git a/Source/QtDialog/CMakeSetupDialog.cxx b/Source/QtDialog/CMakeSetupDialog.cxx
index 779c14e..c8c4bfa 100644
--- a/Source/QtDialog/CMakeSetupDialog.cxx
+++ b/Source/QtDialog/CMakeSetupDialog.cxx
@@ -55,7 +55,7 @@ void QCMakeThread::run()
}
CMakeSetupDialog::CMakeSetupDialog()
- : ExitAfterGenerate(true), CacheModified(false), CurrentState(Interrupting)
+ : ExitAfterGenerate(true), CacheModified(false), ConfigureNeeded(true), CurrentState(Interrupting)
{
QString title = QString(tr("CMake %1"));
title = title.arg(cmVersion::GetCMakeVersion());
@@ -174,6 +174,9 @@ CMakeSetupDialog::CMakeSetupDialog()
this->CMakeThread->start();
this->enterState(ReadyConfigure);
+
+ ProgressOffset = 0.0;
+ ProgressFactor = 1.0;
}
void CMakeSetupDialog::initialize()
@@ -186,12 +189,11 @@ void CMakeSetupDialog::initialize()
QObject::connect(this->ConfigureButton, SIGNAL(clicked(bool)),
this, SLOT(doConfigure()));
- QObject::connect(this->CMakeThread->cmakeInstance(),
- SIGNAL(configureDone(int)),
- this, SLOT(finishConfigure(int)));
- QObject::connect(this->CMakeThread->cmakeInstance(),
- SIGNAL(generateDone(int)),
- this, SLOT(finishGenerate(int)));
+
+ QObject::connect(this->CMakeThread->cmakeInstance(), SIGNAL(configureDone(int)),
+ this, SLOT(exitLoop(int)));
+ QObject::connect(this->CMakeThread->cmakeInstance(), SIGNAL(generateDone(int)),
+ this, SLOT(exitLoop(int)));
QObject::connect(this->GenerateButton, SIGNAL(clicked(bool)),
this, SLOT(doGenerate()));
@@ -284,15 +286,8 @@ CMakeSetupDialog::~CMakeSetupDialog()
this->CMakeThread->wait(2000);
}
-void CMakeSetupDialog::doConfigure()
+bool CMakeSetupDialog::prepareConfigure()
{
- if(this->CurrentState == Configuring)
- {
- // stop configure
- doInterrupt();
- return;
- }
-
// make sure build directory exists
QString bindir = this->CMakeThread->cmakeInstance()->binaryDirectory();
QDir dir(bindir);
@@ -309,7 +304,7 @@ void CMakeSetupDialog::doConfigure()
QMessageBox::Yes | QMessageBox::No);
if(btn == QMessageBox::No)
{
- return;
+ return false;
}
if(!dir.mkpath("."))
{
@@ -317,7 +312,7 @@ void CMakeSetupDialog::doConfigure()
QString(tr("Failed to create directory %1")).arg(dir.path()),
QMessageBox::Ok);
- return;
+ return false;
}
}
@@ -326,27 +321,45 @@ void CMakeSetupDialog::doConfigure()
{
if(!this->setupFirstConfigure())
{
- return;
+ return false;
}
}
// remember path
this->addBinaryPath(dir.absolutePath());
- this->enterState(Configuring);
+ return true;
+}
- this->CacheValues->selectionModel()->clear();
- QMetaObject::invokeMethod(this->CMakeThread->cmakeInstance(),
- "setProperties", Qt::QueuedConnection,
- Q_ARG(QCMakePropertyList,
- this->CacheValues->cacheModel()->properties()));
- QMetaObject::invokeMethod(this->CMakeThread->cmakeInstance(),
- "configure", Qt::QueuedConnection);
+void CMakeSetupDialog::exitLoop(int err)
+{
+ this->LocalLoop.exit(err);
}
-void CMakeSetupDialog::finishConfigure(int err)
+void CMakeSetupDialog::doConfigure()
{
- if(0 == err && !this->CacheValues->cacheModel()->newPropertyCount())
+ if(this->CurrentState == Configuring)
+ {
+ // stop configure
+ doInterrupt();
+ return;
+ }
+
+ if(!prepareConfigure())
+ {
+ return;
+ }
+
+ this->enterState(Configuring);
+
+ bool ret = doConfigureInternal();
+
+ if(ret)
+ {
+ this->ConfigureNeeded = false;
+ }
+
+ if(ret && !this->CacheValues->cacheModel()->newPropertyCount())
{
this->enterState(ReadyGenerate);
}
@@ -355,6 +368,22 @@ void CMakeSetupDialog::finishConfigure(int err)
this->enterState(ReadyConfigure);
this->CacheValues->scrollToTop();
}
+ this->ProgressBar->reset();
+}
+
+bool CMakeSetupDialog::doConfigureInternal()
+{
+ this->Output->clear();
+ this->CacheValues->selectionModel()->clear();
+
+ QMetaObject::invokeMethod(this->CMakeThread->cmakeInstance(),
+ "setProperties", Qt::QueuedConnection,
+ Q_ARG(QCMakePropertyList,
+ this->CacheValues->cacheModel()->properties()));
+ QMetaObject::invokeMethod(this->CMakeThread->cmakeInstance(),
+ "configure", Qt::QueuedConnection);
+
+ int err = this->LocalLoop.exec();
if(err != 0)
{
@@ -362,23 +391,31 @@ void CMakeSetupDialog::finishConfigure(int err)
tr("Error in configuration process, project files may be invalid"),
QMessageBox::Ok);
}
+
+ return 0 == err;
}
-void CMakeSetupDialog::finishGenerate(int err)
+void CMakeSetupDialog::doInstallForCommandLine()
{
- this->enterState(ReadyConfigure);
+ QMacInstallDialog setupdialog(0);
+ setupdialog.exec();
+}
+
+bool CMakeSetupDialog::doGenerateInternal()
+{
+ QMetaObject::invokeMethod(this->CMakeThread->cmakeInstance(),
+ "generate", Qt::QueuedConnection);
+
+ int err = this->LocalLoop.exec();
+
if(err != 0)
{
QMessageBox::critical(this, tr("Error"),
tr("Error in generation process, project files may be invalid"),
QMessageBox::Ok);
}
-}
-void CMakeSetupDialog::doInstallForCommandLine()
-{
- QMacInstallDialog setupdialog(0);
- setupdialog.exec();
+ return 0 == err;
}
void CMakeSetupDialog::doGenerate()
@@ -389,9 +426,43 @@ void CMakeSetupDialog::doGenerate()
doInterrupt();
return;
}
+
+ // see if we need to configure
+ // we'll need to configure if:
+ // the configure step hasn't been done yet
+ // generate was the last step done
+ if(this->ConfigureNeeded)
+ {
+ if(!prepareConfigure())
+ {
+ return;
+ }
+ }
+
this->enterState(Generating);
- QMetaObject::invokeMethod(this->CMakeThread->cmakeInstance(),
- "generate", Qt::QueuedConnection);
+
+ bool config_passed = true;
+ if(this->ConfigureNeeded)
+ {
+ this->CacheValues->cacheModel()->setShowNewProperties(false);
+ this->ProgressFactor = 0.5;
+ config_passed = doConfigureInternal();
+ this->ProgressOffset = 0.5;
+ }
+
+ if(config_passed)
+ {
+ doGenerateInternal();
+ }
+
+ this->ProgressOffset = 0.0;
+ this->ProgressFactor = 1.0;
+ this->CacheValues->cacheModel()->setShowNewProperties(true);
+
+ this->enterState(ReadyConfigure);
+ this->ProgressBar->reset();
+
+ this->ConfigureNeeded = true;
}
void CMakeSetupDialog::closeEvent(QCloseEvent* e)
@@ -556,6 +627,7 @@ void CMakeSetupDialog::setSourceDirectory(const QString& dir)
void CMakeSetupDialog::showProgress(const QString& /*msg*/, float percent)
{
+ percent = (percent * ProgressFactor) + ProgressOffset;
this->ProgressBar->setValue(qRound(percent * 100));
}
@@ -897,7 +969,6 @@ void CMakeSetupDialog::enterState(CMakeSetupDialog::State s)
}
else if(s == Configuring)
{
- this->Output->clear();
this->setEnabledState(false);
this->GenerateButton->setEnabled(false);
this->GenerateAction->setEnabled(false);
@@ -913,17 +984,15 @@ void CMakeSetupDialog::enterState(CMakeSetupDialog::State s)
}
else if(s == ReadyConfigure)
{
- this->ProgressBar->reset();
this->setEnabledState(true);
- this->GenerateButton->setEnabled(false);
- this->GenerateAction->setEnabled(false);
+ this->GenerateButton->setEnabled(true);
+ this->GenerateAction->setEnabled(true);
this->ConfigureButton->setEnabled(true);
this->ConfigureButton->setText(tr("&Configure"));
this->GenerateButton->setText(tr("&Generate"));
}
else if(s == ReadyGenerate)
{
- this->ProgressBar->reset();
this->setEnabledState(true);
this->GenerateButton->setEnabled(true);
this->GenerateAction->setEnabled(true);
diff --git a/Source/QtDialog/CMakeSetupDialog.h b/Source/QtDialog/CMakeSetupDialog.h
index c4d029a..5121759 100644
--- a/Source/QtDialog/CMakeSetupDialog.h
+++ b/Source/QtDialog/CMakeSetupDialog.h
@@ -16,6 +16,7 @@
#include "QCMake.h"
#include <QMainWindow>
#include <QThread>
+#include <QEventLoop>
#include "ui_CMakeSetupDialog.h"
class QCMakeThread;
@@ -43,8 +44,6 @@ protected slots:
void doHelp();
void doAbout();
void doInterrupt();
- void finishConfigure(int error);
- void finishGenerate(int error);
void error(const QString& message);
void message(const QString& message);
@@ -74,6 +73,10 @@ protected slots:
void setGroupedView(bool);
void showUserChanges();
void setSearchFilter(const QString& str);
+ bool prepareConfigure();
+ bool doConfigureInternal();
+ bool doGenerateInternal();
+ void exitLoop(int);
protected:
@@ -87,6 +90,7 @@ protected:
QCMakeThread* CMakeThread;
bool ExitAfterGenerate;
bool CacheModified;
+ bool ConfigureNeeded;
QAction* ReloadCacheAction;
QAction* DeleteCacheAction;
QAction* ExitAction;
@@ -101,6 +105,10 @@ protected:
QTextCharFormat ErrorFormat;
QTextCharFormat MessageFormat;
+ QEventLoop LocalLoop;
+
+ float ProgressOffset;
+ float ProgressFactor;
};
// QCMake instance on a thread
diff --git a/Source/QtDialog/QCMakeCacheView.cxx b/Source/QtDialog/QCMakeCacheView.cxx
index d90307a..562396d 100644
--- a/Source/QtDialog/QCMakeCacheView.cxx
+++ b/Source/QtDialog/QCMakeCacheView.cxx
@@ -200,6 +200,7 @@ QCMakeCacheModel::QCMakeCacheModel(QObject* p)
NewPropertyCount(0),
View(FlatView)
{
+ this->ShowNewProperties = true;
QStringList labels;
labels << tr("Name") << tr("Value");
this->setHorizontalHeaderLabels(labels);
@@ -214,6 +215,11 @@ static uint qHash(const QCMakeProperty& p)
return qHash(p.Key);
}
+void QCMakeCacheModel::setShowNewProperties(bool f)
+{
+ this->ShowNewProperties = f;
+}
+
void QCMakeCacheModel::clear()
{
this->QStandardItemModel::clear();
@@ -226,13 +232,21 @@ void QCMakeCacheModel::clear()
void QCMakeCacheModel::setProperties(const QCMakePropertyList& props)
{
- QSet<QCMakeProperty> newProps = props.toSet();
- QSet<QCMakeProperty> newProps2 = newProps;
- QSet<QCMakeProperty> oldProps = this->properties().toSet();
-
- oldProps.intersect(newProps);
- newProps.subtract(oldProps);
- newProps2.subtract(newProps);
+ QSet<QCMakeProperty> newProps, newProps2;
+
+ if(this->ShowNewProperties)
+ {
+ newProps = props.toSet();
+ newProps2 = newProps;
+ QSet<QCMakeProperty> oldProps = this->properties().toSet();
+ oldProps.intersect(newProps);
+ newProps.subtract(oldProps);
+ newProps2.subtract(newProps);
+ }
+ else
+ {
+ newProps2 = props.toSet();
+ }
bool b = this->blockSignals(true);
diff --git a/Source/QtDialog/QCMakeCacheView.h b/Source/QtDialog/QCMakeCacheView.h
index 401e07e..58bbd2d 100644
--- a/Source/QtDialog/QCMakeCacheView.h
+++ b/Source/QtDialog/QCMakeCacheView.h
@@ -78,6 +78,9 @@ public slots:
// become new properties and be marked red.
void setProperties(const QCMakePropertyList& props);
+ // set whether to show new properties in red
+ void setShowNewProperties(bool);
+
// clear everything from the model
void clear();
@@ -115,6 +118,7 @@ public:
protected:
bool EditEnabled;
int NewPropertyCount;
+ bool ShowNewProperties;
ViewType View;
// set the data in the model for this property
diff --git a/Source/cmAddCustomCommandCommand.h b/Source/cmAddCustomCommandCommand.h
index 6c5e1af..490e043 100644
--- a/Source/cmAddCustomCommandCommand.h
+++ b/Source/cmAddCustomCommandCommand.h
@@ -13,6 +13,7 @@
#define cmAddCustomCommandCommand_h
#include "cmCommand.h"
+#include "cmDocumentGeneratorExpressions.h"
/** \class cmAddCustomCommandCommand
* \brief
@@ -146,8 +147,15 @@ public:
"target-level dependency will be added so that the executable target "
"will be built before any target using this custom command. However "
"this does NOT add a file-level dependency that would cause the "
- "custom command to re-run whenever the executable is recompiled.\n"
-
+ "custom command to re-run whenever the executable is recompiled."
+ "\n"
+ "Arguments to COMMAND may use \"generator expressions\" with the "
+ "syntax \"$<...>\". "
+ CM_DOCUMENT_COMMAND_GENERATOR_EXPRESSIONS
+ "References to target names in generator expressions imply "
+ "target-level dependencies, but NOT file-level dependencies. "
+ "List target names with the DEPENDS option to add file dependencies."
+ "\n"
"The DEPENDS option specifies files on which the command depends. "
"If any dependency is an OUTPUT of another custom command in the "
"same directory (CMakeLists.txt file) CMake automatically brings the "
diff --git a/Source/cmAddTestCommand.cxx b/Source/cmAddTestCommand.cxx
index 923206d..a9165f5 100644
--- a/Source/cmAddTestCommand.cxx
+++ b/Source/cmAddTestCommand.cxx
@@ -74,6 +74,7 @@ bool cmAddTestCommand::HandleNameMode(std::vector<std::string> const& args)
{
std::string name;
std::vector<std::string> configurations;
+ std::string working_directory;
std::vector<std::string> command;
// Read the arguments.
@@ -81,6 +82,7 @@ bool cmAddTestCommand::HandleNameMode(std::vector<std::string> const& args)
DoingName,
DoingCommand,
DoingConfigs,
+ DoingWorkingDirectory,
DoingNone
};
Doing doing = DoingName;
@@ -104,6 +106,15 @@ bool cmAddTestCommand::HandleNameMode(std::vector<std::string> const& args)
}
doing = DoingConfigs;
}
+ else if(args[i] == "WORKING_DIRECTORY")
+ {
+ if(!working_directory.empty())
+ {
+ this->SetError(" may be given at most one WORKING_DIRECTORY.");
+ return false;
+ }
+ doing = DoingWorkingDirectory;
+ }
else if(doing == DoingName)
{
name = args[i];
@@ -117,6 +128,11 @@ bool cmAddTestCommand::HandleNameMode(std::vector<std::string> const& args)
{
configurations.push_back(args[i]);
}
+ else if(doing == DoingWorkingDirectory)
+ {
+ working_directory = args[i];
+ doing = DoingNone;
+ }
else
{
cmOStringStream e;
@@ -154,6 +170,10 @@ bool cmAddTestCommand::HandleNameMode(std::vector<std::string> const& args)
cmTest* test = this->Makefile->CreateTest(name.c_str());
test->SetOldStyle(false);
test->SetCommand(command);
+ if(!working_directory.empty())
+ {
+ test->SetProperty("WORKING_DIRECTORY", working_directory.c_str());
+ }
this->Makefile->AddTestGenerator(new cmTestGenerator(test, configurations));
return true;
diff --git a/Source/cmAddTestCommand.h b/Source/cmAddTestCommand.h
index 79fb481..edaf12c 100644
--- a/Source/cmAddTestCommand.h
+++ b/Source/cmAddTestCommand.h
@@ -13,6 +13,7 @@
#define cmAddTestCommand_h
#include "cmCommand.h"
+#include "cmDocumentGeneratorExpressions.h"
/** \class cmAddTestCommand
* \brief Add a test to the lists of tests to run.
@@ -68,28 +69,19 @@ public:
"in the binary tree.\n"
"\n"
" add_test(NAME <name> [CONFIGURATIONS [Debug|Release|...]]\n"
+ " [WORKING_DIRECTORY dir]\n"
" COMMAND <command> [arg1 [arg2 ...]])\n"
"If COMMAND specifies an executable target (created by "
"add_executable) it will automatically be replaced by the location "
"of the executable created at build time. "
"If a CONFIGURATIONS option is given then the test will be executed "
- "only when testing under one of the named configurations."
+ "only when testing under one of the named configurations. "
+ "If a WORKING_DIRECTORY option is given then the test will be executed "
+ "in the given directory."
"\n"
"Arguments after COMMAND may use \"generator expressions\" with the "
"syntax \"$<...>\". "
- "These expressions are evaluted during build system generation and "
- "produce information specific to each generated build configuration. "
- "Valid expressions are:\n"
- " $<CONFIGURATION> = configuration name\n"
- " $<TARGET_FILE:tgt> = main file (.exe, .so.1.2, .a)\n"
- " $<TARGET_LINKER_FILE:tgt> = file used to link (.a, .lib, .so)\n"
- " $<TARGET_SONAME_FILE:tgt> = file with soname (.so.3)\n"
- "where \"tgt\" is the name of a target. "
- "Target file expressions produce a full path, but _DIR and _NAME "
- "versions can produce the directory and file name components:\n"
- " $<TARGET_FILE_DIR:tgt>/$<TARGET_FILE_NAME:tgt>\n"
- " $<TARGET_LINKER_FILE_DIR:tgt>/$<TARGET_LINKER_FILE_NAME:tgt>\n"
- " $<TARGET_SONAME_FILE_DIR:tgt>/$<TARGET_SONAME_FILE_NAME:tgt>\n"
+ CM_DOCUMENT_COMMAND_GENERATOR_EXPRESSIONS
"Example usage:\n"
" add_test(NAME mytest\n"
" COMMAND testDriver --config $<CONFIGURATION>\n"
diff --git a/Source/cmBootstrapCommands.cxx b/Source/cmBootstrapCommands.cxx
index db01688..554f452 100644
--- a/Source/cmBootstrapCommands.cxx
+++ b/Source/cmBootstrapCommands.cxx
@@ -32,6 +32,7 @@
#include "cmCreateTestSourceList.cxx"
#include "cmDefinePropertyCommand.cxx"
#include "cmElseCommand.cxx"
+#include "cmEnableLanguageCommand.cxx"
#include "cmEnableTestingCommand.cxx"
#include "cmEndForEachCommand.cxx"
#include "cmEndFunctionCommand.cxx"
@@ -109,6 +110,7 @@ void GetBootstrapCommands(std::list<cmCommand*>& commands)
commands.push_back(new cmCreateTestSourceList);
commands.push_back(new cmDefinePropertyCommand);
commands.push_back(new cmElseCommand);
+ commands.push_back(new cmEnableLanguageCommand);
commands.push_back(new cmEnableTestingCommand);
commands.push_back(new cmEndForEachCommand);
commands.push_back(new cmEndFunctionCommand);
diff --git a/Source/cmCMakePolicyCommand.h b/Source/cmCMakePolicyCommand.h
index b326865..afd3001 100644
--- a/Source/cmCMakePolicyCommand.h
+++ b/Source/cmCMakePolicyCommand.h
@@ -85,7 +85,8 @@ public:
"given version of CMake. "
"All policies introduced in the specified version or earlier "
"will be set to use NEW behavior. "
- "All policies introduced after the specified version will be unset. "
+ "All policies introduced after the specified version will be unset "
+ "(unless variable CMAKE_POLICY_DEFAULT_CMP<NNNN> sets a default). "
"This effectively requests behavior preferred as of a given CMake "
"version and tells newer CMake versions to warn about their new "
"policies. "
diff --git a/Source/cmCommands.cxx b/Source/cmCommands.cxx
index 1950871..bb1e4e2 100644
--- a/Source/cmCommands.cxx
+++ b/Source/cmCommands.cxx
@@ -14,7 +14,6 @@
#include "cmAuxSourceDirectoryCommand.cxx"
#include "cmBuildNameCommand.cxx"
#include "cmElseIfCommand.cxx"
-#include "cmEnableLanguageCommand.cxx"
#include "cmEndWhileCommand.cxx"
#include "cmExportCommand.cxx"
#include "cmExportLibraryDependencies.cxx"
@@ -54,7 +53,6 @@ void GetPredefinedCommands(std::list<cmCommand*>&
commands.push_back(new cmAuxSourceDirectoryCommand);
commands.push_back(new cmBuildNameCommand);
commands.push_back(new cmElseIfCommand);
- commands.push_back(new cmEnableLanguageCommand);
commands.push_back(new cmEndWhileCommand);
commands.push_back(new cmExportCommand);
commands.push_back(new cmExportLibraryDependenciesCommand);
diff --git a/Source/cmCoreTryCompile.cxx b/Source/cmCoreTryCompile.cxx
index 75f9824..96a214e 100644
--- a/Source/cmCoreTryCompile.cxx
+++ b/Source/cmCoreTryCompile.cxx
@@ -1,6 +1,6 @@
/*============================================================================
CMake - Cross Platform Makefile Generator
- Copyright 2000-2009 Kitware, Inc., Insight Software Consortium
+ Copyright 2000-2011 Kitware, Inc., Insight Software Consortium
Distributed under the OSI-approved BSD License (the "License");
see accompanying file Copyright.txt for details.
@@ -56,7 +56,7 @@ int cmCoreTryCompile::TryCompileCode(std::vector<std::string> const& argv)
{
if ( argv.size() <= (i+1) )
{
- cmSystemTools::Error(
+ this->Makefile->IssueMessage(cmake::FATAL_ERROR,
"OUTPUT_VARIABLE specified but there is no variable");
return -1;
}
@@ -92,7 +92,7 @@ int cmCoreTryCompile::TryCompileCode(std::vector<std::string> const& argv)
{
if ( argv.size() <= (i+1) )
{
- cmSystemTools::Error(
+ this->Makefile->IssueMessage(cmake::FATAL_ERROR,
"COPY_FILE specified but there is no variable");
return -1;
}
@@ -120,13 +120,14 @@ int cmCoreTryCompile::TryCompileCode(std::vector<std::string> const& argv)
// only valid for srcfile signatures
if (compileFlags.size())
{
- cmSystemTools::Error(
+ this->Makefile->IssueMessage(cmake::FATAL_ERROR,
"COMPILE_FLAGS specified on a srcdir type TRY_COMPILE");
return -1;
}
if (copyFile.size())
{
- cmSystemTools::Error("COPY_FILE specified on a srcdir type TRY_COMPILE");
+ this->Makefile->IssueMessage(cmake::FATAL_ERROR,
+ "COPY_FILE specified on a srcdir type TRY_COMPILE");
return -1;
}
}
@@ -136,9 +137,10 @@ int cmCoreTryCompile::TryCompileCode(std::vector<std::string> const& argv)
// do not allow recursive try Compiles
if (this->BinaryDirectory == this->Makefile->GetHomeOutputDirectory())
{
- cmSystemTools::Error(
- "Attempt at a recursive or nested TRY_COMPILE in directory ",
- this->BinaryDirectory.c_str());
+ cmOStringStream e;
+ e << "Attempt at a recursive or nested TRY_COMPILE in directory\n"
+ << " " << this->BinaryDirectory << "\n";
+ this->Makefile->IssueMessage(cmake::FATAL_ERROR, e.str());
return -1;
}
@@ -158,14 +160,16 @@ int cmCoreTryCompile::TryCompileCode(std::vector<std::string> const& argv)
FILE *fout = fopen(outFileName.c_str(),"w");
if (!fout)
{
- cmSystemTools::Error("Failed to create CMakeList file for ",
- outFileName.c_str());
- cmSystemTools::ReportLastSystemError("");
+ cmOStringStream e;
+ e << "Failed to open\n"
+ << " " << outFileName.c_str() << "\n"
+ << cmSystemTools::GetLastSystemError();
+ this->Makefile->IssueMessage(cmake::FATAL_ERROR, e.str());
return -1;
}
std::string source = argv[2];
- std::string ext = cmSystemTools::GetFilenameExtension(source);
+ std::string ext = cmSystemTools::GetFilenameLastExtension(source);
const char* lang =(this->Makefile->GetCMakeInstance()->GetGlobalGenerator()
->GetLanguageFromExtension(ext.c_str()));
const char* def = this->Makefile->GetDefinition("CMAKE_MODULE_PATH");
@@ -199,10 +203,12 @@ int cmCoreTryCompile::TryCompileCode(std::vector<std::string> const& argv)
}
else
{
+ fclose(fout);
cmOStringStream err;
- err << "Unknown extension \"" << ext << "\" for file \""
- << source << "\". TRY_COMPILE only works for enabled languages.\n"
- << "Currently enabled languages are:";
+ err << "Unknown extension \"" << ext << "\" for file\n"
+ << " " << source << "\n"
+ << "try_compile() works only for enabled languages. "
+ << "Currently these are:\n ";
std::vector<std::string> langs;
this->Makefile->GetCMakeInstance()->GetGlobalGenerator()->
GetEnabledLanguages(langs);
@@ -211,9 +217,8 @@ int cmCoreTryCompile::TryCompileCode(std::vector<std::string> const& argv)
{
err << " " << *l;
}
- err << "\nSee PROJECT command for help enabling other languages.";
- cmSystemTools::Error(err.str().c_str());
- fclose(fout);
+ err << "\nSee project() command to enable other languages.";
+ this->Makefile->IssueMessage(cmake::FATAL_ERROR, err.str());
return -1;
}
std::string langFlags = "CMAKE_";
@@ -276,6 +281,10 @@ int cmCoreTryCompile::TryCompileCode(std::vector<std::string> const& argv)
cmakeFlags.push_back(flag);
}
+ /* Put the executable at a known location (for COPY_FILE). */
+ fprintf(fout, "SET(CMAKE_RUNTIME_OUTPUT_DIRECTORY \"%s\")\n",
+ this->BinaryDirectory.c_str());
+ /* Create the actual executable. */
fprintf(fout, "ADD_EXECUTABLE(cmTryCompileExec \"%s\")\n",source.c_str());
fprintf(fout,
"TARGET_LINK_LIBRARIES(cmTryCompileExec ${LINK_LIBRARIES})\n");
@@ -338,17 +347,15 @@ int cmCoreTryCompile::TryCompileCode(std::vector<std::string> const& argv)
copyFile.c_str()))
{
cmOStringStream emsg;
- emsg << "Could not COPY_FILE.\n"
- << " OutputFile: '" << this->OutputFile.c_str() << "'\n"
- << " copyFile: '" << copyFile.c_str() << "'\n";
-
- if (this->FindErrorMessage.size())
+ emsg << "Cannot copy output executable\n"
+ << " '" << this->OutputFile.c_str() << "'\n"
+ << "to destination specified by COPY_FILE:\n"
+ << " '" << copyFile.c_str() << "'\n";
+ if(!this->FindErrorMessage.empty())
{
- emsg << "\n";
- emsg << this->FindErrorMessage.c_str() << "\n";
+ emsg << this->FindErrorMessage.c_str();
}
-
- cmSystemTools::Error(emsg.str().c_str());
+ this->Makefile->IssueMessage(cmake::FATAL_ERROR, emsg.str());
return -1;
}
}
@@ -455,18 +462,11 @@ void cmCoreTryCompile::FindOutputFile(const char* targetName)
}
cmOStringStream emsg;
- emsg << "Unable to find executable for " << this->GetName() << ": tried \"";
+ emsg << "Unable to find the executable at any of:\n";
for (unsigned int i = 0; i < searchDirs.size(); ++i)
{
- emsg << this->BinaryDirectory << searchDirs[i] << tmpOutputFile;
- if (i < searchDirs.size() - 1)
- {
- emsg << "\" and \"";
- }
- else
- {
- emsg << "\".";
- }
+ emsg << " " << this->BinaryDirectory << searchDirs[i]
+ << tmpOutputFile << "\n";
}
this->FindErrorMessage = emsg.str();
return;
diff --git a/Source/cmCustomCommand.cxx b/Source/cmCustomCommand.cxx
index 5db88fa..bd860ee 100644
--- a/Source/cmCustomCommand.cxx
+++ b/Source/cmCustomCommand.cxx
@@ -11,6 +11,8 @@
============================================================================*/
#include "cmCustomCommand.h"
+#include "cmMakefile.h"
+
//----------------------------------------------------------------------------
cmCustomCommand::cmCustomCommand()
{
@@ -28,12 +30,14 @@ cmCustomCommand::cmCustomCommand(const cmCustomCommand& r):
Comment(r.Comment),
WorkingDirectory(r.WorkingDirectory),
EscapeAllowMakeVars(r.EscapeAllowMakeVars),
- EscapeOldStyle(r.EscapeOldStyle)
+ EscapeOldStyle(r.EscapeOldStyle),
+ Backtrace(new cmListFileBacktrace(*r.Backtrace))
{
}
//----------------------------------------------------------------------------
-cmCustomCommand::cmCustomCommand(const std::vector<std::string>& outputs,
+cmCustomCommand::cmCustomCommand(cmMakefile* mf,
+ const std::vector<std::string>& outputs,
const std::vector<std::string>& depends,
const cmCustomCommandLines& commandLines,
const char* comment,
@@ -45,10 +49,21 @@ cmCustomCommand::cmCustomCommand(const std::vector<std::string>& outputs,
Comment(comment?comment:""),
WorkingDirectory(workingDirectory?workingDirectory:""),
EscapeAllowMakeVars(false),
- EscapeOldStyle(true)
+ EscapeOldStyle(true),
+ Backtrace(new cmListFileBacktrace)
{
this->EscapeOldStyle = true;
this->EscapeAllowMakeVars = false;
+ if(mf)
+ {
+ mf->GetBacktrace(*this->Backtrace);
+ }
+}
+
+//----------------------------------------------------------------------------
+cmCustomCommand::~cmCustomCommand()
+{
+ delete this->Backtrace;
}
//----------------------------------------------------------------------------
@@ -131,6 +146,12 @@ void cmCustomCommand::SetEscapeAllowMakeVars(bool b)
}
//----------------------------------------------------------------------------
+cmListFileBacktrace const& cmCustomCommand::GetBacktrace() const
+{
+ return *this->Backtrace;
+}
+
+//----------------------------------------------------------------------------
cmCustomCommand::ImplicitDependsList const&
cmCustomCommand::GetImplicitDepends() const
{
diff --git a/Source/cmCustomCommand.h b/Source/cmCustomCommand.h
index c9adddf..dd92e34 100644
--- a/Source/cmCustomCommand.h
+++ b/Source/cmCustomCommand.h
@@ -13,6 +13,8 @@
#define cmCustomCommand_h
#include "cmStandardIncludes.h"
+class cmMakefile;
+class cmListFileBacktrace;
/** \class cmCustomCommand
* \brief A class to encapsulate a custom command
@@ -27,12 +29,15 @@ public:
cmCustomCommand(const cmCustomCommand& r);
/** Main constructor specifies all information for the command. */
- cmCustomCommand(const std::vector<std::string>& outputs,
+ cmCustomCommand(cmMakefile* mf,
+ const std::vector<std::string>& outputs,
const std::vector<std::string>& depends,
const cmCustomCommandLines& commandLines,
const char* comment,
const char* workingDirectory);
+ ~cmCustomCommand();
+
/** Get the output file produced by the command. */
const std::vector<std::string>& GetOutputs() const;
@@ -63,6 +68,9 @@ public:
bool GetEscapeAllowMakeVars() const;
void SetEscapeAllowMakeVars(bool b);
+ /** Backtrace of the command that created this custom command. */
+ cmListFileBacktrace const& GetBacktrace() const;
+
typedef std::pair<cmStdString, cmStdString> ImplicitDependsPair;
class ImplicitDependsList: public std::vector<ImplicitDependsPair> {};
void SetImplicitDepends(ImplicitDependsList const&);
@@ -78,6 +86,7 @@ private:
std::string WorkingDirectory;
bool EscapeAllowMakeVars;
bool EscapeOldStyle;
+ cmListFileBacktrace* Backtrace;
ImplicitDependsList ImplicitDepends;
};
diff --git a/Source/cmCustomCommandGenerator.cxx b/Source/cmCustomCommandGenerator.cxx
new file mode 100644
index 0000000..a650129
--- /dev/null
+++ b/Source/cmCustomCommandGenerator.cxx
@@ -0,0 +1,72 @@
+/*============================================================================
+ CMake - Cross Platform Makefile Generator
+ Copyright 2000-2010 Kitware, Inc., Insight Software Consortium
+
+ Distributed under the OSI-approved BSD License (the "License");
+ see accompanying file Copyright.txt for details.
+
+ This software is distributed WITHOUT ANY WARRANTY; without even the
+ implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ See the License for more information.
+============================================================================*/
+#include "cmCustomCommandGenerator.h"
+
+#include "cmMakefile.h"
+#include "cmCustomCommand.h"
+#include "cmLocalGenerator.h"
+#include "cmGeneratorExpression.h"
+
+//----------------------------------------------------------------------------
+cmCustomCommandGenerator::cmCustomCommandGenerator(
+ cmCustomCommand const& cc, const char* config, cmMakefile* mf):
+ CC(cc), Config(config), Makefile(mf), LG(mf->GetLocalGenerator()),
+ OldStyle(cc.GetEscapeOldStyle()), MakeVars(cc.GetEscapeAllowMakeVars()),
+ GE(new cmGeneratorExpression(mf, config, cc.GetBacktrace()))
+{
+}
+
+//----------------------------------------------------------------------------
+cmCustomCommandGenerator::~cmCustomCommandGenerator()
+{
+ delete this->GE;
+}
+
+//----------------------------------------------------------------------------
+unsigned int cmCustomCommandGenerator::GetNumberOfCommands() const
+{
+ return static_cast<unsigned int>(this->CC.GetCommandLines().size());
+}
+
+//----------------------------------------------------------------------------
+std::string cmCustomCommandGenerator::GetCommand(unsigned int c) const
+{
+ std::string const& argv0 = this->CC.GetCommandLines()[c][0];
+ cmTarget* target = this->Makefile->FindTargetToUse(argv0.c_str());
+ if(target && target->GetType() == cmTarget::EXECUTABLE &&
+ (target->IsImported() || !this->Makefile->IsOn("CMAKE_CROSSCOMPILING")))
+ {
+ return target->GetLocation(this->Config);
+ }
+ return this->GE->Process(argv0);
+}
+
+//----------------------------------------------------------------------------
+void
+cmCustomCommandGenerator
+::AppendArguments(unsigned int c, std::string& cmd) const
+{
+ cmCustomCommandLine const& commandLine = this->CC.GetCommandLines()[c];
+ for(unsigned int j=1;j < commandLine.size(); ++j)
+ {
+ std::string arg = this->GE->Process(commandLine[j]);
+ cmd += " ";
+ if(this->OldStyle)
+ {
+ cmd += this->LG->EscapeForShellOldStyle(arg.c_str());
+ }
+ else
+ {
+ cmd += this->LG->EscapeForShell(arg.c_str(), this->MakeVars);
+ }
+ }
+}
diff --git a/Source/cmCustomCommandGenerator.h b/Source/cmCustomCommandGenerator.h
new file mode 100644
index 0000000..4e89f27
--- /dev/null
+++ b/Source/cmCustomCommandGenerator.h
@@ -0,0 +1,40 @@
+/*============================================================================
+ CMake - Cross Platform Makefile Generator
+ Copyright 2000-2010 Kitware, Inc., Insight Software Consortium
+
+ Distributed under the OSI-approved BSD License (the "License");
+ see accompanying file Copyright.txt for details.
+
+ This software is distributed WITHOUT ANY WARRANTY; without even the
+ implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ See the License for more information.
+============================================================================*/
+#ifndef cmCustomCommandGenerator_h
+#define cmCustomCommandGenerator_h
+
+#include "cmStandardIncludes.h"
+
+class cmCustomCommand;
+class cmMakefile;
+class cmLocalGenerator;
+class cmGeneratorExpression;
+
+class cmCustomCommandGenerator
+{
+ cmCustomCommand const& CC;
+ const char* Config;
+ cmMakefile* Makefile;
+ cmLocalGenerator* LG;
+ bool OldStyle;
+ bool MakeVars;
+ cmGeneratorExpression* GE;
+public:
+ cmCustomCommandGenerator(cmCustomCommand const& cc, const char* config,
+ cmMakefile* mf);
+ ~cmCustomCommandGenerator();
+ unsigned int GetNumberOfCommands() const;
+ std::string GetCommand(unsigned int c) const;
+ void AppendArguments(unsigned int c, std::string& cmd) const;
+};
+
+#endif
diff --git a/Source/cmDepends.cxx b/Source/cmDepends.cxx
index 69ff858..19558fa 100644
--- a/Source/cmDepends.cxx
+++ b/Source/cmDepends.cxx
@@ -25,7 +25,7 @@ cmDepends::cmDepends(cmLocalGenerator* lg, const char* targetDir):
Verbose(false),
FileComparison(0),
TargetDirectory(targetDir),
- MaxPath(cmSystemTools::GetMaximumFilePathLength()),
+ MaxPath(16384),
Dependee(new char[MaxPath]),
Depender(new char[MaxPath])
{
diff --git a/Source/cmDependsC.cxx b/Source/cmDependsC.cxx
index 942cb3f..a76b3af 100644
--- a/Source/cmDependsC.cxx
+++ b/Source/cmDependsC.cxx
@@ -448,6 +448,7 @@ void cmDependsC::Scan(std::istream& is, const char* directory,
// Get the file being included.
UnscannedEntry entry;
entry.FileName = this->IncludeRegexLine.match(2);
+ cmSystemTools::ConvertToUnixSlashes(entry.FileName);
if(this->IncludeRegexLine.match(3) == "\"" &&
!cmSystemTools::FileIsFullPath(entry.FileName.c_str()))
{
diff --git a/Source/cmDocumentCompileDefinitions.h b/Source/cmDocumentCompileDefinitions.h
new file mode 100644
index 0000000..ef3b3e7
--- /dev/null
+++ b/Source/cmDocumentCompileDefinitions.h
@@ -0,0 +1,34 @@
+/*============================================================================
+ CMake - Cross Platform Makefile Generator
+ Copyright 2000-2011 Kitware, Inc., Insight Software Consortium
+
+ Distributed under the OSI-approved BSD License (the "License");
+ see accompanying file Copyright.txt for details.
+
+ This software is distributed WITHOUT ANY WARRANTY; without even the
+ implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ See the License for more information.
+============================================================================*/
+#ifndef cmDocumentCompileDefinitions_h
+#define cmDocumentCompileDefinitions_h
+
+#define CM_DOCUMENT_COMPILE_DEFINITIONS_DISCLAIMER \
+ "Disclaimer: Most native build tools have poor support for escaping " \
+ "certain values. CMake has work-arounds for many cases but some " \
+ "values may just not be possible to pass correctly. If a value " \
+ "does not seem to be escaped correctly, do not attempt to " \
+ "work-around the problem by adding escape sequences to the value. " \
+ "Your work-around may break in a future version of CMake that " \
+ "has improved escape support. Instead consider defining the macro " \
+ "in a (configured) header file. Then report the limitation. " \
+ "Known limitations include:\n" \
+ " # - broken almost everywhere\n" \
+ " ; - broken in VS IDE and Borland Makefiles\n" \
+ " , - broken in VS IDE\n" \
+ " % - broken in some cases in NMake\n" \
+ " & | - broken in some cases on MinGW\n" \
+ " ^ < > \\\" - broken in most Make tools on Windows\n" \
+ "CMake does not reject these values outright because they do work " \
+ "in some cases. Use with caution. "
+
+#endif
diff --git a/Source/cmDocumentGeneratorExpressions.h b/Source/cmDocumentGeneratorExpressions.h
new file mode 100644
index 0000000..5359013
--- /dev/null
+++ b/Source/cmDocumentGeneratorExpressions.h
@@ -0,0 +1,30 @@
+/*============================================================================
+ CMake - Cross Platform Makefile Generator
+ Copyright 2000-2010 Kitware, Inc., Insight Software Consortium
+
+ Distributed under the OSI-approved BSD License (the "License");
+ see accompanying file Copyright.txt for details.
+
+ This software is distributed WITHOUT ANY WARRANTY; without even the
+ implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ See the License for more information.
+============================================================================*/
+#ifndef cmDocumentGeneratorExpressions_h
+#define cmDocumentGeneratorExpressions_h
+
+#define CM_DOCUMENT_COMMAND_GENERATOR_EXPRESSIONS \
+ "Generator expressions are evaluted during build system generation " \
+ "to produce information specific to each build configuration. " \
+ "Valid expressions are:\n" \
+ " $<CONFIGURATION> = configuration name\n" \
+ " $<TARGET_FILE:tgt> = main file (.exe, .so.1.2, .a)\n" \
+ " $<TARGET_LINKER_FILE:tgt> = file used to link (.a, .lib, .so)\n" \
+ " $<TARGET_SONAME_FILE:tgt> = file with soname (.so.3)\n" \
+ "where \"tgt\" is the name of a target. " \
+ "Target file expressions produce a full path, but _DIR and _NAME " \
+ "versions can produce the directory and file name components:\n" \
+ " $<TARGET_FILE_DIR:tgt>/$<TARGET_FILE_NAME:tgt>\n" \
+ " $<TARGET_LINKER_FILE_DIR:tgt>/$<TARGET_LINKER_FILE_NAME:tgt>\n" \
+ " $<TARGET_SONAME_FILE_DIR:tgt>/$<TARGET_SONAME_FILE_NAME:tgt>\n"
+
+#endif
diff --git a/Source/cmDocumentVariables.cxx b/Source/cmDocumentVariables.cxx
index a69bb8f..6fffecb 100644
--- a/Source/cmDocumentVariables.cxx
+++ b/Source/cmDocumentVariables.cxx
@@ -464,6 +464,25 @@ void cmDocumentVariables::DefineVariables(cmake* cm)
// Variables defined by cmake, that change the behavior
// of cmake
+
+ cm->DefineProperty
+ ("CMAKE_POLICY_DEFAULT_CMP<NNNN>", cmProperty::VARIABLE,
+ "Default for CMake Policy CMP<NNNN> when it is otherwise left unset.",
+ "Commands cmake_minimum_required(VERSION) and cmake_policy(VERSION) "
+ "by default leave policies introduced after the given version unset. "
+ "Set CMAKE_POLICY_DEFAULT_CMP<NNNN> to OLD or NEW to specify the "
+ "default for policy CMP<NNNN>, where <NNNN> is the policy number."
+ "\n"
+ "This variable should not be set by a project in CMake code; "
+ "use cmake_policy(SET) instead. "
+ "Users running CMake may set this variable in the cache "
+ "(e.g. -DCMAKE_POLICY_DEFAULT_CMP<NNNN>=<OLD|NEW>) "
+ "to set a policy not otherwise set by the project. "
+ "Set to OLD to quiet a policy warning while using old behavior "
+ "or to NEW to try building the project with new behavior.",
+ false,
+ "Variables That Change Behavior");
+
cm->DefineProperty
("CMAKE_FIND_LIBRARY_PREFIXES", cmProperty::VARIABLE,
"Prefixes to prepend when looking for libraries.",
@@ -677,13 +696,29 @@ void cmDocumentVariables::DefineVariables(cmake* cm)
cm->DefineProperty
("CMAKE_USER_MAKE_RULES_OVERRIDE", cmProperty::VARIABLE,
- "Specify a file that can change the build rule variables.",
- "If this variable is set, it should to point to a "
- "CMakeLists.txt file that will be read in by CMake "
- "after all the system settings have been set, but "
- "before they have been used. This would allow you "
- "to override any variables that need to be changed "
- "for some special project. ",false,
+ "Specify a CMake file that overrides platform information.",
+ "CMake loads the specified file while enabling support for each "
+ "language from either the project() or enable_language() commands. "
+ "It is loaded after CMake's builtin compiler and platform information "
+ "modules have been loaded but before the information is used. "
+ "The file may set platform information variables to override CMake's "
+ "defaults."
+ "\n"
+ "This feature is intended for use only in overriding information "
+ "variables that must be set before CMake builds its first test "
+ "project to check that the compiler for a language works. "
+ "It should not be used to load a file in cases that a normal include() "
+ "will work. "
+ "Use it only as a last resort for behavior that cannot be achieved "
+ "any other way. "
+ "For example, one may set CMAKE_C_FLAGS_INIT to change the default "
+ "value used to initialize CMAKE_C_FLAGS before it is cached. "
+ "The override file should NOT be used to set anything that could "
+ "be set after languages are enabled, such as variables like "
+ "CMAKE_RUNTIME_OUTPUT_DIRECTORY that affect the placement of binaries. "
+ "Information set in the file will be used for try_compile and try_run "
+ "builds too."
+ ,false,
"Variables That Change Behavior");
cm->DefineProperty
@@ -1102,6 +1137,14 @@ void cmDocumentVariables::DefineVariables(cmake* cm)
"this variable for a target if they are set. "
"Library targets are otherwise placed in this directory.",false,
"Variables that Control the Build");
+ cm->DefineProperty
+ ("CMAKE_TRY_COMPILE_CONFIGURATION", cmProperty::VARIABLE,
+ "Build configuration used for try_compile and try_run projects.",
+ "Projects built by try_compile and try_run are built "
+ "synchronously during the CMake configuration step. "
+ "Therefore a specific build configuration must be chosen even "
+ "if the generated build system supports multiple configurations.",false,
+ "Variables that Control the Build");
// Variables defined when the a language is enabled These variables will
@@ -1111,13 +1154,10 @@ void cmDocumentVariables::DefineVariables(cmake* cm)
cm->DefineProperty
("CMAKE_USER_MAKE_RULES_OVERRIDE_<LANG>", cmProperty::VARIABLE,
- "Specify a file that can change the build rule variables.",
- "If this variable is set, it should to point to a "
- "CMakeLists.txt file that will be read in by CMake "
- "after all the system settings have been set, but "
- "before they have been used. This would allow you "
- "to override any variables that need to be changed "
- "for some language. ",false,
+ "Specify a CMake file that overrides platform information for <LANG>.",
+ "This is a language-specific version of "
+ "CMAKE_USER_MAKE_RULES_OVERRIDE loaded only when enabling "
+ "language <LANG>.",false,
"Variables for Languages");
cm->DefineProperty
diff --git a/Source/cmExtraEclipseCDT4Generator.cxx b/Source/cmExtraEclipseCDT4Generator.cxx
index 502fefa..0ef771f 100644
--- a/Source/cmExtraEclipseCDT4Generator.cxx
+++ b/Source/cmExtraEclipseCDT4Generator.cxx
@@ -201,7 +201,7 @@ void cmExtraEclipseCDT4Generator::CreateProjectFile()
"<projectDescription>\n"
"\t<name>" <<
this->GenerateProjectName(mf->GetProjectName(),
- mf->GetDefinition("CMAKE_BUILD_TYPE"),
+ mf->GetSafeDefinition("CMAKE_BUILD_TYPE"),
this->GetPathBasename(this->HomeOutputDirectory))
<< "</name>\n"
"\t<comment></comment>\n"
diff --git a/Source/cmFileCommand.h b/Source/cmFileCommand.h
index e771092..b11dcde 100644
--- a/Source/cmFileCommand.h
+++ b/Source/cmFileCommand.h
@@ -116,7 +116,12 @@ public:
"expressions and store it into the variable. Globbing expressions "
"are similar to regular expressions, but much simpler. If RELATIVE "
"flag is specified for an expression, the results will be returned "
- "as a relative path to the given path.\n"
+ "as a relative path to the given path. "
+ "(We do not recommend using GLOB to collect a list of source files "
+ "from your source tree. If no CMakeLists.txt file changes when a "
+ "source is added or removed then the generated build system cannot "
+ "know when to ask CMake to regenerate.)"
+ "\n"
"Examples of globbing expressions include:\n"
" *.cxx - match all files with extension cxx\n"
" *.vt? - match all files with extension vta,...,vtz\n"
diff --git a/Source/cmGeneratorExpression.cxx b/Source/cmGeneratorExpression.cxx
index a61880f..8710dfc 100644
--- a/Source/cmGeneratorExpression.cxx
+++ b/Source/cmGeneratorExpression.cxx
@@ -17,8 +17,8 @@
//----------------------------------------------------------------------------
cmGeneratorExpression::cmGeneratorExpression(
cmMakefile* mf, const char* config,
- cmListFileBacktrace const& backtrace):
- Makefile(mf), Config(config), Backtrace(backtrace)
+ cmListFileBacktrace const& backtrace, bool quiet):
+ Makefile(mf), Config(config), Backtrace(backtrace), Quiet(quiet)
{
this->TargetInfo.compile("^\\$<TARGET"
"(|_SONAME|_LINKER)" // File with what purpose?
@@ -87,7 +87,7 @@ bool cmGeneratorExpression::Evaluate()
this->Data.insert(this->Data.end(), result.begin(), result.end());
return true;
}
- else
+ else if(!this->Quiet)
{
// Failure. Report the error message.
cmOStringStream e;
@@ -99,6 +99,7 @@ bool cmGeneratorExpression::Evaluate()
this->Backtrace);
return false;
}
+ return true;
}
//----------------------------------------------------------------------------
@@ -140,6 +141,7 @@ bool cmGeneratorExpression::EvaluateTargetInfo(std::string& result)
result = "Target \"" + name + "\" is not an executable or library.";
return false;
}
+ this->Targets.insert(target);
// Lookup the target file with the given purpose.
std::string purpose = this->TargetInfo.match(1);
diff --git a/Source/cmGeneratorExpression.h b/Source/cmGeneratorExpression.h
index aa36055..1a9d4c6 100644
--- a/Source/cmGeneratorExpression.h
+++ b/Source/cmGeneratorExpression.h
@@ -15,6 +15,7 @@
#include <cmsys/RegularExpression.hxx>
+class cmTarget;
class cmMakefile;
class cmListFileBacktrace;
@@ -32,18 +33,25 @@ class cmGeneratorExpression
public:
/** Construct with an evaluation context and configuration. */
cmGeneratorExpression(cmMakefile* mf, const char* config,
- cmListFileBacktrace const& backtrace);
+ cmListFileBacktrace const& backtrace,
+ bool quiet = false);
/** Evaluate generator expressions in a string. */
const char* Process(std::string const& input);
const char* Process(const char* input);
+
+ /** Get set of targets found during evaluations. */
+ std::set<cmTarget*> const& GetTargets() const
+ { return this->Targets; }
private:
cmMakefile* Makefile;
const char* Config;
cmListFileBacktrace const& Backtrace;
+ bool Quiet;
std::vector<char> Data;
std::stack<size_t> Barriers;
cmsys::RegularExpression TargetInfo;
+ std::set<cmTarget*> Targets;
bool Evaluate();
bool Evaluate(const char* expr, std::string& result);
bool EvaluateTargetInfo(std::string& result);
diff --git a/Source/cmGetCMakePropertyCommand.h b/Source/cmGetCMakePropertyCommand.h
index c78671e..d82be70 100644
--- a/Source/cmGetCMakePropertyCommand.h
+++ b/Source/cmGetCMakePropertyCommand.h
@@ -54,11 +54,14 @@ public:
{
return
" get_cmake_property(VAR property)\n"
- "Get a property from the CMake instance. The value of the "
- "property is stored in the variable VAR. If the property is "
- "not found, CMake will report an error. Some supported properties "
+ "Get a property from the CMake instance. "
+ "The value of the property is stored in the variable VAR. "
+ "If the property is not found, VAR will be set to \"NOTFOUND\". "
+ "Some supported properties "
"include: VARIABLES, CACHE_VARIABLES, COMMANDS, MACROS, and "
- "COMPONENTS.";
+ "COMPONENTS."
+ "\n"
+ "See also the more general get_property() command.";
}
cmTypeMacro(cmGetCMakePropertyCommand, cmCommand);
diff --git a/Source/cmGetDirectoryPropertyCommand.h b/Source/cmGetDirectoryPropertyCommand.h
index c3a23a3..b7a5f71 100644
--- a/Source/cmGetDirectoryPropertyCommand.h
+++ b/Source/cmGetDirectoryPropertyCommand.h
@@ -66,7 +66,8 @@ public:
"Get a variable definition from a directory. "
"This form is useful to get a variable definition from another "
"directory."
- ;
+ "\n"
+ "See also the more general get_property() command.";
}
cmTypeMacro(cmGetDirectoryPropertyCommand, cmCommand);
diff --git a/Source/cmGetSourceFilePropertyCommand.h b/Source/cmGetSourceFilePropertyCommand.h
index c1d5e11..56469f8 100644
--- a/Source/cmGetSourceFilePropertyCommand.h
+++ b/Source/cmGetSourceFilePropertyCommand.h
@@ -53,7 +53,9 @@ public:
"stored in the variable VAR. If the property is not found, VAR "
"will be set to \"NOTFOUND\". Use set_source_files_properties to set "
"property values. Source file properties usually control how the "
- "file is built. One property that is always there is LOCATION";
+ "file is built. One property that is always there is LOCATION"
+ "\n"
+ "See also the more general get_property() command.";
}
cmTypeMacro(cmGetSourceFilePropertyCommand, cmCommand);
diff --git a/Source/cmGetTargetPropertyCommand.h b/Source/cmGetTargetPropertyCommand.h
index e1984c3..71c75ef 100644
--- a/Source/cmGetTargetPropertyCommand.h
+++ b/Source/cmGetTargetPropertyCommand.h
@@ -55,7 +55,9 @@ public:
"property values. Properties are usually used to control how "
"a target is built, but some query the target instead. "
"This command can get properties for any target so far created. "
- "The targets do not need to be in the current CMakeLists.txt file.";
+ "The targets do not need to be in the current CMakeLists.txt file."
+ "\n"
+ "See also the more general get_property() command.";
}
cmTypeMacro(cmGetTargetPropertyCommand, cmCommand);
diff --git a/Source/cmGetTestPropertyCommand.h b/Source/cmGetTestPropertyCommand.h
index 956cf55..d9f5d9b 100644
--- a/Source/cmGetTestPropertyCommand.h
+++ b/Source/cmGetTestPropertyCommand.h
@@ -48,11 +48,13 @@ public:
virtual const char* GetFullDocumentation()
{
return
- " get_test_property(test VAR property)\n"
- "Get a property from the Test. The value of the property is "
- "stored in the variable VAR. If the property is not found, "
- "CMake will report an error. For a list of standard properties "
- "you can type cmake --help-property-list";
+ " get_test_property(test property VAR)\n"
+ "Get a property from the Test. The value of the property is "
+ "stored in the variable VAR. If the property is not found, VAR "
+ "will be set to \"NOTFOUND\". For a list of standard properties "
+ "you can type cmake --help-property-list"
+ "\n"
+ "See also the more general get_property() command.";
}
cmTypeMacro(cmGetTestPropertyCommand, cmCommand);
diff --git a/Source/cmGlobalGenerator.cxx b/Source/cmGlobalGenerator.cxx
index 2ae1c93..d47fb6f 100644
--- a/Source/cmGlobalGenerator.cxx
+++ b/Source/cmGlobalGenerator.cxx
@@ -56,6 +56,7 @@ cmGlobalGenerator::cmGlobalGenerator()
this->ExtraGenerator = 0;
this->CurrentLocalGenerator = 0;
+ this->TryCompileOuterMakefile = 0;
}
cmGlobalGenerator::~cmGlobalGenerator()
@@ -199,6 +200,34 @@ cmGlobalGenerator::EnableLanguage(std::vector<std::string>const& languages,
cmSystemTools::SetFatalErrorOccured();
return;
}
+
+ if(this->TryCompileOuterMakefile)
+ {
+ // In a try-compile we can only enable languages provided by caller.
+ for(std::vector<std::string>::const_iterator li = languages.begin();
+ li != languages.end(); ++li)
+ {
+ if(*li == "NONE")
+ {
+ this->SetLanguageEnabled("NONE", mf);
+ }
+ else
+ {
+ const char* lang = li->c_str();
+ if(this->LanguagesReady.find(lang) == this->LanguagesReady.end())
+ {
+ cmOStringStream e;
+ e << "The test project needs language "
+ << lang << " which is not enabled.";
+ this->TryCompileOuterMakefile
+ ->IssueMessage(cmake::FATAL_ERROR, e.str());
+ cmSystemTools::SetFatalErrorOccured();
+ return;
+ }
+ }
+ }
+ }
+
mf->AddDefinition("RUN_CONFIGURE", true);
std::string rootBin = mf->GetHomeOutputDirectory();
rootBin += cmake::GetCMakeFilesDirectory();
@@ -208,15 +237,6 @@ cmGlobalGenerator::EnableLanguage(std::vector<std::string>const& languages,
// files from the parent cmake bin dir, into the try compile bin dir
if(this->ConfiguredFilesPath.size())
{
- for(std::vector<std::string>::const_iterator l = languages.begin();
- l != languages.end(); ++l)
- {
- if(*l == "NONE")
- {
- this->SetLanguageEnabled("NONE", mf);
- break;
- }
- }
rootBin = this->ConfiguredFilesPath;
}
@@ -421,6 +441,7 @@ cmGlobalGenerator::EnableLanguage(std::vector<std::string>const& languages,
{
this->SetLanguageEnabledMaps(lang, mf);
}
+ this->LanguagesReady.insert(lang);
std::string compilerName = "CMAKE_";
compilerName += lang;
@@ -1335,9 +1356,11 @@ cmLocalGenerator *cmGlobalGenerator::CreateLocalGenerator()
return lg;
}
-void cmGlobalGenerator::EnableLanguagesFromGenerator(cmGlobalGenerator *gen )
+void cmGlobalGenerator::EnableLanguagesFromGenerator(cmGlobalGenerator *gen,
+ cmMakefile* mf)
{
this->SetConfiguredFilesPath(gen);
+ this->TryCompileOuterMakefile = mf;
const char* make =
gen->GetCMakeInstance()->GetCacheDefinition("CMAKE_MAKE_PROGRAM");
this->GetCMakeInstance()->AddCacheEntry("CMAKE_MAKE_PROGRAM", make,
@@ -1345,6 +1368,7 @@ void cmGlobalGenerator::EnableLanguagesFromGenerator(cmGlobalGenerator *gen )
cmCacheManager::FILEPATH);
// copy the enabled languages
this->LanguageEnabled = gen->LanguageEnabled;
+ this->LanguagesReady = gen->LanguagesReady;
this->ExtensionToLanguage = gen->ExtensionToLanguage;
this->IgnoreExtensions = gen->IgnoreExtensions;
this->LanguageToOutputExtension = gen->LanguageToOutputExtension;
@@ -1881,7 +1905,7 @@ cmTarget cmGlobalGenerator::CreateGlobalTarget(
std::vector<std::string> no_outputs;
std::vector<std::string> no_depends;
// Store the custom command in the target.
- cmCustomCommand cc(no_outputs, no_depends, *commandLines, 0,
+ cmCustomCommand cc(0, no_outputs, no_depends, *commandLines, 0,
workingDirectory);
target.GetPostBuildCommands().push_back(cc);
target.SetProperty("EchoString", message);
diff --git a/Source/cmGlobalGenerator.h b/Source/cmGlobalGenerator.h
index 6a1aa53..5268731 100644
--- a/Source/cmGlobalGenerator.h
+++ b/Source/cmGlobalGenerator.h
@@ -79,7 +79,8 @@ public:
/**
* Try to determine system infomation, get it from another generator
*/
- virtual void EnableLanguagesFromGenerator(cmGlobalGenerator *gen);
+ virtual void EnableLanguagesFromGenerator(cmGlobalGenerator *gen,
+ cmMakefile* mf);
/**
* Try running cmake and building a file. This is used for dynalically
@@ -325,11 +326,13 @@ protected:
virtual bool UseFolderProperty();
private:
+ cmMakefile* TryCompileOuterMakefile;
float FirstTimeProgress;
// If you add a new map here, make sure it is copied
// in EnableLanguagesFromGenerator
std::map<cmStdString, bool> IgnoreExtensions;
std::map<cmStdString, bool> LanguageEnabled;
+ std::set<cmStdString> LanguagesReady; // Ready for try_compile
std::map<cmStdString, cmStdString> OutputExtensions;
std::map<cmStdString, cmStdString> LanguageToOutputExtension;
std::map<cmStdString, cmStdString> ExtensionToLanguage;
diff --git a/Source/cmGlobalMSYSMakefileGenerator.cxx b/Source/cmGlobalMSYSMakefileGenerator.cxx
index d324e59..820e7e6 100644
--- a/Source/cmGlobalMSYSMakefileGenerator.cxx
+++ b/Source/cmGlobalMSYSMakefileGenerator.cxx
@@ -69,9 +69,16 @@ void cmGlobalMSYSMakefileGenerator
{
gxx = tgxx;
}
+ std::string trc = cmSystemTools::FindProgram("windres", locations);
+ std::string rc = "windres.exe";
+ if(trc.size())
+ {
+ rc = trc;
+ }
mf->AddDefinition("MSYS", "1");
mf->AddDefinition("CMAKE_GENERATOR_CC", gcc.c_str());
mf->AddDefinition("CMAKE_GENERATOR_CXX", gxx.c_str());
+ mf->AddDefinition("CMAKE_GENERATOR_RC", rc.c_str());
this->cmGlobalUnixMakefileGenerator3::EnableLanguage(l, mf, optional);
if(!mf->IsSet("CMAKE_AR") &&
diff --git a/Source/cmGlobalMinGWMakefileGenerator.cxx b/Source/cmGlobalMinGWMakefileGenerator.cxx
index 9f9d1be..2f558dc 100644
--- a/Source/cmGlobalMinGWMakefileGenerator.cxx
+++ b/Source/cmGlobalMinGWMakefileGenerator.cxx
@@ -44,8 +44,15 @@ void cmGlobalMinGWMakefileGenerator
{
gxx = tgxx;
}
+ std::string trc = cmSystemTools::FindProgram("windres", locations);
+ std::string rc = "windres.exe";
+ if(trc.size())
+ {
+ rc = trc;
+ }
mf->AddDefinition("CMAKE_GENERATOR_CC", gcc.c_str());
mf->AddDefinition("CMAKE_GENERATOR_CXX", gxx.c_str());
+ mf->AddDefinition("CMAKE_GENERATOR_RC", rc.c_str());
this->cmGlobalUnixMakefileGenerator3::EnableLanguage(l, mf, optional);
}
diff --git a/Source/cmGlobalVisualStudio10Generator.cxx b/Source/cmGlobalVisualStudio10Generator.cxx
index 0b939af..6c3c1ed 100644
--- a/Source/cmGlobalVisualStudio10Generator.cxx
+++ b/Source/cmGlobalVisualStudio10Generator.cxx
@@ -114,18 +114,23 @@ std::string cmGlobalVisualStudio10Generator
::GenerateBuildCommand(const char* makeProgram,
const char *projectName,
const char* additionalOptions, const char *targetName,
- const char* config, bool ignoreErrors, bool)
+ const char* config, bool ignoreErrors, bool fast)
{
- // Ingoring errors is not implemented in visual studio 6
- (void) ignoreErrors;
-
-
// now build the test
std::string makeCommand
= cmSystemTools::ConvertToOutputPath(makeProgram);
std::string lowerCaseCommand = makeCommand;
cmSystemTools::LowerCase(lowerCaseCommand);
+ // If makeProgram is devenv, parent class knows how to generate command:
+ if (lowerCaseCommand.find("devenv") != std::string::npos)
+ {
+ return cmGlobalVisualStudio7Generator::GenerateBuildCommand(makeProgram,
+ projectName, additionalOptions, targetName, config, ignoreErrors, fast);
+ }
+
+ // Otherwise, assume MSBuild command line, and construct accordingly.
+
// if there are spaces in the makeCommand, assume a full path
// and convert it to a path with no spaces in it as the
// RunSingleCommand does not like spaces
diff --git a/Source/cmGlobalVisualStudio71Generator.cxx b/Source/cmGlobalVisualStudio71Generator.cxx
index 2874952..adb5f2f 100644
--- a/Source/cmGlobalVisualStudio71Generator.cxx
+++ b/Source/cmGlobalVisualStudio71Generator.cxx
@@ -110,7 +110,7 @@ void cmGlobalVisualStudio71Generator
this->GetTargetSets(projectTargets, originalTargets, root, generators);
OrderedTargetDependSet orderedProjectTargets(projectTargets);
- this->WriteTargetsToSolution(fout, orderedProjectTargets);
+ this->WriteTargetsToSolution(fout, root, orderedProjectTargets);
bool useFolderProperty = this->UseFolderProperty();
if (useFolderProperty)
@@ -182,8 +182,8 @@ cmGlobalVisualStudio71Generator::WriteProject(std::ostream& fout,
std::string guid = this->GetGUID(dspname);
fout << project
<< dspname << "\", \""
- << this->ConvertToSolutionPath(dir)
- << "\\" << dspname << ext << "\", \"{" << guid << "}\"\n";
+ << this->ConvertToSolutionPath(dir) << (dir[0]? "\\":"")
+ << dspname << ext << "\", \"{" << guid << "}\"\n";
fout << "\tProjectSection(ProjectDependencies) = postProject\n";
this->WriteProjectDepends(fout, dspname, dir, t);
fout << "\tEndProjectSection\n";
@@ -196,8 +196,8 @@ cmGlobalVisualStudio71Generator::WriteProject(std::ostream& fout,
const char* uname = ui->second.c_str();
fout << "Project(\"{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}\") = \""
<< uname << "\", \""
- << this->ConvertToSolutionPath(dir)
- << "\\" << uname << ".vcproj" << "\", \"{"
+ << this->ConvertToSolutionPath(dir) << (dir[0]? "\\":"")
+ << uname << ".vcproj" << "\", \"{"
<< this->GetGUID(uname) << "}\"\n"
<< "\tProjectSection(ProjectDependencies) = postProject\n"
<< "\t\t{" << guid << "} = {" << guid << "}\n"
diff --git a/Source/cmGlobalVisualStudio7Generator.cxx b/Source/cmGlobalVisualStudio7Generator.cxx
index eb84a2c..51b8918 100644
--- a/Source/cmGlobalVisualStudio7Generator.cxx
+++ b/Source/cmGlobalVisualStudio7Generator.cxx
@@ -270,6 +270,7 @@ void cmGlobalVisualStudio7Generator::WriteTargetConfigurations(
void cmGlobalVisualStudio7Generator::WriteTargetsToSolution(
std::ostream& fout,
+ cmLocalGenerator* root,
OrderedTargetDependSet const& projectTargets)
{
for(OrderedTargetDependSet::const_iterator tt =
@@ -296,6 +297,12 @@ void cmGlobalVisualStudio7Generator::WriteTargetsToSolution(
{
cmMakefile* tmf = target->GetMakefile();
std::string dir = tmf->GetStartOutputDirectory();
+ dir = root->Convert(dir.c_str(),
+ cmLocalGenerator::START_OUTPUT);
+ if(dir == ".")
+ {
+ dir = ""; // msbuild cannot handle ".\" prefix
+ }
this->WriteProject(fout, vcprojName, dir.c_str(),
*target);
written = true;
@@ -385,7 +392,7 @@ void cmGlobalVisualStudio7Generator
this->GetTargetSets(projectTargets, originalTargets, root, generators);
OrderedTargetDependSet orderedProjectTargets(projectTargets);
- this->WriteTargetsToSolution(fout, orderedProjectTargets);
+ this->WriteTargetsToSolution(fout, root, orderedProjectTargets);
bool useFolderProperty = this->UseFolderProperty();
if (useFolderProperty)
@@ -511,8 +518,8 @@ void cmGlobalVisualStudio7Generator::WriteProject(std::ostream& fout,
fout << project
<< dspname << "\", \""
- << this->ConvertToSolutionPath(dir)
- << "\\" << dspname << ext << "\", \"{"
+ << this->ConvertToSolutionPath(dir) << (dir[0]? "\\":"")
+ << dspname << ext << "\", \"{"
<< this->GetGUID(dspname) << "}\"\nEndProject\n";
UtilityDependsMap::iterator ui = this->UtilityDepends.find(&target);
@@ -521,8 +528,8 @@ void cmGlobalVisualStudio7Generator::WriteProject(std::ostream& fout,
const char* uname = ui->second.c_str();
fout << "Project(\"{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}\") = \""
<< uname << "\", \""
- << this->ConvertToSolutionPath(dir)
- << "\\" << uname << ".vcproj" << "\", \"{"
+ << this->ConvertToSolutionPath(dir) << (dir[0]? "\\":"")
+ << uname << ".vcproj" << "\", \"{"
<< this->GetGUID(uname) << "}\"\n"
<< "EndProject\n";
}
diff --git a/Source/cmGlobalVisualStudio7Generator.h b/Source/cmGlobalVisualStudio7Generator.h
index 57c079d..b6c84e8 100644
--- a/Source/cmGlobalVisualStudio7Generator.h
+++ b/Source/cmGlobalVisualStudio7Generator.h
@@ -118,6 +118,7 @@ protected:
virtual void WriteTargetsToSolution(
std::ostream& fout,
+ cmLocalGenerator* root,
OrderedTargetDependSet const& projectTargets);
virtual void WriteTargetDepends(
std::ostream& fout,
diff --git a/Source/cmGlobalVisualStudioGenerator.cxx b/Source/cmGlobalVisualStudioGenerator.cxx
index 7696e6c..449d090 100644
--- a/Source/cmGlobalVisualStudioGenerator.cxx
+++ b/Source/cmGlobalVisualStudioGenerator.cxx
@@ -611,8 +611,9 @@ void WriteVSMacrosFileRegistryEntry(
{
// Create the subkey and set the values of interest:
HKEY hsubkey = NULL;
- result = RegCreateKeyEx(hkey, nextAvailableSubKeyName.c_str(), 0, "", 0,
- KEY_READ|KEY_WRITE, 0, &hsubkey, 0);
+ char lpClass[] = "";
+ result = RegCreateKeyEx(hkey, nextAvailableSubKeyName.c_str(), 0,
+ lpClass, 0, KEY_READ|KEY_WRITE, 0, &hsubkey, 0);
if (ERROR_SUCCESS == result)
{
DWORD dw = 0;
diff --git a/Source/cmGlobalXCodeGenerator.cxx b/Source/cmGlobalXCodeGenerator.cxx
index 29c2d06..1395865 100644
--- a/Source/cmGlobalXCodeGenerator.cxx
+++ b/Source/cmGlobalXCodeGenerator.cxx
@@ -18,6 +18,7 @@
#include "cmGeneratedFileStream.h"
#include "cmComputeLinkInformation.h"
#include "cmSourceFile.h"
+#include "cmCustomCommandGenerator.h"
#include <cmsys/auto_ptr.hxx>
@@ -354,7 +355,7 @@ cmGlobalXCodeGenerator::AddExtraTargets(cmLocalGenerator* root,
cmCustomCommandLines commandLines;
commandLines.push_back(makecommand);
// Add Re-Run CMake rules
- this->CreateReRunCMakeFile(root);
+ this->CreateReRunCMakeFile(root, gens);
// now make the allbuild depend on all the non-utility targets
// in the project
@@ -402,10 +403,18 @@ cmGlobalXCodeGenerator::AddExtraTargets(cmLocalGenerator* root,
}
//----------------------------------------------------------------------------
-void cmGlobalXCodeGenerator::CreateReRunCMakeFile(cmLocalGenerator* root)
+void cmGlobalXCodeGenerator::CreateReRunCMakeFile(
+ cmLocalGenerator* root, std::vector<cmLocalGenerator*> const& gens)
{
cmMakefile* mf = root->GetMakefile();
- std::vector<std::string> lfiles = mf->GetListFiles();
+ std::vector<std::string> lfiles;
+ for(std::vector<cmLocalGenerator*>::const_iterator gi = gens.begin();
+ gi != gens.end(); ++gi)
+ {
+ std::vector<std::string> const& lf = (*gi)->GetMakefile()->GetListFiles();
+ lfiles.insert(lfiles.end(), lf.begin(), lf.end());
+ }
+
// sort the array
std::sort(lfiles.begin(), lfiles.end(), std::less<std::string>());
std::vector<std::string>::iterator new_end =
@@ -1278,6 +1287,9 @@ void cmGlobalXCodeGenerator
makefileStream << "# Generated by CMake, DO NOT EDIT\n";
makefileStream << "# Custom rules for " << target.GetName() << "\n";
+ // disable the implicit rules
+ makefileStream << ".SUFFIXES: " << "\n";
+
// have all depend on all outputs
makefileStream << "all: ";
std::map<const cmCustomCommand*, cmStdString> tname;
@@ -1314,8 +1326,7 @@ void cmGlobalXCodeGenerator
cmCustomCommand const& cc = *i;
if(!cc.GetCommandLines().empty())
{
- bool escapeOldStyle = cc.GetEscapeOldStyle();
- bool escapeAllowMakeVars = cc.GetEscapeAllowMakeVars();
+ cmCustomCommandGenerator ccg(cc, configName, this->CurrentMakefile);
makefileStream << "\n";
const std::vector<std::string>& outputs = cc.GetOutputs();
if(!outputs.empty())
@@ -1348,20 +1359,15 @@ void cmGlobalXCodeGenerator
{
std::string echo_cmd = "echo ";
echo_cmd += (this->CurrentLocalGenerator->
- EscapeForShell(comment, escapeAllowMakeVars));
+ EscapeForShell(comment, cc.GetEscapeAllowMakeVars()));
makefileStream << "\t" << echo_cmd.c_str() << "\n";
}
// Add each command line to the set of commands.
- for(cmCustomCommandLines::const_iterator cl =
- cc.GetCommandLines().begin();
- cl != cc.GetCommandLines().end(); ++cl)
+ for(unsigned int c = 0; c < ccg.GetNumberOfCommands(); ++c)
{
// Build the command line in a single string.
- const cmCustomCommandLine& commandLine = *cl;
- std::string cmd2 = this->CurrentLocalGenerator
- ->GetRealLocation(commandLine[0].c_str(), configName);
-
+ std::string cmd2 = ccg.GetCommand(c);
cmSystemTools::ReplaceString(cmd2, "/./", "/");
cmd2 = this->ConvertToRelativeForMake(cmd2.c_str());
std::string cmd;
@@ -1372,21 +1378,7 @@ void cmGlobalXCodeGenerator
cmd += " && ";
}
cmd += cmd2;
- for(unsigned int j=1; j < commandLine.size(); ++j)
- {
- cmd += " ";
- if(escapeOldStyle)
- {
- cmd += (this->CurrentLocalGenerator
- ->EscapeForShellOldStyle(commandLine[j].c_str()));
- }
- else
- {
- cmd += (this->CurrentLocalGenerator->
- EscapeForShell(commandLine[j].c_str(),
- escapeAllowMakeVars));
- }
- }
+ ccg.AppendArguments(c, cmd);
makefileStream << "\t" << cmd.c_str() << "\n";
}
}
@@ -2636,7 +2628,10 @@ void cmGlobalXCodeGenerator
group->AddAttribute("BuildIndependentTargetsInParallel",
this->CreateString("YES"));
this->RootObject->AddAttribute("attributes", group);
- if (this->XcodeVersion >= 31)
+ if (this->XcodeVersion >= 32)
+ this->RootObject->AddAttribute("compatibilityVersion",
+ this->CreateString("Xcode 3.2"));
+ else if (this->XcodeVersion >= 31)
this->RootObject->AddAttribute("compatibilityVersion",
this->CreateString("Xcode 3.1"));
else
@@ -3042,7 +3037,9 @@ cmGlobalXCodeGenerator::WriteXCodePBXProj(std::ostream& fout,
cmXCodeObject::Indent(1, fout);
if(this->XcodeVersion >= 21)
{
- if (this->XcodeVersion >= 31)
+ if (this->XcodeVersion >= 32)
+ fout << "objectVersion = 46;\n";
+ else if (this->XcodeVersion >= 31)
fout << "objectVersion = 45;\n";
else if (this->XcodeVersion >= 30)
fout << "objectVersion = 44;\n";
diff --git a/Source/cmGlobalXCodeGenerator.h b/Source/cmGlobalXCodeGenerator.h
index b4de805..290532a 100644
--- a/Source/cmGlobalXCodeGenerator.h
+++ b/Source/cmGlobalXCodeGenerator.h
@@ -171,7 +171,8 @@ private:
const char* name2,
cmTarget& cmtarget,
const std::vector<cmCustomCommand>&);
- void CreateReRunCMakeFile(cmLocalGenerator* root);
+ void CreateReRunCMakeFile(cmLocalGenerator* root,
+ std::vector<cmLocalGenerator*> const& gens);
std::string LookupFlags(const char* varNamePrefix,
const char* varNameLang,
diff --git a/Source/cmIfCommand.h b/Source/cmIfCommand.h
index 107a892..4996bc4 100644
--- a/Source/cmIfCommand.h
+++ b/Source/cmIfCommand.h
@@ -125,10 +125,13 @@ public:
"True if the constant is 1, ON, YES, TRUE, Y, or a non-zero number. "
"False if the constant is 0, OFF, NO, FALSE, N, IGNORE, \"\", "
"or ends in the suffix '-NOTFOUND'. "
- "Named boolean constants are case-insensitive."
+ "Named boolean constants are case-insensitive. "
+ "If the argument is not one of these constants, "
+ "it is treated as a variable:"
"\n"
" if(<variable>)\n"
- "True if the variable's value is not a false constant."
+ "True if the variable is defined to a value that is not a false "
+ "constant. False otherwise. "
"\n"
" if(NOT <expression>)\n"
"True if the expression is not true."
@@ -163,32 +166,25 @@ public:
"Behavior is well-defined only for full paths.\n"
" if(IS_ABSOLUTE path)\n"
"True if the given path is an absolute path.\n"
- " if(variable MATCHES regex)\n"
- " if(string MATCHES regex)\n"
+ " if(<variable|string> MATCHES regex)\n"
"True if the given string or variable's value matches the given "
"regular expression.\n"
- " if(variable LESS number)\n"
- " if(string LESS number)\n"
- " if(variable GREATER number)\n"
- " if(string GREATER number)\n"
- " if(variable EQUAL number)\n"
- " if(string EQUAL number)\n"
+ " if(<variable|string> LESS <variable|string>)\n"
+ " if(<variable|string> GREATER <variable|string>)\n"
+ " if(<variable|string> EQUAL <variable|string>)\n"
"True if the given string or variable's value is a valid number and "
"the inequality or equality is true.\n"
- " if(variable STRLESS string)\n"
- " if(string STRLESS string)\n"
- " if(variable STRGREATER string)\n"
- " if(string STRGREATER string)\n"
- " if(variable STREQUAL string)\n"
- " if(string STREQUAL string)\n"
+ " if(<variable|string> STRLESS <variable|string>)\n"
+ " if(<variable|string> STRGREATER <variable|string>)\n"
+ " if(<variable|string> STREQUAL <variable|string>)\n"
"True if the given string or variable's value is lexicographically "
"less (or greater, or equal) than the string or variable on the right.\n"
- " if(version1 VERSION_LESS version2)\n"
- " if(version1 VERSION_EQUAL version2)\n"
- " if(version1 VERSION_GREATER version2)\n"
+ " if(<variable|string> VERSION_LESS <variable|string>)\n"
+ " if(<variable|string> VERSION_EQUAL <variable|string>)\n"
+ " if(<variable|string> VERSION_GREATER <variable|string>)\n"
"Component-wise integer version number comparison (version format is "
"major[.minor[.patch[.tweak]]]).\n"
- " if(DEFINED variable)\n"
+ " if(DEFINED <variable>)\n"
"True if the given variable is defined. It does not matter if the "
"variable is true or false just if it has been set.\n"
" if((expression) AND (expression OR (expression)))\n"
@@ -199,38 +195,27 @@ public:
"that contains them."
"\n"
- "The if statement was written fairly early in CMake's history "
- "and it has some convenience features that are worth covering. "
- "The if statement reduces operations until there is "
- "a single remaining value, at that point if the case "
- "insensitive value is: ON, 1, YES, TRUE, Y it returns true, if "
- "it is OFF, 0, NO, FALSE, N, NOTFOUND, *-NOTFOUND, IGNORE it "
- "will return false. \n"
-
- "This is fairly reasonable. The convenience feature that sometimes "
- "throws new authors is how CMake handles values that do not "
- "match the true or false list. Those values are treated as "
- "variables and are dereferenced even though they do not have "
- "the required ${} syntax. This means that if you write\n"
-
- " if (boobah)\n"
-
- "CMake will treat it as if you wrote \n"
-
- " if (${boobah})\n"
-
- "likewise if you write \n"
-
- " if (fubar AND sol)\n"
-
- "CMake will conveniently treat it as \n"
-
- " if (\"${fubar}\" AND \"${sol}\")\n"
-
- "The later is really the correct way to write it, but the "
- "former will work as well. Only some operations in the if "
- "statement have this special handling of arguments. The "
- "specific details follow: \n"
+ "The if command was written very early in CMake's history, predating "
+ "the ${} variable evaluation syntax, and for convenience evaluates "
+ "variables named by its arguments as shown in the above signatures. "
+ "Note that normal variable evaluation with ${} applies before the "
+ "if command even receives the arguments. "
+ "Therefore code like\n"
+ " set(var1 OFF)\n"
+ " set(var2 \"var1\")\n"
+ " if(${var2})\n"
+ "appears to the if command as\n"
+ " if(var1)\n"
+ "and is evaluated according to the if(<variable>) case "
+ "documented above. "
+ "The result is OFF which is false. "
+ "However, if we remove the ${} from the example then the command sees\n"
+ " if(var2)\n"
+ "which is true because var2 is defined to \"var1\" which is not "
+ "a false constant."
+ "\n"
+ "Automatic evaluation applies in the other cases whenever the "
+ "above-documented signature accepts <variable|string>:\n"
"1) The left hand argument to MATCHES is first checked to see "
"if it is a defined variable, if so the variable's value is "
diff --git a/Source/cmIncludeCommand.cxx b/Source/cmIncludeCommand.cxx
index c9b14a1..0ac6df4 100644
--- a/Source/cmIncludeCommand.cxx
+++ b/Source/cmIncludeCommand.cxx
@@ -26,10 +26,10 @@ bool cmIncludeCommand
bool noPolicyScope = false;
std::string fname = args[0];
std::string resultVarName;
-
+
for (unsigned int i=1; i<args.size(); i++)
{
- if (args[i] == "OPTIONAL")
+ if (args[i] == "OPTIONAL")
{
if (optional)
{
@@ -60,10 +60,10 @@ bool cmIncludeCommand
{
noPolicyScope = true;
}
- else if(i > 1) // compat.: in previous cmake versions the second
+ else if(i > 1) // compat.: in previous cmake versions the second
// parameter was ignore if it wasn't "OPTIONAL"
{
- std::string errorText = "called with invalid argument: ";
+ std::string errorText = "called with invalid argument: ";
errorText += args[i];
this->SetError(errorText.c_str());
return false;
@@ -82,15 +82,15 @@ bool cmIncludeCommand
}
}
std::string fullFilePath;
- bool readit =
- this->Makefile->ReadListFile( this->Makefile->GetCurrentListFile(),
+ bool readit =
+ this->Makefile->ReadListFile( this->Makefile->GetCurrentListFile(),
fname.c_str(), &fullFilePath,
noPolicyScope);
-
+
// add the location of the included file if a result variable was given
if (resultVarName.size())
{
- this->Makefile->AddDefinition(resultVarName.c_str(),
+ this->Makefile->AddDefinition(resultVarName.c_str(),
readit?fullFilePath.c_str():"NOTFOUND");
}
diff --git a/Source/cmIncludeCommand.h b/Source/cmIncludeCommand.h
index a215275..d933ef3 100644
--- a/Source/cmIncludeCommand.h
+++ b/Source/cmIncludeCommand.h
@@ -15,7 +15,7 @@
#include "cmCommand.h"
/** \class cmIncludeCommand
- * \brief
+ * \brief
*
* cmIncludeCommand defines a list of distant
* files that can be "included" in the current list file.
@@ -28,7 +28,7 @@ public:
/**
* This is a virtual constructor for the command.
*/
- virtual cmCommand* Clone()
+ virtual cmCommand* Clone()
{
return new cmIncludeCommand;
}
@@ -49,15 +49,15 @@ public:
* The name of the command as specified in CMakeList.txt.
*/
virtual const char* GetName() {return "include";}
-
+
/**
* Succinct documentation.
*/
- virtual const char* GetTerseDocumentation()
+ virtual const char* GetTerseDocumentation()
{
return "Read CMake listfile code from the given file.";
}
-
+
/**
* More documentation.
*/
@@ -73,13 +73,17 @@ public:
"the variable will be set to the full filename which "
"has been included or NOTFOUND if it failed.\n"
"If a module is specified instead of a file, the file with name "
- "<modulename>.cmake is searched in the CMAKE_MODULE_PATH."
+ "<modulename>.cmake is searched first in CMAKE_MODULE_PATH, then in the "
+ "CMake module directory. There is one exception to this: if the file "
+ "which calls include() is located itself in the CMake module directory, "
+ "then first the CMake module directory is searched and "
+ "CMAKE_MODULE_PATH afterwards. See also policy CMP0017."
"\n"
"See the cmake_policy() command documentation for discussion of the "
"NO_POLICY_SCOPE option."
;
}
-
+
cmTypeMacro(cmIncludeCommand, cmCommand);
};
diff --git a/Source/cmLocalGenerator.cxx b/Source/cmLocalGenerator.cxx
index b7d694c..d3cbc1f 100644
--- a/Source/cmLocalGenerator.cxx
+++ b/Source/cmLocalGenerator.cxx
@@ -1913,24 +1913,6 @@ bool cmLocalGenerator::GetRealDependency(const char* inName,
}
//----------------------------------------------------------------------------
-std::string cmLocalGenerator::GetRealLocation(const char* inName,
- const char* config)
-{
- std::string outName=inName;
- // Look for a CMake target with the given name, which is an executable
- // and which can be run
- cmTarget* target = this->Makefile->FindTargetToUse(inName);
- if ((target != 0)
- && (target->GetType() == cmTarget::EXECUTABLE)
- && ((this->Makefile->IsOn("CMAKE_CROSSCOMPILING") == false)
- || (target->IsImported() == true)))
- {
- outName = target->GetLocation( config );
- }
- return outName;
-}
-
-//----------------------------------------------------------------------------
void cmLocalGenerator::AddSharedFlags(std::string& flags,
const char* lang,
bool shared)
diff --git a/Source/cmLocalGenerator.h b/Source/cmLocalGenerator.h
index 870ce36..35aab99 100644
--- a/Source/cmLocalGenerator.h
+++ b/Source/cmLocalGenerator.h
@@ -168,11 +168,6 @@ public:
bool GetRealDependency(const char* name, const char* config,
std::string& dep);
- /** Translate a command as given in CMake code to the location of the
- executable if the command is the name of a CMake executable target.
- If that's not the case, just return the original name. */
- std::string GetRealLocation(const char* inName, const char* config);
-
///! for existing files convert to output path and short path if spaces
std::string ConvertToOutputForExisting(const char* remote,
RelativeRoot local = START_OUTPUT);
diff --git a/Source/cmLocalUnixMakefileGenerator3.cxx b/Source/cmLocalUnixMakefileGenerator3.cxx
index 15ae139..ff48009 100644
--- a/Source/cmLocalUnixMakefileGenerator3.cxx
+++ b/Source/cmLocalUnixMakefileGenerator3.cxx
@@ -19,6 +19,7 @@
#include "cmake.h"
#include "cmVersion.h"
#include "cmFileTimeComparison.h"
+#include "cmCustomCommandGenerator.h"
// Include dependency scanners for supported languages. Only the
// C/C++ scanner is needed for bootstrapping CMake.
@@ -961,18 +962,15 @@ cmLocalUnixMakefileGenerator3
{
*content << dir;
}
- bool escapeOldStyle = cc.GetEscapeOldStyle();
- bool escapeAllowMakeVars = cc.GetEscapeAllowMakeVars();
+ cmCustomCommandGenerator ccg(cc, this->ConfigurationName.c_str(),
+ this->Makefile);
// Add each command line to the set of commands.
std::vector<std::string> commands1;
- for(cmCustomCommandLines::const_iterator cl = cc.GetCommandLines().begin();
- cl != cc.GetCommandLines().end(); ++cl)
+ for(unsigned int c = 0; c < ccg.GetNumberOfCommands(); ++c)
{
// Build the command line in a single string.
- const cmCustomCommandLine& commandLine = *cl;
- std::string cmd = GetRealLocation(commandLine[0].c_str(),
- this->ConfigurationName.c_str());
+ std::string cmd = ccg.GetCommand(c);
if (cmd.size())
{
// Use "call " before any invocations of .bat or .cmd files
@@ -1025,19 +1023,8 @@ cmLocalUnixMakefileGenerator3
std::string launcher =
this->MakeLauncher(cc, target, workingDir? NONE : START_OUTPUT);
cmd = launcher + this->Convert(cmd.c_str(),NONE,SHELL);
- for(unsigned int j=1; j < commandLine.size(); ++j)
- {
- cmd += " ";
- if(escapeOldStyle)
- {
- cmd += this->EscapeForShellOldStyle(commandLine[j].c_str());
- }
- else
- {
- cmd += this->EscapeForShell(commandLine[j].c_str(),
- escapeAllowMakeVars);
- }
- }
+
+ ccg.AppendArguments(c, cmd);
if(content)
{
// Rule content does not include the launcher.
diff --git a/Source/cmLocalVisualStudio10Generator.cxx b/Source/cmLocalVisualStudio10Generator.cxx
index 57d8653..de2a837 100644
--- a/Source/cmLocalVisualStudio10Generator.cxx
+++ b/Source/cmLocalVisualStudio10Generator.cxx
@@ -117,3 +117,9 @@ void cmLocalVisualStudio10Generator
"Stored GUID",
cmCacheManager::INTERNAL);
}
+
+//----------------------------------------------------------------------------
+std::string cmLocalVisualStudio10Generator::CheckForErrorLine()
+{
+ return "if errorlevel 1 goto :VCEnd";
+}
diff --git a/Source/cmLocalVisualStudio10Generator.h b/Source/cmLocalVisualStudio10Generator.h
index 5694220..06b8b09 100644
--- a/Source/cmLocalVisualStudio10Generator.h
+++ b/Source/cmLocalVisualStudio10Generator.h
@@ -36,6 +36,10 @@ public:
virtual void Generate();
virtual void ReadAndStoreExternalGUID(const char* name,
const char* path);
+
+protected:
+ virtual std::string CheckForErrorLine();
+
private:
};
#endif
diff --git a/Source/cmLocalVisualStudio6Generator.cxx b/Source/cmLocalVisualStudio6Generator.cxx
index b50c133..7aabf4d 100644
--- a/Source/cmLocalVisualStudio6Generator.cxx
+++ b/Source/cmLocalVisualStudio6Generator.cxx
@@ -65,13 +65,7 @@ public:
{
this->Code += "\\\n\t";
}
- this->Code +=
- this->LG->ConstructScript(cc.GetCommandLines(),
- cc.GetWorkingDirectory(),
- this->Config,
- cc.GetEscapeOldStyle(),
- cc.GetEscapeAllowMakeVars(),
- "\\\n\t");
+ this->Code += this->LG->ConstructScript(cc, this->Config, "\\\n\t");
}
private:
cmLocalVisualStudio6Generator* LG;
@@ -659,12 +653,7 @@ cmLocalVisualStudio6Generator
{
std::string config = this->GetConfigName(*i);
std::string script =
- this->ConstructScript(command.GetCommandLines(),
- command.GetWorkingDirectory(),
- config.c_str(),
- command.GetEscapeOldStyle(),
- command.GetEscapeAllowMakeVars(),
- "\\\n\t");
+ this->ConstructScript(command, config.c_str(), "\\\n\t");
if (i == this->Configurations.begin())
{
@@ -849,7 +838,7 @@ cmLocalVisualStudio6Generator::MaybeCreateOutputDir(cmTarget& target,
std::vector<std::string> no_depends;
cmCustomCommandLines commands;
commands.push_back(command);
- pcc.reset(new cmCustomCommand(no_output, no_depends, commands, 0, 0));
+ pcc.reset(new cmCustomCommand(0, no_output, no_depends, commands, 0, 0));
pcc->SetEscapeOldStyle(false);
pcc->SetEscapeAllowMakeVars(true);
return pcc;
diff --git a/Source/cmLocalVisualStudio7Generator.cxx b/Source/cmLocalVisualStudio7Generator.cxx
index 9a87cc4..34756d8 100644
--- a/Source/cmLocalVisualStudio7Generator.cxx
+++ b/Source/cmLocalVisualStudio7Generator.cxx
@@ -427,7 +427,7 @@ cmVS7FlagTable cmLocalVisualStudio7GeneratorFlagTable[] =
// The YX and Yu options are in a per-global-generator table because
// their values differ based on the VS IDE version.
{"ForcedIncludeFiles", "FI", "Forced include files", "",
- cmVS7FlagTable::UserValueRequired},
+ cmVS7FlagTable::UserValueRequired | cmVS7FlagTable::SemicolonAppendable},
// boolean flags
{"BufferSecurityCheck", "GS", "Buffer security check", "TRUE", 0},
@@ -546,12 +546,7 @@ public:
{
this->Stream << this->LG->EscapeForXML("\n");
}
- std::string script =
- this->LG->ConstructScript(cc.GetCommandLines(),
- cc.GetWorkingDirectory(),
- this->Config,
- cc.GetEscapeOldStyle(),
- cc.GetEscapeAllowMakeVars());
+ std::string script = this->LG->ConstructScript(cc, this->Config);
this->Stream << this->LG->EscapeForXML(script.c_str());
}
private:
@@ -802,7 +797,6 @@ void cmLocalVisualStudio7Generator::WriteConfiguration(std::ostream& fout,
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" )
{
@@ -1033,7 +1027,12 @@ void cmLocalVisualStudio7Generator::OutputBuildTool(std::ostream& fout,
temp += "/";
temp += targetNameImport;
fout << "\t\t\t\tImportLibrary=\""
- << this->ConvertToXMLOutputPathSingle(temp.c_str()) << "\"/>\n";
+ << this->ConvertToXMLOutputPathSingle(temp.c_str()) << "\"";
+ if(this->FortranProject)
+ {
+ fout << "\n\t\t\t\tLinkDLL=\"true\"";
+ }
+ fout << "/>\n";
}
break;
case cmTarget::EXECUTABLE:
@@ -1591,12 +1590,7 @@ WriteCustomRule(std::ostream& fout,
<< this->EscapeForXML(fc.CompileFlags.c_str()) << "\"/>\n";
}
- std::string script =
- this->ConstructScript(command.GetCommandLines(),
- command.GetWorkingDirectory(),
- i->c_str(),
- command.GetEscapeOldStyle(),
- command.GetEscapeAllowMakeVars());
+ std::string script = this->ConstructScript(command, i->c_str());
fout << "\t\t\t\t\t<Tool\n"
<< "\t\t\t\t\tName=\"" << customTool << "\"\n"
<< "\t\t\t\t\tDescription=\""
@@ -1712,6 +1706,22 @@ void cmLocalVisualStudio7Generator
event.Finish();
}
+void cmLocalVisualStudio7Generator::WriteProjectSCC(std::ostream& fout,
+ cmTarget& target)
+{
+ // if we have all the required Source code control tags
+ // then add that to the project
+ const char* vsProjectname = target.GetProperty("VS_SCC_PROJECTNAME");
+ const char* vsLocalpath = target.GetProperty("VS_SCC_LOCALPATH");
+ const char* vsProvider = target.GetProperty("VS_SCC_PROVIDER");
+ if(vsProvider && vsLocalpath && vsProjectname)
+ {
+ fout << "\tSccProjectName=\"" << vsProjectname << "\"\n"
+ << "\tSccLocalPath=\"" << vsLocalpath << "\"\n"
+ << "\tSccProvider=\"" << vsProvider << "\"\n";
+ }
+}
+
void
cmLocalVisualStudio7Generator
::WriteProjectStartFortran(std::ostream& fout,
@@ -1779,6 +1789,7 @@ cmLocalVisualStudio7Generator
{
fout << "\tProjectType=\"" << projectType << "\"\n";
}
+ this->WriteProjectSCC(fout, target);
fout<< "\tKeyword=\"" << keyword << "\">\n"
<< "\tProjectGUID=\"{" << gg->GetGUID(libName) << "}\">\n"
<< "\t<Platforms>\n"
@@ -1819,9 +1830,6 @@ cmLocalVisualStudio7Generator::WriteProjectStart(std::ostream& fout,
{
keyword = "Win32Proj";
}
- const char* vsProjectname = target.GetProperty("VS_SCC_PROJECTNAME");
- const char* vsLocalpath = target.GetProperty("VS_SCC_LOCALPATH");
- const char* vsProvider = target.GetProperty("VS_SCC_PROVIDER");
cmGlobalVisualStudio7Generator* gg =
static_cast<cmGlobalVisualStudio7Generator *>(this->GlobalGenerator);
fout << "\tName=\"" << projLabel << "\"\n";
@@ -1829,14 +1837,7 @@ cmLocalVisualStudio7Generator::WriteProjectStart(std::ostream& fout,
{
fout << "\tProjectGUID=\"{" << gg->GetGUID(libName) << "}\"\n";
}
- // if we have all the required Source code control tags
- // then add that to the project
- if(vsProvider && vsLocalpath && vsProjectname)
- {
- fout << "\tSccProjectName=\"" << vsProjectname << "\"\n"
- << "\tSccLocalPath=\"" << vsLocalpath << "\"\n"
- << "\tSccProvider=\"" << vsProvider << "\"\n";
- }
+ this->WriteProjectSCC(fout, target);
fout << "\tKeyword=\"" << keyword << "\">\n"
<< "\t<Platforms>\n"
<< "\t\t<Platform\n\t\t\tName=\"" << this->PlatformName << "\"/>\n"
diff --git a/Source/cmLocalVisualStudio7Generator.h b/Source/cmLocalVisualStudio7Generator.h
index 19f7b97..160e2d4 100644
--- a/Source/cmLocalVisualStudio7Generator.h
+++ b/Source/cmLocalVisualStudio7Generator.h
@@ -102,6 +102,7 @@ private:
cmTarget& t, bool debug);
void OutputLibraryDirectories(std::ostream& fout,
std::vector<std::string> const& dirs);
+ void WriteProjectSCC(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,
diff --git a/Source/cmLocalVisualStudioGenerator.cxx b/Source/cmLocalVisualStudioGenerator.cxx
index ed0b07f..9164beb 100644
--- a/Source/cmLocalVisualStudioGenerator.cxx
+++ b/Source/cmLocalVisualStudioGenerator.cxx
@@ -14,6 +14,7 @@
#include "cmMakefile.h"
#include "cmSourceFile.h"
#include "cmSystemTools.h"
+#include "cmCustomCommandGenerator.h"
#include "windows.h"
//----------------------------------------------------------------------------
@@ -52,7 +53,7 @@ cmLocalVisualStudioGenerator::MaybeCreateImplibDir(cmTarget& target,
std::vector<std::string> no_depends;
cmCustomCommandLines commands;
commands.push_back(command);
- pcc.reset(new cmCustomCommand(no_output, no_depends, commands, 0, 0));
+ pcc.reset(new cmCustomCommand(0, no_output, no_depends, commands, 0, 0));
pcc->SetEscapeOldStyle(false);
pcc->SetEscapeAllowMakeVars(true);
return pcc;
@@ -149,15 +150,29 @@ void cmLocalVisualStudioGenerator::ComputeObjectNameRequirements
}
//----------------------------------------------------------------------------
+std::string cmLocalVisualStudioGenerator::CheckForErrorLine()
+{
+ return "if errorlevel 1 goto :VCReportError";
+}
+
+//----------------------------------------------------------------------------
+std::string cmLocalVisualStudioGenerator::GetCheckForErrorLine()
+{
+ return this->CheckForErrorLine();
+}
+
+//----------------------------------------------------------------------------
std::string
cmLocalVisualStudioGenerator
-::ConstructScript(const cmCustomCommandLines& commandLines,
- const char* workingDirectory,
+::ConstructScript(cmCustomCommand const& cc,
const char* configName,
- bool escapeOldStyle,
- bool escapeAllowMakeVars,
const char* newline_text)
{
+ const cmCustomCommandLines& commandLines = cc.GetCommandLines();
+ const char* workingDirectory = cc.GetWorkingDirectory();
+ cmCustomCommandGenerator ccg(cc, configName, this->Makefile);
+ RelativeRoot relativeRoot = workingDirectory? NONE : START_OUTPUT;
+
// Avoid leading or trailing newlines.
const char* newline = "";
@@ -196,40 +211,16 @@ cmLocalVisualStudioGenerator
}
}
// Write each command on a single line.
- for(cmCustomCommandLines::const_iterator cl = commandLines.begin();
- cl != commandLines.end(); ++cl)
+ for(unsigned int c = 0; c < ccg.GetNumberOfCommands(); ++c)
{
// Start a new line.
script += newline;
newline = newline_text;
- // Start with the command name.
- const cmCustomCommandLine& commandLine = *cl;
- std::string commandName = this->GetRealLocation(commandLine[0].c_str(),
- configName);
- if(!workingDirectory)
- {
- script += this->Convert(commandName.c_str(),START_OUTPUT,SHELL);
- }
- else
- {
- script += this->Convert(commandName.c_str(),NONE,SHELL);
- }
-
- // Add the arguments.
- for(unsigned int j=1;j < commandLine.size(); ++j)
- {
- script += " ";
- if(escapeOldStyle)
- {
- script += this->EscapeForShellOldStyle(commandLine[j].c_str());
- }
- else
- {
- script += this->EscapeForShell(commandLine[j].c_str(),
- escapeAllowMakeVars);
- }
- }
+ // Add this command line.
+ std::string cmd = ccg.GetCommand(c);
+ script += this->Convert(cmd.c_str(), relativeRoot, SHELL);
+ ccg.AppendArguments(c, script);
// After each custom command, check for an error result.
// If there was an error, jump to the VCReportError label,
@@ -237,7 +228,7 @@ cmLocalVisualStudioGenerator
// sequence.
//
script += newline_text;
- script += "if errorlevel 1 goto VCReportError";
+ script += this->GetCheckForErrorLine();
}
return script;
diff --git a/Source/cmLocalVisualStudioGenerator.h b/Source/cmLocalVisualStudioGenerator.h
index 6034b22..1954ac5 100644
--- a/Source/cmLocalVisualStudioGenerator.h
+++ b/Source/cmLocalVisualStudioGenerator.h
@@ -18,6 +18,7 @@
class cmSourceFile;
class cmSourceGroup;
+class cmCustomCommand;
/** \class cmLocalVisualStudioGenerator
* \brief Base class for Visual Studio generators.
@@ -30,15 +31,19 @@ class cmLocalVisualStudioGenerator : public cmLocalGenerator
public:
cmLocalVisualStudioGenerator();
virtual ~cmLocalVisualStudioGenerator();
+
/** Construct a script from the given list of command lines. */
- std::string ConstructScript(const cmCustomCommandLines& commandLines,
- const char* workingDirectory,
+ std::string ConstructScript(cmCustomCommand const& cc,
const char* configName,
- bool escapeOldStyle,
- bool escapeAllowMakeVars,
const char* newline = "\n");
+ /** Line of batch file text that skips to the end after
+ * a failed step in a sequence of custom commands.
+ */
+ std::string GetCheckForErrorLine();
+
protected:
+ virtual std::string CheckForErrorLine();
/** Construct a custom command to make exe import lib dir. */
cmsys::auto_ptr<cmCustomCommand>
diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx
index ef81529..e14e44d 100644
--- a/Source/cmMakefile.cxx
+++ b/Source/cmMakefile.cxx
@@ -22,6 +22,7 @@
#include "cmFunctionBlocker.h"
#include "cmListFileCache.h"
#include "cmCommandArgumentParserHelper.h"
+#include "cmDocumentCompileDefinitions.h"
#include "cmTest.h"
#ifdef CMAKE_BUILD_WITH_CMAKE
# include "cmVariableWatch.h"
@@ -855,7 +856,8 @@ cmMakefile::AddCustomCommandToTarget(const char* target,
{
// Add the command to the appropriate build step for the target.
std::vector<std::string> no_output;
- cmCustomCommand cc(no_output, depends, commandLines, comment, workingDir);
+ cmCustomCommand cc(this, no_output, depends,
+ commandLines, comment, workingDir);
cc.SetEscapeOldStyle(escapeOldStyle);
cc.SetEscapeAllowMakeVars(true);
switch(type)
@@ -975,7 +977,7 @@ cmMakefile::AddCustomCommandToOutput(const std::vector<std::string>& outputs,
if(file)
{
cmCustomCommand* cc =
- new cmCustomCommand(outputs, depends2, commandLines,
+ new cmCustomCommand(this, outputs, depends2, commandLines,
comment, workingDir);
cc->SetEscapeOldStyle(escapeOldStyle);
cc->SetEscapeAllowMakeVars(true);
@@ -2468,17 +2470,19 @@ void cmMakefile::AddDefaultDefinitions()
working, these variables are still also set here in this place, but they
will be reset in CMakeSystemSpecificInformation.cmake before the platform
files are executed. */
-#if defined(_WIN32) || defined(__CYGWIN__)
+#if defined(_WIN32)
this->AddDefinition("WIN32", "1");
this->AddDefinition("CMAKE_HOST_WIN32", "1");
#else
this->AddDefinition("UNIX", "1");
this->AddDefinition("CMAKE_HOST_UNIX", "1");
#endif
- // Cygwin is more like unix so enable the unix commands
#if defined(__CYGWIN__)
- this->AddDefinition("UNIX", "1");
- this->AddDefinition("CMAKE_HOST_UNIX", "1");
+ if(cmSystemTools::IsOn(cmSystemTools::GetEnv("CMAKE_LEGACY_CYGWIN_WIN32")))
+ {
+ this->AddDefinition("WIN32", "1");
+ this->AddDefinition("CMAKE_HOST_WIN32", "1");
+ }
#endif
#if defined(__APPLE__)
this->AddDefinition("APPLE", "1");
@@ -2842,6 +2846,18 @@ int cmMakefile::TryCompile(const char *srcdir, const char *bindir,
cm.SetStartOutputDirectory(bindir);
cm.SetCMakeCommand(cmakeCommand.c_str());
cm.LoadCache();
+ if(!gg->IsMultiConfig())
+ {
+ if(const char* config =
+ this->GetDefinition("CMAKE_TRY_COMPILE_CONFIGURATION"))
+ {
+ // Tell the single-configuration generator which one to use.
+ // Add this before the user-provided CMake arguments in case
+ // one of the arguments is -DCMAKE_BUILD_TYPE=...
+ cm.AddCacheEntry("CMAKE_BUILD_TYPE", config,
+ "Build configuration", cmCacheManager::STRING);
+ }
+ }
// if cmake args were provided then pass them in
if (cmakeArgs)
{
@@ -2874,7 +2890,7 @@ int cmMakefile::TryCompile(const char *srcdir, const char *bindir,
}
// to save time we pass the EnableLanguage info directly
gg->EnableLanguagesFromGenerator
- (this->LocalGenerator->GetGlobalGenerator());
+ (this->LocalGenerator->GetGlobalGenerator(), this);
if(this->IsOn("CMAKE_SUPPRESS_DEVELOPER_WARNINGS"))
{
cm.AddCacheEntry("CMAKE_SUPPRESS_DEVELOPER_WARNINGS",
@@ -2975,35 +2991,100 @@ void cmMakefile::DisplayStatus(const char* message, float s)
std::string cmMakefile::GetModulesFile(const char* filename)
{
- std::vector<std::string> modulePath;
- const char* def = this->GetDefinition("CMAKE_MODULE_PATH");
- if(def)
+ std::string result;
+
+ // We search the module always in CMAKE_ROOT and in CMAKE_MODULE_PATH,
+ // and then decide based on the policy setting which one to return.
+ // See CMP0017 for more details.
+ // The specific problem was that KDE 4.5.0 installs a
+ // FindPackageHandleStandardArgs.cmake which doesn't have the new features
+ // of FPHSA.cmake introduced in CMake 2.8.3 yet, and by setting
+ // CMAKE_MODULE_PATH also e.g. FindZLIB.cmake from cmake included
+ // FPHSA.cmake from kdelibs and not from CMake, and tried to use the
+ // new features, which were not there in the version from kdelibs, and so
+ // failed ("
+ std::string moduleInCMakeRoot;
+ std::string moduleInCMakeModulePath;
+
+ // Always search in CMAKE_MODULE_PATH:
+ const char* cmakeModulePath = this->GetDefinition("CMAKE_MODULE_PATH");
+ if(cmakeModulePath)
+ {
+ std::vector<std::string> modulePath;
+ cmSystemTools::ExpandListArgument(cmakeModulePath, modulePath);
+
+ //Look through the possible module directories.
+ for(std::vector<std::string>::iterator i = modulePath.begin();
+ i != modulePath.end(); ++i)
+ {
+ std::string itempl = *i;
+ cmSystemTools::ConvertToUnixSlashes(itempl);
+ itempl += "/";
+ itempl += filename;
+ if(cmSystemTools::FileExists(itempl.c_str()))
+ {
+ moduleInCMakeModulePath = itempl;
+ break;
+ }
+ }
+ }
+
+ // Always search in the standard modules location.
+ const char* cmakeRoot = this->GetDefinition("CMAKE_ROOT");
+ if(cmakeRoot)
{
- cmSystemTools::ExpandListArgument(def, modulePath);
+ moduleInCMakeRoot = cmakeRoot;
+ moduleInCMakeRoot += "/Modules/";
+ moduleInCMakeRoot += filename;
+ cmSystemTools::ConvertToUnixSlashes(moduleInCMakeRoot);
+ if(!cmSystemTools::FileExists(moduleInCMakeRoot.c_str()))
+ {
+ moduleInCMakeRoot = "";
+ }
}
- // Also search in the standard modules location.
- def = this->GetDefinition("CMAKE_ROOT");
- if(def)
+ // Normally, prefer the files found in CMAKE_MODULE_PATH. Only when the file
+ // from which we are being called is located itself in CMAKE_ROOT, then
+ // prefer results from CMAKE_ROOT depending on the policy setting.
+ result = moduleInCMakeModulePath;
+ if (result.size() == 0)
{
- std::string rootModules = def;
- rootModules += "/Modules";
- modulePath.push_back(rootModules);
+ result = moduleInCMakeRoot;
}
- //std::string Look through the possible module directories.
- for(std::vector<std::string>::iterator i = modulePath.begin();
- i != modulePath.end(); ++i)
+
+ if ((moduleInCMakeModulePath.size()>0) && (moduleInCMakeRoot.size()>0))
{
- std::string itempl = *i;
- cmSystemTools::ConvertToUnixSlashes(itempl);
- itempl += "/";
- itempl += filename;
- if(cmSystemTools::FileExists(itempl.c_str()))
+ const char* currentFile = this->GetDefinition("CMAKE_CURRENT_LIST_FILE");
+ if (currentFile && (strstr(currentFile, cmakeRoot) == currentFile))
{
- return itempl;
+ switch (this->GetPolicyStatus(cmPolicies::CMP0017))
+ {
+ case cmPolicies::WARN:
+ {
+ cmOStringStream e;
+ e << "File " << currentFile << " includes "
+ << moduleInCMakeModulePath
+ << " (found via CMAKE_MODULE_PATH) which shadows "
+ << moduleInCMakeRoot << ". This may cause errors later on .\n"
+ << this->GetPolicies()->GetPolicyWarning(cmPolicies::CMP0017);
+
+ this->IssueMessage(cmake::AUTHOR_WARNING, e.str());
+ // break; // fall through to OLD behaviour
+ }
+ case cmPolicies::OLD:
+ result = moduleInCMakeModulePath;
+ break;
+ case cmPolicies::REQUIRED_IF_USED:
+ case cmPolicies::REQUIRED_ALWAYS:
+ case cmPolicies::NEW:
+ default:
+ result = moduleInCMakeRoot;
+ break;
+ }
}
}
- return "";
+
+ return result;
}
void cmMakefile::ConfigureString(const std::string& input,
@@ -3620,14 +3701,7 @@ void cmMakefile::DefineProperties(cmake *cm)
"are not supported by the native build tool. "
"The VS6 IDE does not support definition values with spaces "
"(but NMake does).\n"
- "Dislaimer: Most native build tools have poor support for escaping "
- "certain values. CMake has work-arounds for many cases but some "
- "values may just not be possible to pass correctly. If a value "
- "does not seem to be escaped correctly, do not attempt to "
- "work-around the problem by adding escape sequences to the value. "
- "Your work-around may break in a future version of CMake that "
- "has improved escape support. Instead consider defining the macro "
- "in a (configured) header file. Then report the limitation.");
+ CM_DOCUMENT_COMPILE_DEFINITIONS_DISCLAIMER);
cm->DefineProperty
("COMPILE_DEFINITIONS_<CONFIG>", cmProperty::DIRECTORY,
diff --git a/Source/cmPolicies.cxx b/Source/cmPolicies.cxx
index 3fe92de..2d1f792 100644
--- a/Source/cmPolicies.cxx
+++ b/Source/cmPolicies.cxx
@@ -446,6 +446,23 @@ cmPolicies::cmPolicies()
"wasn't a valid target. "
"In CMake 2.8.3 and above it reports an error in this case.",
2,8,3,0, cmPolicies::WARN);
+
+ this->DefinePolicy(
+ CMP0017, "CMP0017",
+ "Prefer files from the CMake module directory when including from there.",
+ "Starting with CMake 2.8.4, if a cmake-module shipped with CMake (i.e. "
+ "located in the CMake module directory) calls include() or "
+ "find_package(), the files located in the the CMake module directory are "
+ "prefered over the files in CMAKE_MODULE_PATH. "
+ "This makes sure that the modules belonging to "
+ "CMake always get those files included which they expect, and against "
+ "which they were developed and tested. "
+ "In call other cases, the files found in "
+ "CMAKE_MODULE_PATH still take precedence over the ones in "
+ "the CMake module directory. "
+ "The OLD behaviour is to always prefer files from CMAKE_MODULE_PATH over "
+ "files from the CMake modules directory.",
+ 2,8,4,0, cmPolicies::WARN);
}
cmPolicies::~cmPolicies()
@@ -495,9 +512,9 @@ bool cmPolicies::ApplyPolicyVersion(cmMakefile *mf,
std::string ver = "2.4.0";
if (version && strlen(version) > 0)
- {
+ {
ver = version;
- }
+ }
unsigned int majorVer = 2;
unsigned int minorVer = 0;
@@ -556,29 +573,33 @@ bool cmPolicies::ApplyPolicyVersion(cmMakefile *mf,
// now loop over all the policies and set them as appropriate
std::vector<cmPolicies::PolicyID> ancientPolicies;
- std::map<cmPolicies::PolicyID,cmPolicy *>::iterator i
- = this->Policies.begin();
- for (;i != this->Policies.end(); ++i)
- {
- if (i->second->IsPolicyNewerThan(majorVer,minorVer,patchVer,tweakVer))
+ for(std::map<cmPolicies::PolicyID,cmPolicy *>::iterator i
+ = this->Policies.begin(); i != this->Policies.end(); ++i)
{
- if(i->second->Status == cmPolicies::REQUIRED_ALWAYS)
+ if (i->second->IsPolicyNewerThan(majorVer,minorVer,patchVer,tweakVer))
{
+ if(i->second->Status == cmPolicies::REQUIRED_ALWAYS)
+ {
ancientPolicies.push_back(i->first);
+ }
+ else
+ {
+ cmPolicies::PolicyStatus status = cmPolicies::WARN;
+ if(!this->GetPolicyDefault(mf, i->second->IDString, &status) ||
+ !mf->SetPolicy(i->second->ID, status))
+ {
+ return false;
+ }
+ }
}
- else if (!mf->SetPolicy(i->second->ID, cmPolicies::WARN))
- {
- return false;
- }
- }
else
- {
- if (!mf->SetPolicy(i->second->ID, cmPolicies::NEW))
{
+ if (!mf->SetPolicy(i->second->ID, cmPolicies::NEW))
+ {
return false;
+ }
}
}
- }
// Make sure the project does not use any ancient policies.
if(!ancientPolicies.empty())
@@ -592,6 +613,36 @@ bool cmPolicies::ApplyPolicyVersion(cmMakefile *mf,
return true;
}
+//----------------------------------------------------------------------------
+bool cmPolicies::GetPolicyDefault(cmMakefile* mf, std::string const& policy,
+ cmPolicies::PolicyStatus* defaultSetting)
+{
+ std::string defaultVar = "CMAKE_POLICY_DEFAULT_" + policy;
+ std::string defaultValue = mf->GetSafeDefinition(defaultVar.c_str());
+ if(defaultValue == "NEW")
+ {
+ *defaultSetting = cmPolicies::NEW;
+ }
+ else if(defaultValue == "OLD")
+ {
+ *defaultSetting = cmPolicies::OLD;
+ }
+ else if(defaultValue == "")
+ {
+ *defaultSetting = cmPolicies::WARN;
+ }
+ else
+ {
+ cmOStringStream e;
+ e << defaultVar << " has value \"" << defaultValue
+ << "\" but must be \"OLD\", \"NEW\", or \"\" (empty).";
+ mf->IssueMessage(cmake::FATAL_ERROR, e.str().c_str());
+ return false;
+ }
+
+ return true;
+}
+
bool cmPolicies::GetPolicyID(const char *id, cmPolicies::PolicyID &pid)
{
if (!id || strlen(id) < 1)
diff --git a/Source/cmPolicies.h b/Source/cmPolicies.h
index fce33ac..2160f37 100644
--- a/Source/cmPolicies.h
+++ b/Source/cmPolicies.h
@@ -52,6 +52,7 @@ public:
CMP0014, // Input directories must have CMakeLists.txt
CMP0015, // link_directories() treats paths relative to source dir
CMP0016, // target_link_libraries() fails if only argument is not a target
+ CMP0017, // Prefer files in CMAKE_ROOT when including from CMAKE_ROOT
// Always the last entry. Useful mostly to avoid adding a comma
// the last policy when adding a new one.
@@ -102,6 +103,10 @@ public:
void DiagnoseAncientPolicies(std::vector<PolicyID> const& ancient,
unsigned int majorVer, unsigned int minorVer,
unsigned int patchVer, cmMakefile* mf);
+
+ bool GetPolicyDefault(cmMakefile* mf, std::string const& policy,
+ cmPolicies::PolicyStatus* defaultStatus);
+
};
#endif
diff --git a/Source/cmSourceFile.cxx b/Source/cmSourceFile.cxx
index b793cd5..ed1da7b 100644
--- a/Source/cmSourceFile.cxx
+++ b/Source/cmSourceFile.cxx
@@ -16,6 +16,7 @@
#include "cmMakefile.h"
#include "cmSystemTools.h"
#include "cmake.h"
+#include "cmDocumentCompileDefinitions.h"
//----------------------------------------------------------------------------
cmSourceFile::cmSourceFile(cmMakefile* mf, const char* name):
@@ -187,8 +188,13 @@ bool cmSourceFile::FindFullPath(std::string* error)
}
cmOStringStream e;
- e << "Cannot find source file \"" << this->Location.GetName() << "\"";
- e << ". Tried extensions";
+ std::string missing = this->Location.GetDirectory();
+ if(!missing.empty())
+ {
+ missing += "/";
+ }
+ missing += this->Location.GetName();
+ e << "Cannot find source file:\n " << missing << "\nTried extensions";
for(std::vector<std::string>::const_iterator ext = srcExts.begin();
ext != srcExts.end(); ++ext)
{
@@ -411,15 +417,7 @@ void cmSourceFile::DefineProperties(cmake *cm)
"The VS6 IDE does not support definition values with spaces "
"(but NMake does). Xcode does not support per-configuration "
"definitions on source files.\n"
- "Disclaimer: Most native build tools have poor support for escaping "
- "certain values. CMake has work-arounds for many cases but some "
- "values may just not be possible to pass correctly. If a value "
- "does not seem to be escaped correctly, do not attempt to "
- "work-around the problem by adding escape sequences to the value. "
- "Your work-around may break in a future version of CMake that "
- "has improved escape support. Instead consider defining the macro "
- "in a (configured) header file. Then report the limitation.");
-
+ CM_DOCUMENT_COMPILE_DEFINITIONS_DISCLAIMER);
cm->DefineProperty
("COMPILE_DEFINITIONS_<CONFIG>", cmProperty::SOURCE_FILE,
@@ -472,7 +470,9 @@ void cmSourceFile::DefineProperties(cmake *cm)
"What programming language is the file.",
"A property that can be set to indicate what programming language "
"the source file is. If it is not set the language is determined "
- "based on the file extension. Typical values are CXX C etc.");
+ "based on the file extension. Typical values are CXX C etc. Setting "
+ "this property for a file means this file will be compiled. "
+ "Do not set this for header or files that should not be compiled.");
cm->DefineProperty
("LOCATION", cmProperty::SOURCE_FILE,
diff --git a/Source/cmTarget.cxx b/Source/cmTarget.cxx
index ef274b4..72efce3 100644
--- a/Source/cmTarget.cxx
+++ b/Source/cmTarget.cxx
@@ -16,7 +16,9 @@
#include "cmLocalGenerator.h"
#include "cmGlobalGenerator.h"
#include "cmComputeLinkInformation.h"
+#include "cmDocumentCompileDefinitions.h"
#include "cmListFileCache.h"
+#include "cmGeneratorExpression.h"
#include <cmsys/RegularExpression.hxx>
#include <map>
#include <set>
@@ -145,14 +147,7 @@ void cmTarget::DefineProperties(cmake *cm)
"are not supported by the native build tool. "
"The VS6 IDE does not support definition values with spaces "
"(but NMake does).\n"
- "Dislaimer: Most native build tools have poor support for escaping "
- "certain values. CMake has work-arounds for many cases but some "
- "values may just not be possible to pass correctly. If a value "
- "does not seem to be escaped correctly, do not attempt to "
- "work-around the problem by adding escape sequences to the value. "
- "Your work-around may break in a future version of CMake that "
- "has improved escape support. Instead consider defining the macro "
- "in a (configured) header file. Then report the limitation.");
+ CM_DOCUMENT_COMPILE_DEFINITIONS_DISCLAIMER);
cm->DefineProperty
("COMPILE_DEFINITIONS_<CONFIG>", cmProperty::TARGET,
@@ -500,6 +495,15 @@ void cmTarget::DefineProperties(cmake *cm)
"value is the default. "
"See documentation of CMAKE_<LANG>_LINKER_PREFERENCE variables.");
+#define CM_LOCATION_UNDEFINED_BEHAVIOR \
+ "\n" \
+ "Do not set properties that affect the location of the target after " \
+ "reading this property. These include properties whose names match " \
+ "\"(RUNTIME|LIBRARY|ARCHIVE)_OUTPUT_(NAME|DIRECTORY)(_<CONFIG>)?\" " \
+ "or \"(IMPLIB_)?(PREFIX|SUFFIX)\". " \
+ "Failure to follow this rule is not diagnosed and leaves the location " \
+ "of the target undefined."
+
cm->DefineProperty
("LOCATION", cmProperty::TARGET,
"Read-only location of a target on disk.",
@@ -516,7 +520,10 @@ void cmTarget::DefineProperties(cmake *cm)
"In CMake 2.6 and above add_custom_command automatically recognizes a "
"target name in its COMMAND and DEPENDS options and computes the "
"target location. "
- "Therefore this property is not needed for creating custom commands.");
+ "In CMake 2.8.4 and above add_custom_command recognizes generator "
+ "expressions to refer to target locations anywhere in the command. "
+ "Therefore this property is not needed for creating custom commands."
+ CM_LOCATION_UNDEFINED_BEHAVIOR);
cm->DefineProperty
("LOCATION_<CONFIG>", cmProperty::TARGET,
@@ -529,7 +536,8 @@ void cmTarget::DefineProperties(cmake *cm)
"By default CMake looks for an exact-match but otherwise uses an "
"arbitrary available configuration. "
"Use the MAP_IMPORTED_CONFIG_<CONFIG> property to map imported "
- "configurations explicitly.");
+ "configurations explicitly."
+ CM_LOCATION_UNDEFINED_BEHAVIOR);
cm->DefineProperty
("LINK_DEPENDS", cmProperty::TARGET,
@@ -1402,6 +1410,7 @@ cmTargetTraceDependencies
{
// Transform command names that reference targets built in this
// project to corresponding target-level dependencies.
+ cmGeneratorExpression ge(this->Makefile, 0, cc.GetBacktrace(), true);
for(cmCustomCommandLines::const_iterator cit = cc.GetCommandLines().begin();
cit != cc.GetCommandLines().end(); ++cit)
{
@@ -1418,6 +1427,21 @@ cmTargetTraceDependencies
this->Target->AddUtility(command.c_str());
}
}
+
+ // Check for target references in generator expressions.
+ for(cmCustomCommandLine::const_iterator cli = cit->begin();
+ cli != cit->end(); ++cli)
+ {
+ ge.Process(*cli);
+ }
+ }
+
+ // Add target-level dependencies referenced by generator expressions.
+ std::set<cmTarget*> targets = ge.GetTargets();
+ for(std::set<cmTarget*>::iterator ti = targets.begin();
+ ti != targets.end(); ++ti)
+ {
+ this->Target->AddUtility((*ti)->GetName());
}
// Queue the custom command dependencies.
diff --git a/Source/cmTryCompileCommand.h b/Source/cmTryCompileCommand.h
index 3a30e4c..0c67a8b 100644
--- a/Source/cmTryCompileCommand.h
+++ b/Source/cmTryCompileCommand.h
@@ -47,7 +47,7 @@ public:
*/
virtual const char* GetTerseDocumentation()
{
- return "Try compiling some code.";
+ return "Try building some code.";
}
/**
@@ -55,23 +55,28 @@ public:
virtual const char* GetFullDocumentation()
{
return
- " try_compile(RESULT_VAR bindir srcdir\n"
- " projectName <targetname> [CMAKE_FLAGS <Flags>]\n"
- " [OUTPUT_VARIABLE var])\n"
- "Try compiling a program. In this form, srcdir should contain a "
- "complete CMake project with a CMakeLists.txt file and all sources. The "
- "bindir and srcdir will not be deleted after this command is run. "
- "If <target name> is specified then build just that target "
- "otherwise the all or ALL_BUILD target is built.\n"
- " try_compile(RESULT_VAR bindir srcfile\n"
- " [CMAKE_FLAGS <Flags>]\n"
- " [COMPILE_DEFINITIONS <flags> ...]\n"
- " [OUTPUT_VARIABLE var]\n"
- " [COPY_FILE <filename> )\n"
- "Try compiling a srcfile. In this case, the user need only supply a "
- "source file. CMake will create the appropriate CMakeLists.txt file "
- "to build the source. If COPY_FILE is used, the compiled file will be "
- "copied to the given file.\n"
+ " try_compile(RESULT_VAR <bindir> <srcdir>\n"
+ " <projectName> [targetName] [CMAKE_FLAGS flags...]\n"
+ " [OUTPUT_VARIABLE <var>])\n"
+ "Try building a project. In this form, srcdir should contain a "
+ "complete CMake project with a CMakeLists.txt file and all sources. "
+ "The bindir and srcdir will not be deleted after this command is run. "
+ "Specify targetName to build a specific target instead of the 'all' or "
+ "'ALL_BUILD' target."
+ "\n"
+ " try_compile(RESULT_VAR <bindir> <srcfile>\n"
+ " [CMAKE_FLAGS flags...]\n"
+ " [COMPILE_DEFINITIONS flags...]\n"
+ " [OUTPUT_VARIABLE <var>]\n"
+ " [COPY_FILE <fileName>])\n"
+ "Try building a source file into an executable. "
+ "In this form the user need only supply a source file that defines "
+ "a 'main'. "
+ "CMake will create a CMakeLists.txt file to build the source "
+ "as an executable. "
+ "Specify COPY_FILE to get a copy of the linked executable at the "
+ "given fileName."
+ "\n"
"In this version all files in bindir/CMakeFiles/CMakeTmp, "
"will be cleaned automatically, for debugging a --debug-trycompile can "
"be passed to cmake to avoid the clean. Some extra flags that "
@@ -94,7 +99,9 @@ public:
"Return the success or failure in "
"RESULT_VAR. CMAKE_FLAGS can be used to pass -DVAR:TYPE=VALUE flags "
"to the cmake that is run during the build. "
- "";
+ "Set variable CMAKE_TRY_COMPILE_CONFIGURATION to choose a build "
+ "configuration."
+ ;
}
cmTypeMacro(cmTryCompileCommand, cmCoreTryCompile);
diff --git a/Source/cmTryRunCommand.h b/Source/cmTryRunCommand.h
index ca48e90..f86d863 100644
--- a/Source/cmTryRunCommand.h
+++ b/Source/cmTryRunCommand.h
@@ -93,7 +93,10 @@ public:
"that when crosscompiling, the cache variables will have to be set "
"manually to the output of the executable. You can also \"guard\" the "
"calls to try_run with if(CMAKE_CROSSCOMPILING) and provide an "
- "easy-to-preset alternative for this case.\n";
+ "easy-to-preset alternative for this case.\n"
+ "Set variable CMAKE_TRY_COMPILE_CONFIGURATION to choose a build "
+ "configuration."
+ ;
}
cmTypeMacro(cmTryRunCommand, cmCoreTryCompile);
diff --git a/Source/cmVisualStudio10TargetGenerator.cxx b/Source/cmVisualStudio10TargetGenerator.cxx
index f78aeec..2d55e1e 100644
--- a/Source/cmVisualStudio10TargetGenerator.cxx
+++ b/Source/cmVisualStudio10TargetGenerator.cxx
@@ -376,13 +376,7 @@ cmVisualStudio10TargetGenerator::WriteCustomRule(cmSourceFile* source,
i != configs->end(); ++i)
{
std::string script =
- cmVS10EscapeXML(
- lg->ConstructScript(command.GetCommandLines(),
- command.GetWorkingDirectory(),
- i->c_str(),
- command.GetEscapeOldStyle(),
- command.GetEscapeAllowMakeVars())
- );
+ cmVS10EscapeXML(lg->ConstructScript(command, i->c_str()));
this->WritePlatformConfigTag("Message",i->c_str(), 3);
(*this->BuildFileStream ) << cmVS10EscapeXML(comment) << "</Message>\n";
this->WritePlatformConfigTag("Command", i->c_str(), 3);
@@ -442,6 +436,7 @@ void cmVisualStudio10TargetGenerator::WriteGroups()
std::vector<cmSourceFile*> customBuild;
std::vector<cmSourceFile*> none;
std::vector<cmSourceFile*> headers;
+ std::vector<cmSourceFile*> idls;
std::vector<cmSourceFile*> resource;
for(std::vector<cmSourceFile*>::const_iterator s = classes.begin();
@@ -464,7 +459,7 @@ void cmVisualStudio10TargetGenerator::WriteGroups()
{
clCompile.push_back(sf);
}
- if(strcmp(lang, "RC") == 0)
+ else if(strcmp(lang, "RC") == 0)
{
resource.push_back(sf);
}
@@ -476,6 +471,10 @@ void cmVisualStudio10TargetGenerator::WriteGroups()
{
headers.push_back(sf);
}
+ else if(sf->GetExtension() == "idl")
+ {
+ idls.push_back(sf);
+ }
else
{
none.push_back(sf);
@@ -504,6 +503,7 @@ void cmVisualStudio10TargetGenerator::WriteGroups()
this->WriteGroupSources("ClCompile", clCompile, sourceGroups);
this->WriteGroupSources("ClInclude", headers, sourceGroups);
this->WriteGroupSources("ResourceCompile", resource, sourceGroups);
+ this->WriteGroupSources("Midl", idls, sourceGroups);
this->WriteGroupSources("CustomBuild", customBuild, sourceGroups);
this->WriteString("<ItemGroup>\n", 1);
@@ -597,7 +597,11 @@ WriteGroupSources(const char* name,
for(std::vector<cmSourceFile*>::const_iterator s = sources.begin();
s != sources.end(); ++s)
{
- cmSourceFile* sf = *s;
+ cmSourceFile* sf = *s;
+ if(sf->GetExtension() == "obj")
+ {
+ continue;
+ }
std::string const& source = sf->GetFullPath();
cmSourceGroup& sourceGroup =
this->Makefile->FindSourceGroup(source.c_str(), sourceGroups);
@@ -657,7 +661,7 @@ void cmVisualStudio10TargetGenerator::WriteObjSources()
void cmVisualStudio10TargetGenerator::WriteCLSources()
{
- if(this->Target->GetType() > cmTarget::MODULE_LIBRARY)
+ if(this->Target->GetType() > cmTarget::UTILITY)
{
return;
}
@@ -666,50 +670,56 @@ void cmVisualStudio10TargetGenerator::WriteCLSources()
for(std::vector<cmSourceFile*>::const_iterator source = sources.begin();
source != sources.end(); ++source)
{
- // if it is not a custom command then add it as a c/c++ file,
- // TODO: need to check for idl or rc
- if(!(*source)->GetCustomCommand())
+ std::string ext = (*source)->GetExtension();
+ if((*source)->GetCustomCommand() || ext == "obj")
{
- bool header = (*source)->GetPropertyAsBool("HEADER_FILE_ONLY")
- || this->GlobalGenerator->IgnoreFile
- ((*source)->GetExtension().c_str());
- const char* lang = (*source)->GetLanguage();
- bool cl = lang && (strcmp(lang, "C") == 0 || strcmp(lang, "CXX") ==0);
- bool rc = lang && (strcmp(lang, "RC") == 0);
- std::string sourceFile = (*source)->GetFullPath();
- sourceFile = cmSystemTools::RelativePath(
- this->Makefile->GetCurrentOutputDirectory(),
- sourceFile.c_str());
- this->ConvertToWindowsSlash(sourceFile);
- // output the source file
- if(header)
- {
- this->WriteString("<ClInclude Include=\"", 2);
- }
- else if(cl)
- {
- this->WriteString("<ClCompile Include=\"", 2);
- }
- else if(rc)
- {
- this->WriteString("<ResourceCompile Include=\"", 2);
- }
- else
- {
- this->WriteString("<None Include=\"", 2);
- }
- (*this->BuildFileStream ) << sourceFile << "\"";
- // ouput any flags specific to this source file
- if(cl && this->OutputSourceSpecificFlags(*source))
- {
- // if the source file has specific flags the tag
- // is ended on a new line
- this->WriteString("</ClCompile>\n", 2);
- }
- else
- {
- (*this->BuildFileStream ) << " />\n";
- }
+ continue;
+ }
+ // If it is not a custom command and it is not a pre-built obj file,
+ // then add it as a source (c/c++/header/rc/idl) file
+ bool header = (*source)->GetPropertyAsBool("HEADER_FILE_ONLY")
+ || this->GlobalGenerator->IgnoreFile(ext.c_str());
+ const char* lang = (*source)->GetLanguage();
+ bool cl = lang && (strcmp(lang, "C") == 0 || strcmp(lang, "CXX") ==0);
+ bool rc = lang && (strcmp(lang, "RC") == 0);
+ bool idl = ext == "idl";
+ std::string sourceFile = (*source)->GetFullPath();
+ sourceFile = cmSystemTools::RelativePath(
+ this->Makefile->GetCurrentOutputDirectory(),
+ sourceFile.c_str());
+ this->ConvertToWindowsSlash(sourceFile);
+ // output the source file
+ if(header)
+ {
+ this->WriteString("<ClInclude Include=\"", 2);
+ }
+ else if(cl)
+ {
+ this->WriteString("<ClCompile Include=\"", 2);
+ }
+ else if(rc)
+ {
+ this->WriteString("<ResourceCompile Include=\"", 2);
+ }
+ else if(idl)
+ {
+ this->WriteString("<Midl Include=\"", 2);
+ }
+ else
+ {
+ this->WriteString("<None Include=\"", 2);
+ }
+ (*this->BuildFileStream ) << sourceFile << "\"";
+ // ouput any flags specific to this source file
+ if(!header && cl && this->OutputSourceSpecificFlags(*source))
+ {
+ // if the source file has specific flags the tag
+ // is ended on a new line
+ this->WriteString("</ClCompile>\n", 2);
+ }
+ else
+ {
+ (*this->BuildFileStream ) << " />\n";
}
}
this->WriteString("</ItemGroup>\n", 1);
@@ -1139,10 +1149,13 @@ OutputIncludes(std::vector<std::string> const & includes)
void cmVisualStudio10TargetGenerator::
-WriteRCOptions(std::string const& ,
+WriteRCOptions(std::string const& configName,
std::vector<std::string> const & includes)
{
this->WriteString("<ResourceCompile>\n", 2);
+ Options& clOptions = *(this->ClOptions[configName]);
+ clOptions.OutputPreprocessorDefinitions(*this->BuildFileStream, " ",
+ "\n");
this->OutputIncludes(includes);
this->WriteString("</ResourceCompile>\n", 2);
}
@@ -1400,11 +1413,20 @@ WriteMidlOptions(std::string const& /*config*/,
{
this->WriteString("<Midl>\n", 2);
this->OutputIncludes(includes);
+ this->WriteString("<OutputDirectory>$(IntDir)</OutputDirectory>\n", 3);
+ this->WriteString("<HeaderFileName>%(Filename).h</HeaderFileName>\n", 3);
+ this->WriteString(
+ "<TypeLibraryName>%(Filename).tlb</TypeLibraryName>\n", 3);
+ this->WriteString(
+ "<InterfaceIdentifierFileName>"
+ "%(Filename)_i.c</InterfaceIdentifierFileName>\n", 3);
+ this->WriteString("<ProxyFileName>%(Filename)_p.c</ProxyFileName>\n",3);
this->WriteString("</Midl>\n", 2);
}
-
+
+
void cmVisualStudio10TargetGenerator::WriteItemDefinitionGroups()
-{
+{
std::vector<std::string> *configs =
static_cast<cmGlobalVisualStudio7Generator *>
(this->GlobalGenerator)->GetConfigurations();
@@ -1469,13 +1491,7 @@ void cmVisualStudio10TargetGenerator::WriteEvent(
script += pre;
pre = "\n";
script +=
- cmVS10EscapeXML(
- lg->ConstructScript(command.GetCommandLines(),
- command.GetWorkingDirectory(),
- configName.c_str(),
- command.GetEscapeOldStyle(),
- command.GetEscapeAllowMakeVars())
- );
+ cmVS10EscapeXML(lg->ConstructScript(command, configName.c_str()));
}
comment = cmVS10EscapeComment(comment);
this->WriteString("<Message>",3);
diff --git a/Source/cmVisualStudioGeneratorOptions.cxx b/Source/cmVisualStudioGeneratorOptions.cxx
index f1bad9c..9acae0d 100644
--- a/Source/cmVisualStudioGeneratorOptions.cxx
+++ b/Source/cmVisualStudioGeneratorOptions.cxx
@@ -85,17 +85,15 @@ void cmVisualStudioGeneratorOptions::SetVerboseMakefile(bool verbose)
// was not given explicitly in the flags we want to add an attribute
// to the generated project to disable logo suppression. Otherwise
// the GUI default is to enable suppression.
+ //
+ // Avoid this on Visual Studio 10 (and later!) because it results in:
+ // "cl ... warning D9035: option 'nologo-' has been deprecated"
+ //
if(verbose &&
+ this->Version != 10 &&
this->FlagMap.find("SuppressStartupBanner") == this->FlagMap.end())
{
- if(this->Version == 10)
- {
- this->FlagMap["SuppressStartupBanner"] = "false";
- }
- else
- {
- this->FlagMap["SuppressStartupBanner"] = "FALSE";
- }
+ this->FlagMap["SuppressStartupBanner"] = "FALSE";
}
}
diff --git a/Source/cmWin32ProcessExecution.cxx b/Source/cmWin32ProcessExecution.cxx
index d9bd26c..f37e0ff 100644
--- a/Source/cmWin32ProcessExecution.cxx
+++ b/Source/cmWin32ProcessExecution.cxx
@@ -290,7 +290,8 @@ static BOOL RealPopenCreateProcess(const char *cmdstring,
{
PROCESS_INFORMATION piProcInfo;
STARTUPINFO siStartInfo;
- char *s1=0,*s2=0, *s3 = " /c ";
+ char *s1=0,*s2=0;
+ const char *s3 = " /c ";
int i = GetEnvironmentVariable("COMSPEC",NULL,0);
if (i)
{
diff --git a/Source/kwsys/Registry.cxx b/Source/kwsys/Registry.cxx
index 284e8ad..cd521c9 100644
--- a/Source/kwsys/Registry.cxx
+++ b/Source/kwsys/Registry.cxx
@@ -401,8 +401,9 @@ bool RegistryHelper::Open(const char *toplevel, const char *subkey,
}
else
{
+ char lpClass[] = "";
res = ( RegCreateKeyEx(scope, str.str().c_str(),
- 0, "", REG_OPTION_NON_VOLATILE, KEY_READ|KEY_WRITE,
+ 0, lpClass, REG_OPTION_NON_VOLATILE, KEY_READ|KEY_WRITE,
NULL, &this->HKey, &dwDummy) == ERROR_SUCCESS );
}
if ( res != 0 )
diff --git a/Source/kwsys/SystemInformation.cxx b/Source/kwsys/SystemInformation.cxx
index 4818ce9..9bc659e 100644
--- a/Source/kwsys/SystemInformation.cxx
+++ b/Source/kwsys/SystemInformation.cxx
@@ -66,7 +66,6 @@
#endif
#ifdef __linux
-# include <sys/procfs.h>
# include <sys/types.h>
# include <unistd.h>
# include <fcntl.h>
@@ -151,10 +150,6 @@ public:
void RunMemoryCheck();
public:
-#define VENDOR_STRING_LENGTH (12 + 1)
-#define CHIPNAME_STRING_LENGTH (48 + 1)
-#define SERIALNUMBER_STRING_LENGTH (29 + 1)
-
typedef struct tagID
{
int Type;
@@ -163,9 +158,9 @@ public:
int Revision;
int ExtendedFamily;
int ExtendedModel;
- char ProcessorName[CHIPNAME_STRING_LENGTH];
- char Vendor[VENDOR_STRING_LENGTH];
- char SerialNumber[SERIALNUMBER_STRING_LENGTH];
+ kwsys_stl::string ProcessorName;
+ kwsys_stl::string Vendor;
+ kwsys_stl::string SerialNumber;
} ID;
typedef struct tagCPUPowerManagement
@@ -269,6 +264,10 @@ protected:
//For Haiku OS
bool QueryHaikuInfo();
+ //For QNX
+ bool QueryQNXMemory();
+ bool QueryQNXProcessor();
+
// Evaluate the memory information.
int QueryMemory();
size_t TotalVirtualMemory;
@@ -530,7 +529,12 @@ SystemInformationImplementation::SystemInformationImplementation()
this->CurrentPositionInFile = 0;
this->ChipManufacturer = UnknownManufacturer;
memset(&this->Features, 0, sizeof(CPUFeatures));
- memset(&this->ChipID, 0, sizeof(ID));
+ this->ChipID.Type = 0;
+ this->ChipID.Family = 0;
+ this->ChipID.Model = 0;
+ this->ChipID.Revision = 0;
+ this->ChipID.ExtendedFamily = 0;
+ this->ChipID.ExtendedModel = 0;
this->CPUSpeedInMHz = 0;
this->NumberOfLogicalCPU = 0;
this->NumberOfPhysicalCPU = 0;
@@ -597,6 +601,8 @@ void SystemInformationImplementation::RunCPUCheck()
this->QuerySolarisInfo();
#elif defined(__HAIKU__)
this->QueryHaikuInfo();
+#elif defined(__QNX__)
+ this->QueryQNXProcessor();
#else
this->RetreiveInformationFromCpuInfoFile();
#endif
@@ -615,6 +621,8 @@ void SystemInformationImplementation::RunMemoryCheck()
this->QuerySolarisInfo();
#elif defined(__HAIKU__)
this->QueryHaikuInfo();
+#elif defined(__QNX__)
+ this->QueryQNXMemory();
#else
this->QueryMemory();
#endif
@@ -623,7 +631,7 @@ void SystemInformationImplementation::RunMemoryCheck()
/** Get the vendor string */
const char * SystemInformationImplementation::GetVendorString()
{
- return this->ChipID.Vendor;
+ return this->ChipID.Vendor.c_str();
}
/** Get the OS Name */
@@ -726,14 +734,14 @@ kwsys_stl::string SystemInformationImplementation::GetSteppingCode()
/** Return the stepping code of the CPU present. */
const char * SystemInformationImplementation::GetExtendedProcessorName()
{
- return this->ChipID.ProcessorName;
+ return this->ChipID.ProcessorName.c_str();
}
/** Return the serial number of the processor
* in hexadecimal: xxxx-xxxx-xxxx-xxxx-xxxx-xxxx. */
const char * SystemInformationImplementation::GetProcessorSerialNumber()
{
- return this->ChipID.SerialNumber;
+ return this->ChipID.SerialNumber.c_str();
}
/** Return the logical processors per physical */
@@ -1022,21 +1030,21 @@ bool SystemInformationImplementation::RetrieveCPUFeatures()
/** Find the manufacturer given the vendor id */
void SystemInformationImplementation::FindManufacturer()
{
- if (strcmp (this->ChipID.Vendor, "GenuineIntel") == 0) this->ChipManufacturer = Intel; // Intel Corp.
- else if (strcmp (this->ChipID.Vendor, "UMC UMC UMC ") == 0) this->ChipManufacturer = UMC; // United Microelectronics Corp.
- else if (strcmp (this->ChipID.Vendor, "AuthenticAMD") == 0) this->ChipManufacturer = AMD; // Advanced Micro Devices
- else if (strcmp (this->ChipID.Vendor, "AMD ISBETTER") == 0) this->ChipManufacturer = AMD; // Advanced Micro Devices (1994)
- else if (strcmp (this->ChipID.Vendor, "CyrixInstead") == 0) this->ChipManufacturer = Cyrix; // Cyrix Corp., VIA Inc.
- else if (strcmp (this->ChipID.Vendor, "NexGenDriven") == 0) this->ChipManufacturer = NexGen; // NexGen Inc. (now AMD)
- else if (strcmp (this->ChipID.Vendor, "CentaurHauls") == 0) this->ChipManufacturer = IDT; // IDT/Centaur (now VIA)
- else if (strcmp (this->ChipID.Vendor, "RiseRiseRise") == 0) this->ChipManufacturer = Rise; // Rise
- else if (strcmp (this->ChipID.Vendor, "GenuineTMx86") == 0) this->ChipManufacturer = Transmeta; // Transmeta
- else if (strcmp (this->ChipID.Vendor, "TransmetaCPU") == 0) this->ChipManufacturer = Transmeta; // Transmeta
- else if (strcmp (this->ChipID.Vendor, "Geode By NSC") == 0) this->ChipManufacturer = NSC; // National Semiconductor
- else if (strcmp (this->ChipID.Vendor, "Sun") == 0) this->ChipManufacturer = Sun; // Sun Microelectronics
- else if (strcmp (this->ChipID.Vendor, "IBM") == 0) this->ChipManufacturer = IBM; // IBM Microelectronics
- else if (strcmp (this->ChipID.Vendor, "Motorola") == 0) this->ChipManufacturer = Motorola; // Motorola Microelectronics
- else this->ChipManufacturer = UnknownManufacturer; // Unknown manufacturer
+ if (this->ChipID.Vendor == "GenuineIntel") this->ChipManufacturer = Intel; // Intel Corp.
+ else if (this->ChipID.Vendor == "UMC UMC UMC ") this->ChipManufacturer = UMC; // United Microelectronics Corp.
+ else if (this->ChipID.Vendor == "AuthenticAMD") this->ChipManufacturer = AMD; // Advanced Micro Devices
+ else if (this->ChipID.Vendor == "AMD ISBETTER") this->ChipManufacturer = AMD; // Advanced Micro Devices (1994)
+ else if (this->ChipID.Vendor == "CyrixInstead") this->ChipManufacturer = Cyrix; // Cyrix Corp., VIA Inc.
+ else if (this->ChipID.Vendor == "NexGenDriven") this->ChipManufacturer = NexGen; // NexGen Inc. (now AMD)
+ else if (this->ChipID.Vendor == "CentaurHauls") this->ChipManufacturer = IDT; // IDT/Centaur (now VIA)
+ else if (this->ChipID.Vendor == "RiseRiseRise") this->ChipManufacturer = Rise; // Rise
+ else if (this->ChipID.Vendor == "GenuineTMx86") this->ChipManufacturer = Transmeta; // Transmeta
+ else if (this->ChipID.Vendor == "TransmetaCPU") this->ChipManufacturer = Transmeta; // Transmeta
+ else if (this->ChipID.Vendor == "Geode By NSC") this->ChipManufacturer = NSC; // National Semiconductor
+ else if (this->ChipID.Vendor == "Sun") this->ChipManufacturer = Sun; // Sun Microelectronics
+ else if (this->ChipID.Vendor == "IBM") this->ChipManufacturer = IBM; // IBM Microelectronics
+ else if (this->ChipID.Vendor == "Motorola") this->ChipManufacturer = Motorola; // Motorola Microelectronics
+ else this->ChipManufacturer = UnknownManufacturer; // Unknown manufacturer
}
@@ -1094,10 +1102,12 @@ bool SystemInformationImplementation::RetrieveCPUIdentity()
}
// Process the returned information.
- memcpy (this->ChipID.Vendor, &(localCPUVendor[0]), sizeof (int));
- memcpy (&(this->ChipID.Vendor[4]), &(localCPUVendor[1]), sizeof (int));
- memcpy (&(this->ChipID.Vendor[8]), &(localCPUVendor[2]), sizeof (int));
- this->ChipID.Vendor[12] = '\0';
+ char vbuf[13];
+ memcpy (&(vbuf[0]), &(localCPUVendor[0]), sizeof (int));
+ memcpy (&(vbuf[4]), &(localCPUVendor[1]), sizeof (int));
+ memcpy (&(vbuf[8]), &(localCPUVendor[2]), sizeof (int));
+ vbuf[12] = '\0';
+ this->ChipID.Vendor = vbuf;
this->FindManufacturer();
@@ -1546,17 +1556,17 @@ bool SystemInformationImplementation::RetrieveClassicalCPUClockSpeed()
if (this->ChipID.Family == 3)
{
// 80386 processors.... Loop time is 115 cycles!
- dFrequency = (((CLASSICAL_CPU_FREQ_LOOP * 115) / dDifference) / 1048576);
+ dFrequency = (((CLASSICAL_CPU_FREQ_LOOP * 115) / dDifference) / 1000000);
}
else if (this->ChipID.Family == 4)
{
// 80486 processors.... Loop time is 47 cycles!
- dFrequency = (((CLASSICAL_CPU_FREQ_LOOP * 47) / dDifference) / 1048576);
+ dFrequency = (((CLASSICAL_CPU_FREQ_LOOP * 47) / dDifference) / 1000000);
}
else if (this->ChipID.Family == 5)
{
// Pentium processors.... Loop time is 43 cycles!
- dFrequency = (((CLASSICAL_CPU_FREQ_LOOP * 43) / dDifference) / 1048576);
+ dFrequency = (((CLASSICAL_CPU_FREQ_LOOP * 43) / dDifference) / 1000000);
}
// Save the clock speed.
@@ -1792,7 +1802,8 @@ bool SystemInformationImplementation::RetrieveProcessorSerialNumber()
}
// Process the returned information.
- sprintf (this->ChipID.SerialNumber, "%.2x%.2x-%.2x%.2x-%.2x%.2x-%.2x%.2x-%.2x%.2x-%.2x%.2x",
+ char sn[128];
+ sprintf (sn, "%.2x%.2x-%.2x%.2x-%.2x%.2x-%.2x%.2x-%.2x%.2x-%.2x%.2x",
((SerialNumber[0] & 0xff000000) >> 24),
((SerialNumber[0] & 0x00ff0000) >> 16),
((SerialNumber[0] & 0x0000ff00) >> 8),
@@ -1805,7 +1816,7 @@ bool SystemInformationImplementation::RetrieveProcessorSerialNumber()
((SerialNumber[2] & 0x00ff0000) >> 16),
((SerialNumber[2] & 0x0000ff00) >> 8),
((SerialNumber[2] & 0x000000ff) >> 0));
-
+ this->ChipID.SerialNumber = sn;
return true;
#else
@@ -1873,6 +1884,15 @@ bool SystemInformationImplementation::RetrieveCPUPowerManagement()
#endif
}
+void SystemInformationStripLeadingSpace(kwsys_stl::string& str)
+{
+ // Because some manufacturers have leading white space - we have to post-process the name.
+ kwsys_stl::string::size_type pos = str.find_first_not_of(" ");
+ if(pos != kwsys_stl::string::npos)
+ {
+ str = str.substr(pos);
+ }
+}
/** */
bool SystemInformationImplementation::RetrieveExtendedCPUIdentity()
@@ -1886,7 +1906,6 @@ bool SystemInformationImplementation::RetrieveExtendedCPUIdentity()
return false;
#if USE_ASM_INSTRUCTIONS
- int ProcessorNameStartPos = 0;
int CPUExtendedIdentity[12];
// Use assembly to detect CPUID information...
@@ -1942,47 +1961,25 @@ bool SystemInformationImplementation::RetrieveExtendedCPUIdentity()
}
// Process the returned information.
- memcpy (this->ChipID.ProcessorName, &(CPUExtendedIdentity[0]), sizeof (int));
- memcpy (&(this->ChipID.ProcessorName[4]), &(CPUExtendedIdentity[1]), sizeof (int));
- memcpy (&(this->ChipID.ProcessorName[8]), &(CPUExtendedIdentity[2]), sizeof (int));
- memcpy (&(this->ChipID.ProcessorName[12]), &(CPUExtendedIdentity[3]), sizeof (int));
- memcpy (&(this->ChipID.ProcessorName[16]), &(CPUExtendedIdentity[4]), sizeof (int));
- memcpy (&(this->ChipID.ProcessorName[20]), &(CPUExtendedIdentity[5]), sizeof (int));
- memcpy (&(this->ChipID.ProcessorName[24]), &(CPUExtendedIdentity[6]), sizeof (int));
- memcpy (&(this->ChipID.ProcessorName[28]), &(CPUExtendedIdentity[7]), sizeof (int));
- memcpy (&(this->ChipID.ProcessorName[32]), &(CPUExtendedIdentity[8]), sizeof (int));
- memcpy (&(this->ChipID.ProcessorName[36]), &(CPUExtendedIdentity[9]), sizeof (int));
- memcpy (&(this->ChipID.ProcessorName[40]), &(CPUExtendedIdentity[10]), sizeof (int));
- memcpy (&(this->ChipID.ProcessorName[44]), &(CPUExtendedIdentity[11]), sizeof (int));
- this->ChipID.ProcessorName[48] = '\0';
+ char nbuf[49];
+ memcpy (&(nbuf[0]), &(CPUExtendedIdentity[0]), sizeof (int));
+ memcpy (&(nbuf[4]), &(CPUExtendedIdentity[1]), sizeof (int));
+ memcpy (&(nbuf[8]), &(CPUExtendedIdentity[2]), sizeof (int));
+ memcpy (&(nbuf[12]), &(CPUExtendedIdentity[3]), sizeof (int));
+ memcpy (&(nbuf[16]), &(CPUExtendedIdentity[4]), sizeof (int));
+ memcpy (&(nbuf[20]), &(CPUExtendedIdentity[5]), sizeof (int));
+ memcpy (&(nbuf[24]), &(CPUExtendedIdentity[6]), sizeof (int));
+ memcpy (&(nbuf[28]), &(CPUExtendedIdentity[7]), sizeof (int));
+ memcpy (&(nbuf[32]), &(CPUExtendedIdentity[8]), sizeof (int));
+ memcpy (&(nbuf[36]), &(CPUExtendedIdentity[9]), sizeof (int));
+ memcpy (&(nbuf[40]), &(CPUExtendedIdentity[10]), sizeof (int));
+ memcpy (&(nbuf[44]), &(CPUExtendedIdentity[11]), sizeof (int));
+ nbuf[48] = '\0';
+ this->ChipID.ProcessorName = nbuf;
// Because some manufacturers have leading white space - we have to post-process the name.
- if (this->ChipManufacturer == Intel)
- {
- for (int nCounter = 0; nCounter < CHIPNAME_STRING_LENGTH; nCounter ++)
- {
- // There will either be NULL (\0) or spaces ( ) as the leading characters.
- if ((this->ChipID.ProcessorName[nCounter] != '\0') && (this->ChipID.ProcessorName[nCounter] != ' '))
- {
- // We have found the starting position of the name.
- ProcessorNameStartPos = nCounter;
- // Terminate the loop.
- break;
- }
- }
-
- // Check to see if there is any white space at the start.
- if (ProcessorNameStartPos == 0)
- {
- return true;
- }
-
- // Now move the name forward so that there is no white space.
- memmove(this->ChipID.ProcessorName, &(this->ChipID.ProcessorName[ProcessorNameStartPos]), (CHIPNAME_STRING_LENGTH - ProcessorNameStartPos));
- }
-
+ SystemInformationStripLeadingSpace(this->ChipID.ProcessorName);
return true;
-
#else
return false;
#endif
@@ -1999,53 +1996,53 @@ bool SystemInformationImplementation::RetrieveClassicalCPUIdentity()
// Check the family / model / revision to determine the CPU ID.
switch (this->ChipID.Family) {
case 3:
- sprintf (this->ChipID.ProcessorName, "Newer i80386 family");
+ this->ChipID.ProcessorName = "Newer i80386 family";
break;
case 4:
switch (this->ChipID.Model) {
- case 0: sprintf (this->ChipID.ProcessorName,"i80486DX-25/33"); break;
- case 1: sprintf (this->ChipID.ProcessorName,"i80486DX-50"); break;
- case 2: sprintf (this->ChipID.ProcessorName,"i80486SX"); break;
- case 3: sprintf (this->ChipID.ProcessorName,"i80486DX2"); break;
- case 4: sprintf (this->ChipID.ProcessorName,"i80486SL"); break;
- case 5: sprintf (this->ChipID.ProcessorName,"i80486SX2"); break;
- case 7: sprintf (this->ChipID.ProcessorName,"i80486DX2 WriteBack"); break;
- case 8: sprintf (this->ChipID.ProcessorName,"i80486DX4"); break;
- case 9: sprintf (this->ChipID.ProcessorName,"i80486DX4 WriteBack"); break;
- default: sprintf (this->ChipID.ProcessorName,"Unknown 80486 family"); return false;
+ case 0: this->ChipID.ProcessorName = "i80486DX-25/33"; break;
+ case 1: this->ChipID.ProcessorName = "i80486DX-50"; break;
+ case 2: this->ChipID.ProcessorName = "i80486SX"; break;
+ case 3: this->ChipID.ProcessorName = "i80486DX2"; break;
+ case 4: this->ChipID.ProcessorName = "i80486SL"; break;
+ case 5: this->ChipID.ProcessorName = "i80486SX2"; break;
+ case 7: this->ChipID.ProcessorName = "i80486DX2 WriteBack"; break;
+ case 8: this->ChipID.ProcessorName = "i80486DX4"; break;
+ case 9: this->ChipID.ProcessorName = "i80486DX4 WriteBack"; break;
+ default: this->ChipID.ProcessorName = "Unknown 80486 family"; return false;
}
break;
case 5:
switch (this->ChipID.Model)
{
- case 0: sprintf (this->ChipID.ProcessorName,"P5 A-Step"); break;
- case 1: sprintf (this->ChipID.ProcessorName,"P5"); break;
- case 2: sprintf (this->ChipID.ProcessorName,"P54C"); break;
- case 3: sprintf (this->ChipID.ProcessorName,"P24T OverDrive"); break;
- case 4: sprintf (this->ChipID.ProcessorName,"P55C"); break;
- case 7: sprintf (this->ChipID.ProcessorName,"P54C"); break;
- case 8: sprintf (this->ChipID.ProcessorName,"P55C (0.25micron)"); break;
- default: sprintf (this->ChipID.ProcessorName,"Unknown Pentium family"); return false;
+ case 0: this->ChipID.ProcessorName = "P5 A-Step"; break;
+ case 1: this->ChipID.ProcessorName = "P5"; break;
+ case 2: this->ChipID.ProcessorName = "P54C"; break;
+ case 3: this->ChipID.ProcessorName = "P24T OverDrive"; break;
+ case 4: this->ChipID.ProcessorName = "P55C"; break;
+ case 7: this->ChipID.ProcessorName = "P54C"; break;
+ case 8: this->ChipID.ProcessorName = "P55C (0.25micron)"; break;
+ default: this->ChipID.ProcessorName = "Unknown Pentium family"; return false;
}
break;
case 6:
switch (this->ChipID.Model)
{
- case 0: sprintf (this->ChipID.ProcessorName,"P6 A-Step"); break;
- case 1: sprintf (this->ChipID.ProcessorName,"P6"); break;
- case 3: sprintf (this->ChipID.ProcessorName,"Pentium II (0.28 micron)"); break;
- case 5: sprintf (this->ChipID.ProcessorName,"Pentium II (0.25 micron)"); break;
- case 6: sprintf (this->ChipID.ProcessorName,"Pentium II With On-Die L2 Cache"); break;
- case 7: sprintf (this->ChipID.ProcessorName,"Pentium III (0.25 micron)"); break;
- case 8: sprintf (this->ChipID.ProcessorName,"Pentium III (0.18 micron) With 256 KB On-Die L2 Cache "); break;
- case 0xa: sprintf (this->ChipID.ProcessorName,"Pentium III (0.18 micron) With 1 Or 2 MB On-Die L2 Cache "); break;
- case 0xb: sprintf (this->ChipID.ProcessorName,"Pentium III (0.13 micron) With 256 Or 512 KB On-Die L2 Cache "); break;
- case 23: sprintf (this->ChipID.ProcessorName, "Intel(R) Core(TM)2 Duo CPU T9500 @ 2.60GHz"); break;
- default: sprintf (this->ChipID.ProcessorName,"Unknown P6 family"); return false;
+ case 0: this->ChipID.ProcessorName = "P6 A-Step"; break;
+ case 1: this->ChipID.ProcessorName = "P6"; break;
+ case 3: this->ChipID.ProcessorName = "Pentium II (0.28 micron)"; break;
+ case 5: this->ChipID.ProcessorName = "Pentium II (0.25 micron)"; break;
+ case 6: this->ChipID.ProcessorName = "Pentium II With On-Die L2 Cache"; break;
+ case 7: this->ChipID.ProcessorName = "Pentium III (0.25 micron)"; break;
+ case 8: this->ChipID.ProcessorName = "Pentium III (0.18 micron) With 256 KB On-Die L2 Cache "; break;
+ case 0xa: this->ChipID.ProcessorName = "Pentium III (0.18 micron) With 1 Or 2 MB On-Die L2 Cache "; break;
+ case 0xb: this->ChipID.ProcessorName = "Pentium III (0.13 micron) With 256 Or 512 KB On-Die L2 Cache "; break;
+ case 23: this->ChipID.ProcessorName = "Intel(R) Core(TM)2 Duo CPU T9500 @ 2.60GHz"; break;
+ default: this->ChipID.ProcessorName = "Unknown P6 family"; return false;
}
break;
case 7:
- sprintf (this->ChipID.ProcessorName,"Intel Merced (IA-64)");
+ this->ChipID.ProcessorName = "Intel Merced (IA-64)";
break;
case 0xf:
// Check the extended family bits...
@@ -2054,21 +2051,21 @@ bool SystemInformationImplementation::RetrieveClassicalCPUIdentity()
case 0:
switch (this->ChipID.Model)
{
- case 0: sprintf (this->ChipID.ProcessorName,"Pentium IV (0.18 micron)"); break;
- case 1: sprintf (this->ChipID.ProcessorName,"Pentium IV (0.18 micron)"); break;
- case 2: sprintf (this->ChipID.ProcessorName,"Pentium IV (0.13 micron)"); break;
- default: sprintf (this->ChipID.ProcessorName,"Unknown Pentium 4 family"); return false;
+ case 0: this->ChipID.ProcessorName = "Pentium IV (0.18 micron)"; break;
+ case 1: this->ChipID.ProcessorName = "Pentium IV (0.18 micron)"; break;
+ case 2: this->ChipID.ProcessorName = "Pentium IV (0.13 micron)"; break;
+ default: this->ChipID.ProcessorName = "Unknown Pentium 4 family"; return false;
}
break;
case 1:
- sprintf (this->ChipID.ProcessorName,"Intel McKinley (IA-64)");
+ this->ChipID.ProcessorName = "Intel McKinley (IA-64)";
break;
default:
- sprintf (this->ChipID.ProcessorName,"Pentium");
+ this->ChipID.ProcessorName = "Pentium";
}
break;
default:
- sprintf (this->ChipID.ProcessorName,"Unknown Intel family");
+ this->ChipID.ProcessorName = "Unknown Intel family";
return false;
}
break;
@@ -2080,49 +2077,49 @@ bool SystemInformationImplementation::RetrieveClassicalCPUIdentity()
case 4:
switch (this->ChipID.Model)
{
- case 3: sprintf (this->ChipID.ProcessorName,"80486DX2"); break;
- case 7: sprintf (this->ChipID.ProcessorName,"80486DX2 WriteBack"); break;
- case 8: sprintf (this->ChipID.ProcessorName,"80486DX4"); break;
- case 9: sprintf (this->ChipID.ProcessorName,"80486DX4 WriteBack"); break;
- case 0xe: sprintf (this->ChipID.ProcessorName,"5x86"); break;
- case 0xf: sprintf (this->ChipID.ProcessorName,"5x86WB"); break;
- default: sprintf (this->ChipID.ProcessorName,"Unknown 80486 family"); return false;
+ case 3: this->ChipID.ProcessorName = "80486DX2"; break;
+ case 7: this->ChipID.ProcessorName = "80486DX2 WriteBack"; break;
+ case 8: this->ChipID.ProcessorName = "80486DX4"; break;
+ case 9: this->ChipID.ProcessorName = "80486DX4 WriteBack"; break;
+ case 0xe: this->ChipID.ProcessorName = "5x86"; break;
+ case 0xf: this->ChipID.ProcessorName = "5x86WB"; break;
+ default: this->ChipID.ProcessorName = "Unknown 80486 family"; return false;
}
break;
case 5:
switch (this->ChipID.Model)
{
- case 0: sprintf (this->ChipID.ProcessorName,"SSA5 (PR75, PR90, PR100)"); break;
- case 1: sprintf (this->ChipID.ProcessorName,"5k86 (PR120, PR133)"); break;
- case 2: sprintf (this->ChipID.ProcessorName,"5k86 (PR166)"); break;
- case 3: sprintf (this->ChipID.ProcessorName,"5k86 (PR200)"); break;
- case 6: sprintf (this->ChipID.ProcessorName,"K6 (0.30 micron)"); break;
- case 7: sprintf (this->ChipID.ProcessorName,"K6 (0.25 micron)"); break;
- case 8: sprintf (this->ChipID.ProcessorName,"K6-2"); break;
- case 9: sprintf (this->ChipID.ProcessorName,"K6-III"); break;
- case 0xd: sprintf (this->ChipID.ProcessorName,"K6-2+ or K6-III+ (0.18 micron)"); break;
- default: sprintf (this->ChipID.ProcessorName,"Unknown 80586 family"); return false;
+ case 0: this->ChipID.ProcessorName = "SSA5 (PR75, PR90 = PR100)"; break;
+ case 1: this->ChipID.ProcessorName = "5k86 (PR120 = PR133)"; break;
+ case 2: this->ChipID.ProcessorName = "5k86 (PR166)"; break;
+ case 3: this->ChipID.ProcessorName = "5k86 (PR200)"; break;
+ case 6: this->ChipID.ProcessorName = "K6 (0.30 micron)"; break;
+ case 7: this->ChipID.ProcessorName = "K6 (0.25 micron)"; break;
+ case 8: this->ChipID.ProcessorName = "K6-2"; break;
+ case 9: this->ChipID.ProcessorName = "K6-III"; break;
+ case 0xd: this->ChipID.ProcessorName = "K6-2+ or K6-III+ (0.18 micron)"; break;
+ default: this->ChipID.ProcessorName = "Unknown 80586 family"; return false;
}
break;
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: this->ChipID.ProcessorName = "Athlon- (0.25 micron)"; break;
+ case 2: this->ChipID.ProcessorName = "Athlon- (0.18 micron)"; break;
+ case 3: this->ChipID.ProcessorName = "Duron- (SF core)"; break;
+ case 4: this->ChipID.ProcessorName = "Athlon- (Thunderbird core)"; break;
+ case 6: this->ChipID.ProcessorName = "Athlon- (Palomino core)"; break;
+ case 7: 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)");
+ this->ChipID.ProcessorName = "Athlon - MP (Thoroughbred core)";
+ else this->ChipID.ProcessorName = "Athlon - XP (Thoroughbred core)";
break;
- default: sprintf (this->ChipID.ProcessorName,"Unknown K7 family"); return false;
+ default: this->ChipID.ProcessorName = "Unknown K7 family"; return false;
}
break;
default:
- sprintf (this->ChipID.ProcessorName,"Unknown AMD family");
+ this->ChipID.ProcessorName = "Unknown AMD family";
return false;
}
break;
@@ -2133,12 +2130,12 @@ bool SystemInformationImplementation::RetrieveClassicalCPUIdentity()
case 5:
switch (this->ChipID.Model)
{
- case 4: sprintf (this->ChipID.ProcessorName,"Crusoe TM3x00 and TM5x00"); break;
- default: sprintf (this->ChipID.ProcessorName,"Unknown Crusoe family"); return false;
+ case 4: this->ChipID.ProcessorName = "Crusoe TM3x00 and TM5x00"; break;
+ default: this->ChipID.ProcessorName = "Unknown Crusoe family"; return false;
}
break;
default:
- sprintf (this->ChipID.ProcessorName,"Unknown Transmeta family");
+ this->ChipID.ProcessorName = "Unknown Transmeta family";
return false;
}
break;
@@ -2149,13 +2146,13 @@ bool SystemInformationImplementation::RetrieveClassicalCPUIdentity()
case 5:
switch (this->ChipID.Model)
{
- case 0: sprintf (this->ChipID.ProcessorName,"mP6 (0.25 micron)"); break;
- case 2: sprintf (this->ChipID.ProcessorName,"mP6 (0.18 micron)"); break;
- default: sprintf (this->ChipID.ProcessorName,"Unknown Rise family"); return false;
+ case 0: this->ChipID.ProcessorName = "mP6 (0.25 micron)"; break;
+ case 2: this->ChipID.ProcessorName = "mP6 (0.18 micron)"; break;
+ default: this->ChipID.ProcessorName = "Unknown Rise family"; return false;
}
break;
default:
- sprintf (this->ChipID.ProcessorName,"Unknown Rise family");
+ this->ChipID.ProcessorName = "Unknown Rise family";
return false;
}
break;
@@ -2166,13 +2163,13 @@ bool SystemInformationImplementation::RetrieveClassicalCPUIdentity()
case 4:
switch (this->ChipID.Model)
{
- case 1: sprintf (this->ChipID.ProcessorName,"U5D"); break;
- case 2: sprintf (this->ChipID.ProcessorName,"U5S"); break;
- default: sprintf (this->ChipID.ProcessorName,"Unknown UMC family"); return false;
+ case 1: this->ChipID.ProcessorName = "U5D"; break;
+ case 2: this->ChipID.ProcessorName = "U5S"; break;
+ default: this->ChipID.ProcessorName = "Unknown UMC family"; return false;
}
break;
default:
- sprintf (this->ChipID.ProcessorName,"Unknown UMC family");
+ this->ChipID.ProcessorName = "Unknown UMC family";
return false;
}
break;
@@ -2183,21 +2180,21 @@ bool SystemInformationImplementation::RetrieveClassicalCPUIdentity()
case 5:
switch (this->ChipID.Model)
{
- case 4: sprintf (this->ChipID.ProcessorName,"C6"); break;
- case 8: sprintf (this->ChipID.ProcessorName,"C2"); break;
- case 9: sprintf (this->ChipID.ProcessorName,"C3"); break;
- default: sprintf (this->ChipID.ProcessorName,"Unknown IDT\\Centaur family"); return false;
+ case 4: this->ChipID.ProcessorName = "C6"; break;
+ case 8: this->ChipID.ProcessorName = "C2"; break;
+ case 9: this->ChipID.ProcessorName = "C3"; break;
+ default: this->ChipID.ProcessorName = "Unknown IDT\\Centaur family"; return false;
}
break;
case 6:
switch (this->ChipID.Model)
{
- case 6: sprintf (this->ChipID.ProcessorName,"VIA Cyrix III - Samuel"); break;
- default: sprintf (this->ChipID.ProcessorName,"Unknown IDT\\Centaur family"); return false;
+ case 6: this->ChipID.ProcessorName = "VIA Cyrix III - Samuel"; break;
+ default: this->ChipID.ProcessorName = "Unknown IDT\\Centaur family"; return false;
}
break;
default:
- sprintf (this->ChipID.ProcessorName,"Unknown IDT\\Centaur family");
+ this->ChipID.ProcessorName = "Unknown IDT\\Centaur family";
return false;
}
break;
@@ -2208,32 +2205,32 @@ bool SystemInformationImplementation::RetrieveClassicalCPUIdentity()
case 4:
switch (this->ChipID.Model)
{
- case 4: sprintf (this->ChipID.ProcessorName,"MediaGX GX, GXm"); break;
- case 9: sprintf (this->ChipID.ProcessorName,"5x86"); break;
- default: sprintf (this->ChipID.ProcessorName,"Unknown Cx5x86 family"); return false;
+ case 4: this->ChipID.ProcessorName = "MediaGX GX = GXm"; break;
+ case 9: this->ChipID.ProcessorName = "5x86"; break;
+ default: this->ChipID.ProcessorName = "Unknown Cx5x86 family"; return false;
}
break;
case 5:
switch (this->ChipID.Model)
{
- case 2: sprintf (this->ChipID.ProcessorName,"Cx6x86"); break;
- case 4: sprintf (this->ChipID.ProcessorName,"MediaGX GXm"); break;
- default: sprintf (this->ChipID.ProcessorName,"Unknown Cx6x86 family"); return false;
+ case 2: this->ChipID.ProcessorName = "Cx6x86"; break;
+ case 4: this->ChipID.ProcessorName = "MediaGX GXm"; break;
+ default: this->ChipID.ProcessorName = "Unknown Cx6x86 family"; return false;
}
break;
case 6:
switch (this->ChipID.Model)
{
- case 0: sprintf (this->ChipID.ProcessorName,"6x86MX"); break;
- case 5: sprintf (this->ChipID.ProcessorName,"Cyrix M2 Core"); break;
- case 6: sprintf (this->ChipID.ProcessorName,"WinChip C5A Core"); break;
- case 7: sprintf (this->ChipID.ProcessorName,"WinChip C5B\\C5C Core"); break;
- case 8: sprintf (this->ChipID.ProcessorName,"WinChip C5C-T Core"); break;
- default: sprintf (this->ChipID.ProcessorName,"Unknown 6x86MX\\Cyrix III family"); return false;
+ case 0: this->ChipID.ProcessorName = "6x86MX"; break;
+ case 5: this->ChipID.ProcessorName = "Cyrix M2 Core"; break;
+ case 6: this->ChipID.ProcessorName = "WinChip C5A Core"; break;
+ case 7: this->ChipID.ProcessorName = "WinChip C5B\\C5C Core"; break;
+ case 8: this->ChipID.ProcessorName = "WinChip C5C-T Core"; break;
+ default: this->ChipID.ProcessorName = "Unknown 6x86MX\\Cyrix III family"; return false;
}
break;
default:
- sprintf (this->ChipID.ProcessorName,"Unknown Cyrix family");
+ this->ChipID.ProcessorName = "Unknown Cyrix family";
return false;
}
break;
@@ -2244,21 +2241,21 @@ bool SystemInformationImplementation::RetrieveClassicalCPUIdentity()
case 5:
switch (this->ChipID.Model)
{
- case 0: sprintf (this->ChipID.ProcessorName,"Nx586 or Nx586FPU"); break;
- default: sprintf (this->ChipID.ProcessorName,"Unknown NexGen family"); return false;
+ case 0: this->ChipID.ProcessorName = "Nx586 or Nx586FPU"; break;
+ default: this->ChipID.ProcessorName = "Unknown NexGen family"; return false;
}
break;
default:
- sprintf (this->ChipID.ProcessorName,"Unknown NexGen family");
+ this->ChipID.ProcessorName = "Unknown NexGen family";
return false;
}
break;
case NSC:
- sprintf (this->ChipID.ProcessorName,"Cx486SLC \\ DLC \\ Cx486S A-Step");
+ this->ChipID.ProcessorName = "Cx486SLC \\ DLC \\ Cx486S A-Step";
break;
default:
- sprintf (this->ChipID.ProcessorName,"Unknown family"); // We cannot identify the processor.
+ this->ChipID.ProcessorName = "Unknown family"; // We cannot identify the processor.
return false;
}
@@ -2365,7 +2362,7 @@ int SystemInformationImplementation::RetreiveInformationFromCpuInfoFile()
this->ChipID.Family = atoi(this->ExtractValueFromCpuInfoFile(buffer,"cpu family").c_str());
// Chip Vendor
- strcpy(this->ChipID.Vendor,this->ExtractValueFromCpuInfoFile(buffer,"vendor_id").c_str());
+ this->ChipID.Vendor = this->ExtractValueFromCpuInfoFile(buffer,"vendor_id");
this->FindManufacturer();
// Chip Model
@@ -2945,7 +2942,7 @@ bool SystemInformationImplementation::ParseSysCtl()
len = sizeof(value);
sysctlbyname("hw.cpufrequency", &value, &len, NULL, 0);
- this->CPUSpeedInMHz = static_cast< float >( value )/ 1048576;
+ this->CPUSpeedInMHz = static_cast< float >( value )/ 1000000;
// Chip family
@@ -2964,7 +2961,7 @@ bool SystemInformationImplementation::ParseSysCtl()
kwsys_stl::string machineBuf(retBuf);
if (machineBuf.find_first_of("Power") != kwsys_stl::string::npos)
{
- strcpy(this->ChipID.Vendor, "IBM");
+ this->ChipID.Vendor = "IBM";
len = 4;
err = sysctlbyname("hw.cputype", &this->ChipID.Family, &len, NULL, 0);
err = sysctlbyname("hw.cpusubtype", &this->ChipID.Model, &len, NULL, 0);
@@ -2982,13 +2979,14 @@ bool SystemInformationImplementation::ParseSysCtl()
len = 128;
err = sysctlbyname("machdep.cpu.vendor", retBuf, &len, NULL, 0);
// Chip Vendor
- strcpy(this->ChipID.Vendor,retBuf);
+ this->ChipID.Vendor = retBuf;
this->FindManufacturer();
- len=CHIPNAME_STRING_LENGTH;
+ ::memset(retBuf, 0, 128);
err =
sysctlbyname("machdep.cpu.brand_string",
- this->ChipID.ProcessorName, &len, NULL, 0);
+ retBuf, &len, NULL, 0);
+ this->ChipID.ProcessorName = retBuf;
// Chip Model
len = sizeof(value);
@@ -3175,11 +3173,11 @@ bool SystemInformationImplementation::QuerySolarisInfo()
this->ChipID.Family = 0;
// Chip Vendor
- strcpy(this->ChipID.Vendor,"Sun");
+ this->ChipID.Vendor = "Sun";
this->FindManufacturer();
// Chip Model
- sprintf(this->ChipID.ProcessorName,"%s",this->ParseValueFromKStat("-s cpu_type").c_str());
+ this->ChipID.ProcessorName = this->ParseValueFromKStat("-s cpu_type");
this->ChipID.Model = 0;
// Cache size
@@ -3233,7 +3231,7 @@ bool SystemInformationImplementation::QueryHaikuInfo()
char vbuf[13];
strncpy(vbuf, cpu_info.eax_0.vendor_id, 12);
vbuf[12] = '\0';
- strcpy(this->ChipID.Vendor,vbuf);
+ this->ChipID.Vendor = vbuf;
this->FindManufacturer();
@@ -3274,6 +3272,89 @@ bool SystemInformationImplementation::QueryHaikuInfo()
#endif
}
+bool SystemInformationImplementation::QueryQNXMemory()
+{
+#if defined(__QNX__)
+ kwsys_stl::string buffer;
+ kwsys_stl::vector<const char*> args;
+ args.clear();
+
+ args.push_back("showmem");
+ args.push_back("-S");
+ args.push_back(0);
+ buffer = this->RunProcess(args);
+ args.clear();
+
+ size_t pos = buffer.find("System RAM:");
+ if (pos == buffer.npos)
+ return false;
+ pos = buffer.find(":", pos);
+ size_t pos2 = buffer.find("M (", pos);
+ if (pos2 == buffer.npos)
+ return false;
+
+ pos++;
+ while (buffer[pos] == ' ')
+ pos++;
+
+ this->TotalPhysicalMemory = atoi(buffer.substr(pos, pos2 - pos).c_str());
+ return true;
+#endif
+ return false;
+}
+
+bool SystemInformationImplementation::QueryQNXProcessor()
+{
+#if defined(__QNX__)
+ // the output on my QNX 6.4.1 looks like this:
+ // Processor1: 686 Pentium II Stepping 3 2175MHz FPU
+ kwsys_stl::string buffer;
+ kwsys_stl::vector<const char*> args;
+ args.clear();
+
+ args.push_back("pidin");
+ args.push_back("info");
+ args.push_back(0);
+ buffer = this->RunProcess(args);
+ args.clear();
+
+ size_t pos = buffer.find("Processor1:");
+ if (pos == buffer.npos)
+ return false;
+
+ size_t pos2 = buffer.find("MHz", pos);
+ if (pos2 == buffer.npos)
+ return false;
+
+ size_t pos3 = pos2;
+ while (buffer[pos3] != ' ')
+ --pos3;
+
+ this->CPUSpeedInMHz = atoi(buffer.substr(pos3 + 1, pos2 - pos3 - 1).c_str());
+
+ pos2 = buffer.find(" Stepping", pos);
+ if (pos2 != buffer.npos)
+ {
+ pos2 = buffer.find(" ", pos2 + 1);
+ if (pos2 != buffer.npos && pos2 < pos3)
+ {
+ this->ChipID.Revision = atoi(buffer.substr(pos2 + 1, pos3 - pos2).c_str());
+ }
+ }
+
+ this->NumberOfPhysicalCPU = 0;
+ do
+ {
+ pos = buffer.find("\nProcessor", pos + 1);
+ ++this->NumberOfPhysicalCPU;
+ } while (pos != buffer.npos);
+ this->NumberOfLogicalCPU = 1;
+
+ return true;
+#else
+ return false;
+#endif
+}
/** Query the operating system information */
bool SystemInformationImplementation::QueryOSInformation()
diff --git a/Source/kwsys/SystemTools.cxx b/Source/kwsys/SystemTools.cxx
index 60d6869..eefa7f5 100644
--- a/Source/kwsys/SystemTools.cxx
+++ b/Source/kwsys/SystemTools.cxx
@@ -563,6 +563,14 @@ void SystemTools::ReplaceString(kwsys_stl::string& source,
static DWORD SystemToolsMakeRegistryMode(DWORD mode,
SystemTools::KeyWOW64 view)
{
+ // only add the modes when on a system that supports Wow64.
+ static FARPROC wow64p = GetProcAddress(GetModuleHandle("kernel32"),
+ "IsWow64Process");
+ if(wow64p == NULL)
+ {
+ return mode;
+ }
+
if(view == SystemTools::KeyWOW64_32)
{
return mode | KWSYS_ST_KEY_WOW64_32KEY;
@@ -734,10 +742,11 @@ bool SystemTools::WriteRegistryValue(const char *key, const char *value,
HKEY hKey;
DWORD dwDummy;
+ char lpClass[] = "";
if(RegCreateKeyEx(primaryKey,
second.c_str(),
0,
- "",
+ lpClass,
REG_OPTION_NON_VOLATILE,
SystemToolsMakeRegistryMode(KEY_WRITE, view),
NULL,
diff --git a/Source/kwsys/kwsysDateStamp.cmake b/Source/kwsys/kwsysDateStamp.cmake
index 71d177d..8b54084 100644
--- a/Source/kwsys/kwsysDateStamp.cmake
+++ b/Source/kwsys/kwsysDateStamp.cmake
@@ -12,10 +12,10 @@
#=============================================================================
# KWSys version date year component. Format is CCYY.
-SET(KWSYS_DATE_STAMP_YEAR 2010)
+SET(KWSYS_DATE_STAMP_YEAR 2011)
# KWSys version date month component. Format is MM.
-SET(KWSYS_DATE_STAMP_MONTH 12)
+SET(KWSYS_DATE_STAMP_MONTH 01)
# KWSys version date day component. Format is DD.
-SET(KWSYS_DATE_STAMP_DAY 16)
+SET(KWSYS_DATE_STAMP_DAY 27)