summaryrefslogtreecommitdiffstats
path: root/Source
diff options
context:
space:
mode:
Diffstat (limited to 'Source')
-rw-r--r--Source/CMakeLists.txt10
-rw-r--r--Source/CPack/cmCPackDebGenerator.cxx5
-rw-r--r--Source/CPack/cmCPackGenerator.cxx3
-rw-r--r--Source/CPack/cmCPackGenerator.h7
-rw-r--r--Source/CPack/cmCPackNSISGenerator.cxx7
-rw-r--r--Source/CPack/cmCPackNSISGenerator.h12
-rw-r--r--Source/CPack/cpack.cxx12
-rw-r--r--Source/CTest/cmCTestConfigureCommand.cxx4
-rw-r--r--Source/CTest/cmCTestCoverageHandler.cxx9
-rw-r--r--Source/CTest/cmCTestGenericHandler.cxx2
-rw-r--r--Source/CTest/cmCTestGenericHandler.h7
-rw-r--r--Source/CTest/cmCTestLaunch.h2
-rw-r--r--Source/CTest/cmCTestMemCheckHandler.cxx24
-rw-r--r--Source/CTest/cmCTestRunTest.cxx2
-rw-r--r--Source/CTest/cmCTestSubmitHandler.h28
-rw-r--r--Source/CTest/cmCTestTestHandler.cxx14
-rw-r--r--Source/CTest/cmCTestTestHandler.h13
-rw-r--r--Source/CTest/cmParsePHPCoverage.cxx1
-rw-r--r--Source/CursesDialog/ccmake.cxx36
-rw-r--r--Source/CursesDialog/cmCursesLongMessageForm.cxx2
-rw-r--r--Source/CursesDialog/cmCursesMainForm.cxx156
-rw-r--r--Source/cmAddCustomCommandCommand.h4
-rw-r--r--Source/cmAddExecutableCommand.cxx3
-rw-r--r--Source/cmAddLibraryCommand.cxx33
-rw-r--r--Source/cmArchiveWrite.cxx3
-rw-r--r--Source/cmBuildCommand.h4
-rw-r--r--Source/cmBuildNameCommand.h4
-rw-r--r--Source/cmCMakeMinimumRequired.h4
-rw-r--r--Source/cmCTest.cxx38
-rw-r--r--Source/cmCacheManager.cxx12
-rw-r--r--Source/cmCacheManager.h6
-rw-r--r--Source/cmCommandArgumentLexer.cxx108
-rw-r--r--Source/cmComputeLinkInformation.cxx17
-rw-r--r--Source/cmComputeTargetDepends.cxx10
-rw-r--r--Source/cmCoreTryCompile.cxx58
-rw-r--r--Source/cmCoreTryCompile.h14
-rw-r--r--Source/cmDependsFortranLexer.cxx8
-rw-r--r--Source/cmDependsJavaLexer.cxx62
-rw-r--r--Source/cmDocumentVariables.cxx54
-rw-r--r--Source/cmDocumentation.cxx157
-rw-r--r--Source/cmDocumentationFormatter.h12
-rw-r--r--Source/cmExprLexer.cxx67
-rw-r--r--Source/cmExtraCodeBlocksGenerator.cxx63
-rw-r--r--Source/cmExtraEclipseCDT4Generator.cxx254
-rw-r--r--Source/cmExtraEclipseCDT4Generator.h11
-rw-r--r--Source/cmFileCommand.cxx6
-rw-r--r--Source/cmFindBase.cxx6
-rw-r--r--Source/cmFindCommon.cxx7
-rw-r--r--Source/cmFindCommon.h4
-rw-r--r--Source/cmFindPackageCommand.cxx55
-rw-r--r--Source/cmFindPackageCommand.h1
-rw-r--r--Source/cmGlobalGenerator.cxx143
-rw-r--r--Source/cmGlobalGenerator.h50
-rw-r--r--Source/cmGlobalKdevelopGenerator.h24
-rw-r--r--Source/cmGlobalMinGWMakefileGenerator.cxx12
-rw-r--r--Source/cmGlobalUnixMakefileGenerator3.cxx70
-rw-r--r--Source/cmGlobalUnixMakefileGenerator3.h28
-rw-r--r--Source/cmGlobalVisualStudio10Generator.cxx36
-rw-r--r--Source/cmGlobalVisualStudio10Generator.h2
-rw-r--r--Source/cmGlobalVisualStudio10IA64Generator.cxx51
-rw-r--r--Source/cmGlobalVisualStudio10IA64Generator.h40
-rw-r--r--Source/cmGlobalVisualStudio10Win64Generator.cxx36
-rw-r--r--Source/cmGlobalVisualStudio10Win64Generator.h1
-rw-r--r--Source/cmGlobalVisualStudio11Generator.cxx45
-rw-r--r--Source/cmGlobalVisualStudio11Generator.h43
-rw-r--r--Source/cmGlobalVisualStudio11Win64Generator.cxx33
-rw-r--r--Source/cmGlobalVisualStudio11Win64Generator.h37
-rw-r--r--Source/cmGlobalVisualStudio7Generator.cxx12
-rw-r--r--Source/cmGlobalVisualStudio7Generator.h35
-rw-r--r--Source/cmGlobalVisualStudio9IA64Generator.cxx48
-rw-r--r--Source/cmGlobalVisualStudio9IA64Generator.h50
-rw-r--r--Source/cmGlobalXCodeGenerator.cxx207
-rw-r--r--Source/cmGlobalXCodeGenerator.h8
-rw-r--r--Source/cmLinkDirectoriesCommand.h7
-rw-r--r--Source/cmLocalGenerator.cxx63
-rw-r--r--Source/cmLocalGenerator.h71
-rw-r--r--Source/cmLocalUnixMakefileGenerator3.cxx55
-rw-r--r--Source/cmLocalUnixMakefileGenerator3.h59
-rw-r--r--Source/cmLocalVisualStudio10Generator.cxx16
-rw-r--r--Source/cmLocalVisualStudio7Generator.cxx134
-rw-r--r--Source/cmLocalVisualStudio7Generator.h6
-rw-r--r--Source/cmMakefile.cxx33
-rw-r--r--Source/cmMakefile.h150
-rw-r--r--Source/cmMakefileTargetGenerator.cxx35
-rw-r--r--Source/cmMakefileTargetGenerator.h2
-rw-r--r--Source/cmMarkAsAdvancedCommand.h4
-rw-r--r--Source/cmProperty.cxx4
-rw-r--r--Source/cmProperty.h2
-rw-r--r--Source/cmPropertyMap.cxx4
-rw-r--r--Source/cmPropertyMap.h2
-rw-r--r--Source/cmQtAutomoc.cxx815
-rw-r--r--Source/cmQtAutomoc.h84
-rw-r--r--Source/cmRemoveCommand.h4
-rw-r--r--Source/cmSeparateArgumentsCommand.h4
-rw-r--r--Source/cmSetPropertyCommand.cxx20
-rw-r--r--Source/cmSetPropertyCommand.h6
-rw-r--r--Source/cmSetTargetPropertiesCommand.h9
-rw-r--r--Source/cmSiteNameCommand.cxx2
-rw-r--r--Source/cmSiteNameCommand.h4
-rw-r--r--Source/cmSourceFile.cxx15
-rw-r--r--Source/cmSourceFile.h2
-rw-r--r--Source/cmSystemTools.cxx236
-rw-r--r--Source/cmSystemTools.h95
-rw-r--r--Source/cmTarget.cxx167
-rw-r--r--Source/cmTarget.h10
-rw-r--r--Source/cmTest.cxx4
-rw-r--r--Source/cmTest.h2
-rw-r--r--Source/cmTryCompileCommand.cxx9
-rw-r--r--Source/cmTryCompileCommand.h9
-rw-r--r--Source/cmTryRunCommand.cxx36
-rw-r--r--Source/cmVisualStudio10TargetGenerator.cxx52
-rw-r--r--Source/cmVisualStudioGeneratorOptions.cxx6
-rw-r--r--Source/cmXCodeObject.cxx42
-rw-r--r--Source/cmXCodeObject.h4
-rw-r--r--Source/cmake.cxx186
-rw-r--r--Source/cmake.h37
-rw-r--r--Source/cmakemain.cxx27
-rw-r--r--Source/ctest.cxx12
-rw-r--r--Source/kwsys/CommandLineArguments.cxx2
-rw-r--r--Source/kwsys/Glob.cxx40
-rw-r--r--Source/kwsys/Glob.hxx.in4
-rw-r--r--Source/kwsys/SystemInformation.cxx45
-rw-r--r--Source/kwsys/SystemTools.cxx336
-rw-r--r--Source/kwsys/SystemTools.hxx.in12
-rw-r--r--Source/kwsys/hash_fun.hxx.in37
-rw-r--r--Source/kwsys/kwsysDateStamp.cmake4
126 files changed, 3927 insertions, 1551 deletions
diff --git a/Source/CMakeLists.txt b/Source/CMakeLists.txt
index ca063d5..ba41d98 100644
--- a/Source/CMakeLists.txt
+++ b/Source/CMakeLists.txt
@@ -228,6 +228,8 @@ SET(SRCS
cmPropertyDefinitionMap.h
cmPropertyMap.cxx
cmPropertyMap.h
+ cmQtAutomoc.cxx
+ cmQtAutomoc.h
cmScriptGenerator.h
cmScriptGenerator.cxx
cmSourceFile.cxx
@@ -308,6 +310,8 @@ IF (WIN32)
cmGlobalVisualStudio8Win64Generator.h
cmGlobalVisualStudio9Win64Generator.cxx
cmGlobalVisualStudio9Win64Generator.h
+ cmGlobalVisualStudio9IA64Generator.cxx
+ cmGlobalVisualStudio9IA64Generator.h
cmVisualStudioGeneratorOptions.h
cmVisualStudioGeneratorOptions.cxx
cmVisualStudio10TargetGenerator.h
@@ -318,6 +322,12 @@ IF (WIN32)
cmGlobalVisualStudio10Generator.cxx
cmGlobalVisualStudio10Win64Generator.h
cmGlobalVisualStudio10Win64Generator.cxx
+ cmGlobalVisualStudio10IA64Generator.h
+ cmGlobalVisualStudio10IA64Generator.cxx
+ cmGlobalVisualStudio11Generator.h
+ cmGlobalVisualStudio11Generator.cxx
+ cmGlobalVisualStudio11Win64Generator.h
+ cmGlobalVisualStudio11Win64Generator.cxx
cmGlobalVisualStudioGenerator.cxx
cmGlobalVisualStudioGenerator.h
cmGlobalWatcomWMakeGenerator.cxx
diff --git a/Source/CPack/cmCPackDebGenerator.cxx b/Source/CPack/cmCPackDebGenerator.cxx
index 8c19bbd..b707e96 100644
--- a/Source/CPack/cmCPackDebGenerator.cxx
+++ b/Source/CPack/cmCPackDebGenerator.cxx
@@ -392,7 +392,10 @@ int cmCPackDebGenerator::createDeb()
}
std::string cmd;
- cmd = "\"";
+ if (NULL != this->GetOption("CPACK_DEBIAN_FAKEROOT_EXECUTABLE")) {
+ cmd += this->GetOption("CPACK_DEBIAN_FAKEROOT_EXECUTABLE");
+ }
+ cmd += " \"";
cmd += cmakeExecutable;
cmd += "\" -E tar cfz data.tar.gz ";
diff --git a/Source/CPack/cmCPackGenerator.cxx b/Source/CPack/cmCPackGenerator.cxx
index 7e5b26d..083279f 100644
--- a/Source/CPack/cmCPackGenerator.cxx
+++ b/Source/CPack/cmCPackGenerator.cxx
@@ -33,7 +33,7 @@
//----------------------------------------------------------------------
cmCPackGenerator::cmCPackGenerator()
{
- this->GeneratorVerbose = false;
+ this->GeneratorVerbose = cmSystemTools::OUTPUT_NONE;
this->MakefileMap = 0;
this->Logger = 0;
this->componentPackageMethod = ONE_PACKAGE_PER_GROUP;
@@ -1000,6 +1000,7 @@ int cmCPackGenerator::DoPackage()
std::string findExpr = tempDirectory;
findExpr += "/*";
gl.RecurseOn();
+ gl.SetRecurseThroughSymlinks(false);
if ( !gl.FindFiles(findExpr) )
{
cmCPackLogger(cmCPackLog::LOG_ERROR,
diff --git a/Source/CPack/cmCPackGenerator.h b/Source/CPack/cmCPackGenerator.h
index 05d95b8..52def9d 100644
--- a/Source/CPack/cmCPackGenerator.h
+++ b/Source/CPack/cmCPackGenerator.h
@@ -14,6 +14,7 @@
#define cmCPackGenerator_h
#include "cmObject.h"
+#include "cmSystemTools.h"
#include <map>
#include <vector>
@@ -57,7 +58,9 @@ public:
/**
* If verbose then more information is printed out
*/
- void SetVerbose(bool val) { this->GeneratorVerbose = val; }
+ void SetVerbose(bool val)
+ { this->GeneratorVerbose = val ?
+ cmSystemTools::OUTPUT_MERGE : cmSystemTools::OUTPUT_NONE; }
/**
* Do the actual whole package processing.
@@ -194,7 +197,7 @@ protected:
virtual cmCPackComponentGroup* GetComponentGroup(const char *projectName,
const char* name);
- bool GeneratorVerbose;
+ cmSystemTools::OutputOption GeneratorVerbose;
std::string Name;
std::string InstallPath;
diff --git a/Source/CPack/cmCPackNSISGenerator.cxx b/Source/CPack/cmCPackNSISGenerator.cxx
index e5fe575..2b94067 100644
--- a/Source/CPack/cmCPackNSISGenerator.cxx
+++ b/Source/CPack/cmCPackNSISGenerator.cxx
@@ -672,9 +672,6 @@ CreateComponentDescription(cmCPackComponent *component,
}
componentCode += " SetOutPath \"$INSTDIR\"\n";
- componentCode += " IntCmp $" + component->Name
- + "_was_installed ${SF_SELECTED} noinstall_" + component->Name + "\n";
-
// Create the actual installation commands
if (component->IsDownloaded)
{
@@ -786,7 +783,8 @@ CreateComponentDescription(cmCPackComponent *component,
std::string output;
int retVal = -1;
int res = cmSystemTools::RunSingleCommand(cmd.c_str(), &output, &retVal,
- dirName.c_str(), false, 0);
+ dirName.c_str(),
+ cmSystemTools::OUTPUT_NONE, 0);
if ( !res || retVal )
{
std::string tmpFile = this->GetOption("CPACK_TOPLEVEL_DIRECTORY");
@@ -824,7 +822,6 @@ CreateComponentDescription(cmCPackComponent *component,
componentCode += " File /r \"${INST_DIR}\\" +
component->Name + "\\*.*\"\n";
}
- componentCode += " noinstall_" + component->Name + ":\n";
componentCode += "SectionEnd\n";
// Macro used to remove the component
diff --git a/Source/CPack/cmCPackNSISGenerator.h b/Source/CPack/cmCPackNSISGenerator.h
index 6ad103f..7bccb89 100644
--- a/Source/CPack/cmCPackNSISGenerator.h
+++ b/Source/CPack/cmCPackNSISGenerator.h
@@ -46,10 +46,10 @@ protected:
virtual bool SupportsComponentInstallation() const;
- /// Produce a string that contains the NSIS code to describe a
- /// particular component. Any added macros will be emitted via
+ /// Produce a string that contains the NSIS code to describe a
+ /// particular component. Any added macros will be emitted via
/// macrosOut.
- std::string
+ std::string
CreateComponentDescription(cmCPackComponent *component,
cmOStringStream& macrosOut);
@@ -65,14 +65,14 @@ protected:
(cmCPackComponent *component,
std::set<cmCPackComponent *>& visited);
- /// Produce a string that contains the NSIS code to describe a
+ /// Produce a string that contains the NSIS code to describe a
/// particular component group, including its components. Any
/// added macros will be emitted via macrosOut.
- std::string
+ std::string
CreateComponentGroupDescription(cmCPackComponentGroup *group,
cmOStringStream& macrosOut);
- /// Translations any newlines found in the string into \r\n, so that the
+ /// Translations any newlines found in the string into \\r\\n, so that the
/// resulting string can be used within NSIS.
static std::string TranslateNewlines(std::string str);
};
diff --git a/Source/CPack/cpack.cxx b/Source/CPack/cpack.cxx
index 9163af81..b1706e3 100644
--- a/Source/CPack/cpack.cxx
+++ b/Source/CPack/cpack.cxx
@@ -244,7 +244,7 @@ int main (int argc, char *argv[])
// find out which system cpack is running on, so it can setup the search
// paths, so FIND_XXX() commands can be used in scripts
cminst.AddCMakePaths();
- std::string systemFile =
+ std::string systemFile =
globalMF->GetModulesFile("CMakeDetermineSystem.cmake");
if (!globalMF->ReadListFile(0, systemFile.c_str()))
{
@@ -253,7 +253,7 @@ int main (int argc, char *argv[])
return 1;
}
- systemFile =
+ systemFile =
globalMF->GetModulesFile("CMakeSystemSpecificInformation.cmake");
if (!globalMF->ReadListFile(0, systemFile.c_str()))
{
@@ -264,7 +264,7 @@ int main (int argc, char *argv[])
if ( cmSystemTools::FileExists(cpackConfigFile.c_str()) )
{
- cpackConfigFile =
+ cpackConfigFile =
cmSystemTools::CollapseFullPath(cpackConfigFile.c_str());
cmCPack_Log(&log, cmCPackLog::LOG_VERBOSE,
"Read CPack configuration file: " << cpackConfigFile.c_str()
@@ -410,7 +410,7 @@ int main (int argc, char *argv[])
cmCPack_Log(&log, cmCPackLog::LOG_VERBOSE, "For project: "
<< projName << std::endl);
- const char* projVersion =
+ const char* projVersion =
mf->GetDefinition("CPACK_PACKAGE_VERSION");
if ( !projVersion )
{
@@ -423,7 +423,7 @@ int main (int argc, char *argv[])
cmOStringStream ostr;
ostr << projVersionMajor << "." << projVersionMinor << "."
<< projVersionPatch;
- mf->AddDefinition("CPACK_PACKAGE_VERSION",
+ mf->AddDefinition("CPACK_PACKAGE_VERSION",
ostr.str().c_str());
}
@@ -448,7 +448,7 @@ int main (int argc, char *argv[])
doc.SetSection("Name",cmDocumentationName);
doc.SetSection("Usage",cmDocumentationUsage);
doc.SetSection("Description",cmDocumentationDescription);
- doc.SetSection("Options",cmDocumentationOptions);
+ doc.PrependSection("Options",cmDocumentationOptions);
std::vector<cmDocumentationEntry> v;
cmCPackGeneratorFactory::DescriptionsMap::const_iterator generatorIt;
diff --git a/Source/CTest/cmCTestConfigureCommand.cxx b/Source/CTest/cmCTestConfigureCommand.cxx
index 9a668bc..7a99ddf 100644
--- a/Source/CTest/cmCTestConfigureCommand.cxx
+++ b/Source/CTest/cmCTestConfigureCommand.cxx
@@ -41,7 +41,7 @@ cmCTestGenericHandler* cmCTestConfigureCommand::InitializeHandler()
{
this->CTest->SetCTestConfiguration("BuildDirectory",
cmSystemTools::CollapseFullPath(
- this->Makefile->GetDefinition("CTEST_BINARY_DIRECTORY")).c_str());
+ this->Makefile->GetSafeDefinition("CTEST_BINARY_DIRECTORY")).c_str());
}
if ( this->Values[ct_SOURCE] )
@@ -54,7 +54,7 @@ cmCTestGenericHandler* cmCTestConfigureCommand::InitializeHandler()
{
this->CTest->SetCTestConfiguration("SourceDirectory",
cmSystemTools::CollapseFullPath(
- this->Makefile->GetDefinition("CTEST_SOURCE_DIRECTORY")).c_str());
+ this->Makefile->GetSafeDefinition("CTEST_SOURCE_DIRECTORY")).c_str());
}
if ( this->CTest->GetCTestConfiguration("BuildDirectory").empty() )
diff --git a/Source/CTest/cmCTestCoverageHandler.cxx b/Source/CTest/cmCTestCoverageHandler.cxx
index 005651f..0b1c9fe 100644
--- a/Source/CTest/cmCTestCoverageHandler.cxx
+++ b/Source/CTest/cmCTestCoverageHandler.cxx
@@ -751,12 +751,15 @@ int cmCTestCoverageHandler::HandlePHPCoverage(
}
return static_cast<int>(cont->TotalCoverage.size());
}
+
//----------------------------------------------------------------------
int cmCTestCoverageHandler::HandleGCovCoverage(
cmCTestCoverageHandlerContainer* cont)
{
std::string gcovCommand
= this->CTest->GetCTestConfiguration("CoverageCommand");
+ std::string gcovExtraFlags
+ = this->CTest->GetCTestConfiguration("CoverageExtraFlags");
// Style 1
std::string st1gcovOutputRex1
@@ -825,8 +828,10 @@ int cmCTestCoverageHandler::HandleGCovCoverage(
// Call gcov to get coverage data for this *.gcda file:
//
std::string fileDir = cmSystemTools::GetFilenamePath(it->c_str());
- std::string command = "\"" + gcovCommand + "\" -l -p -o \"" + fileDir
- + "\" \"" + *it + "\"";
+ std::string command = "\"" + gcovCommand + "\" " +
+ gcovExtraFlags + " " +
+ "-o \"" + fileDir + "\" " +
+ "\"" + *it + "\"";
cmCTestLog(this->CTest, HANDLER_VERBOSE_OUTPUT, command.c_str()
<< std::endl);
diff --git a/Source/CTest/cmCTestGenericHandler.cxx b/Source/CTest/cmCTestGenericHandler.cxx
index 8c3c22a..fd75e45 100644
--- a/Source/CTest/cmCTestGenericHandler.cxx
+++ b/Source/CTest/cmCTestGenericHandler.cxx
@@ -18,7 +18,7 @@
//----------------------------------------------------------------------
cmCTestGenericHandler::cmCTestGenericHandler()
{
- this->HandlerVerbose = false;
+ this->HandlerVerbose = cmSystemTools::OUTPUT_NONE;
this->CTest = 0;
this->SubmitIndex = 0;
this->AppendXML = false;
diff --git a/Source/CTest/cmCTestGenericHandler.h b/Source/CTest/cmCTestGenericHandler.h
index 7393145..18189ec 100644
--- a/Source/CTest/cmCTestGenericHandler.h
+++ b/Source/CTest/cmCTestGenericHandler.h
@@ -16,6 +16,7 @@
#include "cmObject.h"
#include "cmCTest.h"
+#include "cmSystemTools.h" //OutputOption
class cmMakefile;
class cmCTestCommand;
@@ -31,7 +32,9 @@ public:
/**
* If verbose then more informaiton is printed out
*/
- void SetVerbose(bool val) { this->HandlerVerbose = val; }
+ void SetVerbose(bool val)
+ { this->HandlerVerbose = val ?
+ cmSystemTools::OUTPUT_MERGE : cmSystemTools::OUTPUT_NONE; }
/**
* Populate internals from CTest custom scripts
@@ -91,7 +94,7 @@ protected:
bool StartLogFile(const char* name, cmGeneratedFileStream& xofs);
bool AppendXML;
- bool HandlerVerbose;
+ cmSystemTools::OutputOption HandlerVerbose;
cmCTest *CTest;
t_StringToString Options;
t_StringToString PersistentOptions;
diff --git a/Source/CTest/cmCTestLaunch.h b/Source/CTest/cmCTestLaunch.h
index cd876d0..7457e83 100644
--- a/Source/CTest/cmCTestLaunch.h
+++ b/Source/CTest/cmCTestLaunch.h
@@ -24,7 +24,7 @@ class cmCTestLaunch
{
public:
/** Entry point from ctest executable main(). */
- static int Main(int argc, const char* const* argv);
+ static int Main(int argc, const char* const argv[]);
private:
// Initialize the launcher from its command line.
cmCTestLaunch(int argc, const char* const* argv);
diff --git a/Source/CTest/cmCTestMemCheckHandler.cxx b/Source/CTest/cmCTestMemCheckHandler.cxx
index 0612449..f0a98f9 100644
--- a/Source/CTest/cmCTestMemCheckHandler.cxx
+++ b/Source/CTest/cmCTestMemCheckHandler.cxx
@@ -672,30 +672,30 @@ bool cmCTestMemCheckHandler::ProcessMemCheckValgrindOutput(
cmsys::RegularExpression vgFMM(
"== .*Mismatched free\\(\\) / delete / delete \\[\\]");
cmsys::RegularExpression vgMLK1(
- "== .*[0-9][0-9]* bytes in [0-9][0-9]* blocks are definitely lost"
- " in loss record [0-9][0-9]* of [0-9]");
+ "== .*[0-9,]+ bytes in [0-9,]+ blocks are definitely lost"
+ " in loss record [0-9,]+ of [0-9,]+");
cmsys::RegularExpression vgMLK2(
- "== .*[0-9][0-9]* \\([0-9]*,?[0-9]* direct, [0-9]*,?[0-9]* indirect\\)"
- " bytes in [0-9][0-9]* blocks are definitely lost"
- " in loss record [0-9][0-9]* of [0-9]");
+ "== .*[0-9,]+ \\([0-9,]+ direct, [0-9,]+ indirect\\)"
+ " bytes in [0-9,]+ blocks are definitely lost"
+ " in loss record [0-9,]+ of [0-9,]+");
cmsys::RegularExpression vgPAR(
"== .*Syscall param .* contains unaddressable byte\\(s\\)");
cmsys::RegularExpression vgMPK1(
- "== .*[0-9][0-9]* bytes in [0-9][0-9]* blocks are possibly lost in"
- " loss record [0-9][0-9]* of [0-9]");
+ "== .*[0-9,]+ bytes in [0-9,]+ blocks are possibly lost in"
+ " loss record [0-9,]+ of [0-9,]+");
cmsys::RegularExpression vgMPK2(
- "== .*[0-9][0-9]* bytes in [0-9][0-9]* blocks are still reachable"
- " in loss record [0-9][0-9]* of [0-9]");
+ "== .*[0-9,]+ bytes in [0-9,]+ blocks are still reachable"
+ " in loss record [0-9,]+ of [0-9,]+");
cmsys::RegularExpression vgUMC(
"== .*Conditional jump or move depends on uninitialised value\\(s\\)");
cmsys::RegularExpression vgUMR1(
- "== .*Use of uninitialised value of size [0-9][0-9]*");
- cmsys::RegularExpression vgUMR2("== .*Invalid read of size [0-9][0-9]*");
+ "== .*Use of uninitialised value of size [0-9,]+");
+ cmsys::RegularExpression vgUMR2("== .*Invalid read of size [0-9,]+");
cmsys::RegularExpression vgUMR3("== .*Jump to the invalid address ");
cmsys::RegularExpression vgUMR4("== .*Syscall param .* contains "
"uninitialised or unaddressable byte\\(s\\)");
cmsys::RegularExpression vgUMR5("== .*Syscall param .* uninitialised");
- cmsys::RegularExpression vgIPW("== .*Invalid write of size [0-9]");
+ cmsys::RegularExpression vgIPW("== .*Invalid write of size [0-9,]+");
cmsys::RegularExpression vgABR("== .*pthread_mutex_unlock: mutex is "
"locked by a different thread");
std::vector<std::string::size_type> nonValGrindOutput;
diff --git a/Source/CTest/cmCTestRunTest.cxx b/Source/CTest/cmCTestRunTest.cxx
index 60695da..81f18b0 100644
--- a/Source/CTest/cmCTestRunTest.cxx
+++ b/Source/CTest/cmCTestRunTest.cxx
@@ -93,6 +93,7 @@ void cmCTestRunTest::CompressOutput()
ret = deflateInit(&strm, -1); //default compression level
if (ret != Z_OK)
{
+ delete[] out;
return;
}
@@ -106,6 +107,7 @@ void cmCTestRunTest::CompressOutput()
{
cmCTestLog(this->CTest, ERROR_MESSAGE, "Error during output "
"compression. Sending uncompressed output." << std::endl);
+ delete[] out;
return;
}
diff --git a/Source/CTest/cmCTestSubmitHandler.h b/Source/CTest/cmCTestSubmitHandler.h
index e7755b1..14eac80 100644
--- a/Source/CTest/cmCTestSubmitHandler.h
+++ b/Source/CTest/cmCTestSubmitHandler.h
@@ -18,7 +18,7 @@
* \brief Helper class for CTest
*
* Submit testing results
- *
+ *
*/
class cmCTestSubmitHandler : public cmCTestGenericHandler
{
@@ -47,35 +47,37 @@ private:
/**
* Submit file using various ways
*/
- bool SubmitUsingFTP(const cmStdString& localprefix,
+ bool SubmitUsingFTP(const cmStdString& localprefix,
const std::set<cmStdString>& files,
- const cmStdString& remoteprefix,
+ const cmStdString& remoteprefix,
const cmStdString& url);
- bool SubmitUsingHTTP(const cmStdString& localprefix,
+ bool SubmitUsingHTTP(const cmStdString& localprefix,
const std::set<cmStdString>& files,
- const cmStdString& remoteprefix,
+ const cmStdString& remoteprefix,
const cmStdString& url);
bool SubmitUsingSCP(const cmStdString& scp_command,
- const cmStdString& localprefix,
+ const cmStdString& localprefix,
const std::set<cmStdString>& files,
- const cmStdString& remoteprefix,
+ const cmStdString& remoteprefix,
const cmStdString& url);
- bool SubmitUsingCP( const cmStdString& localprefix,
+ bool SubmitUsingCP( const cmStdString& localprefix,
const std::set<cmStdString>& files,
- const cmStdString& remoteprefix,
+ const cmStdString& remoteprefix,
const cmStdString& url);
bool TriggerUsingHTTP(const std::set<cmStdString>& files,
- const cmStdString& remoteprefix,
+ const cmStdString& remoteprefix,
const cmStdString& url);
- bool SubmitUsingXMLRPC(const cmStdString& localprefix,
+ bool SubmitUsingXMLRPC(const cmStdString& localprefix,
const std::set<cmStdString>& files,
- const cmStdString& remoteprefix,
+ const cmStdString& remoteprefix,
const cmStdString& url);
- void ParseResponse(std::vector<char>);
+ typedef std::vector<char> cmCTestSubmitHandlerVectorOfChar;
+
+ void ParseResponse(cmCTestSubmitHandlerVectorOfChar chunk);
std::string GetSubmitResultsPrefix();
diff --git a/Source/CTest/cmCTestTestHandler.cxx b/Source/CTest/cmCTestTestHandler.cxx
index e3b81df..9b12393 100644
--- a/Source/CTest/cmCTestTestHandler.cxx
+++ b/Source/CTest/cmCTestTestHandler.cxx
@@ -33,6 +33,7 @@
#include <float.h>
#include <memory> // auto_ptr
+#include <set>
//----------------------------------------------------------------------
class cmCTestSubdirCommand : public cmCommand
@@ -617,9 +618,13 @@ int cmCTestTestHandler::ProcessHandler()
<< "The following tests FAILED:" << std::endl);
this->StartLogFile("TestsFailed", ofs);
- std::vector<cmCTestTestHandler::cmCTestTestResult>::iterator ftit;
- for(ftit = this->TestResults.begin();
- ftit != this->TestResults.end(); ++ftit)
+ typedef std::set<cmCTestTestHandler::cmCTestTestResult,
+ cmCTestTestResultLess> SetOfTests;
+ SetOfTests resultsSet(this->TestResults.begin(),
+ this->TestResults.end());
+
+ for(SetOfTests::iterator ftit = resultsSet.begin();
+ ftit != resultsSet.end(); ++ftit)
{
if ( ftit->Status != cmCTestTestHandler::COMPLETED )
{
@@ -1301,7 +1306,8 @@ int cmCTestTestHandler::ExecuteCommands(std::vector<cmStdString>& vec)
int retVal = 0;
cmCTestLog(this->CTest, HANDLER_VERBOSE_OUTPUT, "Run command: " << *it
<< std::endl);
- if ( !cmSystemTools::RunSingleCommand(it->c_str(), 0, &retVal, 0, true
+ if ( !cmSystemTools::RunSingleCommand(it->c_str(), 0, &retVal, 0,
+ cmSystemTools::OUTPUT_MERGE
/*this->Verbose*/) || retVal != 0 )
{
cmCTestLog(this->CTest, ERROR_MESSAGE, "Problem running command: "
diff --git a/Source/CTest/cmCTestTestHandler.h b/Source/CTest/cmCTestTestHandler.h
index 3089d35..8e59e59 100644
--- a/Source/CTest/cmCTestTestHandler.h
+++ b/Source/CTest/cmCTestTestHandler.h
@@ -125,7 +125,16 @@ public:
cmCTestTestProperties* Properties;
};
- // add configuraitons to a search path for an executable
+ struct cmCTestTestResultLess
+ {
+ bool operator() (const cmCTestTestResult &lhs,
+ const cmCTestTestResult &rhs) const
+ {
+ return lhs.TestCount < rhs.TestCount;
+ }
+ };
+
+ // add configurations to a search path for an executable
static void AddConfigurations(cmCTest *ctest,
std::vector<std::string> &attempted,
std::vector<std::string> &attemptedConfigs,
@@ -141,7 +150,7 @@ public:
typedef std::vector<cmCTestTestProperties> ListOfTests;
protected:
- // comput a final test list
+ // compute a final test list
virtual int PreProcessHandler();
virtual int PostProcessHandler();
virtual void GenerateTestCommand(std::vector<std::string>& args);
diff --git a/Source/CTest/cmParsePHPCoverage.cxx b/Source/CTest/cmParsePHPCoverage.cxx
index 32c1ec1..593b2d1 100644
--- a/Source/CTest/cmParsePHPCoverage.cxx
+++ b/Source/CTest/cmParsePHPCoverage.cxx
@@ -159,6 +159,7 @@ bool cmParsePHPCoverage::ReadFileInformation(std::ifstream& in)
// read open quote
if(in.get(c) && c != '"')
{
+ delete[] s;
return false;
}
// read the string data
diff --git a/Source/CursesDialog/ccmake.cxx b/Source/CursesDialog/ccmake.cxx
index 9ede7a6..b1a72af 100644
--- a/Source/CursesDialog/ccmake.cxx
+++ b/Source/CursesDialog/ccmake.cxx
@@ -76,11 +76,11 @@ void onsig(int)
if (cmCursesForm::CurrentForm)
{
endwin();
- initscr(); /* Initialization */
- noecho(); /* Echo off */
- cbreak(); /* nl- or cr not needed */
- keypad(stdscr,TRUE); /* Use key symbols as
- KEY_DOWN*/
+ initscr(); /* Initialization */
+ noecho(); /* Echo off */
+ cbreak(); /* nl- or cr not needed */
+ keypad(stdscr,TRUE); /* Use key symbols as
+ KEY_DOWN*/
refresh();
int x,y;
getmaxyx(stdscr, y, x);
@@ -89,7 +89,7 @@ void onsig(int)
}
signal(SIGWINCH, onsig);
}
-
+
}
void CMakeErrorHandler(const char* message, const char* title, bool&, void* clientData)
@@ -116,13 +116,13 @@ int main(int argc, char** argv)
doc.SetSection("Usage",cmDocumentationUsage);
doc.SetSection("Description",cmDocumentationDescription);
doc.SetSection("Generators",generators);
- doc.SetSection("Options",cmDocumentationOptions);
+ doc.PrependSection("Options",cmDocumentationOptions);
doc.SetSection("Command",commands);
doc.SetSection("Compatibility Commands",compatCommands);
doc.SetSeeAlsoList(cmDocumentationSeeAlso);
return doc.PrintRequestedDocumentation(std::cout)? 0:1;
- }
-
+ }
+
bool debug = false;
unsigned int i;
int j;
@@ -156,22 +156,22 @@ int main(int argc, char** argv)
cmCursesForm::DebugStart();
}
- initscr(); /* Initialization */
- noecho(); /* Echo off */
- cbreak(); /* nl- or cr not needed */
- keypad(stdscr,TRUE); /* Use key symbols as
- KEY_DOWN*/
+ initscr(); /* Initialization */
+ noecho(); /* Echo off */
+ cbreak(); /* nl- or cr not needed */
+ keypad(stdscr,TRUE); /* Use key symbols as
+ KEY_DOWN*/
signal(SIGWINCH, onsig);
int x,y;
getmaxyx(stdscr, y, x);
- if ( x < cmCursesMainForm::MIN_WIDTH ||
+ if ( x < cmCursesMainForm::MIN_WIDTH ||
y < cmCursesMainForm::MIN_HEIGHT )
{
endwin();
std::cerr << "Window is too small. A size of at least "
- << cmCursesMainForm::MIN_WIDTH << " x "
+ << cmCursesMainForm::MIN_WIDTH << " x "
<< cmCursesMainForm::MIN_HEIGHT
<< " is required to run ccmake." << std::endl;
return 1;
@@ -201,7 +201,7 @@ int main(int argc, char** argv)
myform->Render(1, 1, x, y);
myform->HandleInput();
}
-
+
// Need to clean-up better
curses_clear();
touchwin(stdscr);
@@ -210,7 +210,7 @@ int main(int argc, char** argv)
cmCursesForm::CurrentForm = 0;
std::cout << std::endl << std::endl;
-
+
return 0;
}
diff --git a/Source/CursesDialog/cmCursesLongMessageForm.cxx b/Source/CursesDialog/cmCursesLongMessageForm.cxx
index 1c48d8c..0e2cd22 100644
--- a/Source/CursesDialog/cmCursesLongMessageForm.cxx
+++ b/Source/CursesDialog/cmCursesLongMessageForm.cxx
@@ -68,7 +68,7 @@ void cmCursesLongMessageForm::UpdateStatusBar()
}
else
{
- width = cmCursesMainForm::MAX_WIDTH;
+ width = cmCursesMainForm::MAX_WIDTH-1;
}
bar[width] = '\0';
diff --git a/Source/CursesDialog/cmCursesMainForm.cxx b/Source/CursesDialog/cmCursesMainForm.cxx
index e1876b9..6c7627f 100644
--- a/Source/CursesDialog/cmCursesMainForm.cxx
+++ b/Source/CursesDialog/cmCursesMainForm.cxx
@@ -27,7 +27,7 @@
inline int ctrl(int z)
{
return (z&037);
-}
+}
cmCursesMainForm::cmCursesMainForm(std::vector<std::string> const& args,
int initWidth) :
@@ -80,7 +80,7 @@ cmCursesMainForm::~cmCursesMainForm()
{
delete this->CMakeInstance;
this->CMakeInstance = 0;
- }
+ }
}
// See if a cache entry is in the list of entries in the ui.
@@ -99,7 +99,7 @@ bool cmCursesMainForm::LookForCacheEntry(const char* key)
return true;
}
}
-
+
return false;
}
@@ -114,7 +114,7 @@ void cmCursesMainForm::InitializeUI()
// Count non-internal and non-static entries
int count=0;
- for(cmCacheManager::CacheIterator i =
+ for(cmCacheManager::CacheIterator i =
this->CMakeInstance->GetCacheManager()->NewIterator();
!i.IsAtEnd(); i.Next())
{
@@ -142,12 +142,12 @@ void cmCursesMainForm::InitializeUI()
// Create the composites.
// First add entries which are new
- for(cmCacheManager::CacheIterator i =
+ for(cmCacheManager::CacheIterator i =
this->CMakeInstance->GetCacheManager()->NewIterator();
!i.IsAtEnd(); i.Next())
{
const char* key = i.GetName();
- if ( i.GetType() == cmCacheManager::INTERNAL ||
+ if ( i.GetType() == cmCacheManager::INTERNAL ||
i.GetType() == cmCacheManager::STATIC ||
i.GetType() == cmCacheManager::UNINITIALIZED )
{
@@ -164,12 +164,12 @@ void cmCursesMainForm::InitializeUI()
}
// then add entries which are old
- for(cmCacheManager::CacheIterator i =
+ for(cmCacheManager::CacheIterator i =
this->CMakeInstance->GetCacheManager()->NewIterator();
!i.IsAtEnd(); i.Next())
{
const char* key = i.GetName();
- if ( i.GetType() == cmCacheManager::INTERNAL ||
+ if ( i.GetType() == cmCacheManager::INTERNAL ||
i.GetType() == cmCacheManager::STATIC ||
i.GetType() == cmCacheManager::UNINITIALIZED )
{
@@ -184,7 +184,7 @@ void cmCursesMainForm::InitializeUI()
}
}
}
-
+
// Clean old entries
if (this->Entries)
{
@@ -197,7 +197,7 @@ void cmCursesMainForm::InitializeUI()
}
delete this->Entries;
this->Entries = newEntries;
-
+
// Compute fields from composites
this->RePost();
}
@@ -224,7 +224,7 @@ void cmCursesMainForm::RePost()
std::vector<cmCursesCacheEntryComposite*>::iterator it;
for (it = this->Entries->begin(); it != this->Entries->end(); ++it)
{
- cmCacheManager::CacheIterator mit =
+ cmCacheManager::CacheIterator mit =
this->CMakeInstance->GetCacheManager()->GetCacheIterator((*it)->GetValue());
if (mit.IsAtEnd() ||
(!this->AdvancedMode && mit.GetPropertyAsBool("ADVANCED")))
@@ -253,7 +253,7 @@ void cmCursesMainForm::RePost()
std::vector<cmCursesCacheEntryComposite*>::iterator it;
for (it = this->Entries->begin(); it != this->Entries->end(); ++it)
{
- cmCacheManager::CacheIterator mit =
+ cmCacheManager::CacheIterator mit =
this->CMakeInstance->GetCacheManager()->GetCacheIterator((*it)->GetValue());
if (mit.IsAtEnd() ||
(!this->AdvancedMode && mit.GetPropertyAsBool("ADVANCED")))
@@ -301,7 +301,7 @@ void cmCursesMainForm::Render(int left, int top, int width, int height)
}
// Wrong window size
- if ( width < cmCursesMainForm::MIN_WIDTH ||
+ if ( width < cmCursesMainForm::MIN_WIDTH ||
width < this->InitialWidth ||
height < cmCursesMainForm::MIN_HEIGHT )
{
@@ -322,7 +322,7 @@ void cmCursesMainForm::Render(int left, int top, int width, int height)
std::vector<cmCursesCacheEntryComposite*>::iterator it;
for (it = this->Entries->begin(); it != this->Entries->end(); ++it)
{
- cmCacheManager::CacheIterator mit =
+ cmCacheManager::CacheIterator mit =
this->CMakeInstance->GetCacheManager()->GetCacheIterator((*it)->GetValue());
if (mit.IsAtEnd() ||
(!this->AdvancedMode && mit.GetPropertyAsBool("ADVANCED")))
@@ -372,7 +372,7 @@ void cmCursesMainForm::Render(int left, int top, int width, int height)
this->UpdateStatusBar();
this->PrintKeys();
- touchwin(stdscr);
+ touchwin(stdscr);
refresh();
}
@@ -380,7 +380,7 @@ void cmCursesMainForm::PrintKeys(int process /* = 0 */)
{
int x,y;
getmaxyx(stdscr, y, x);
- if ( x < cmCursesMainForm::MIN_WIDTH ||
+ if ( x < cmCursesMainForm::MIN_WIDTH ||
x < this->InitialWidth ||
y < cmCursesMainForm::MIN_HEIGHT )
{
@@ -399,7 +399,7 @@ void cmCursesMainForm::PrintKeys(int process /* = 0 */)
{
cw->PrintKeys();
}
-
+
// {
// }
// else
@@ -409,35 +409,34 @@ void cmCursesMainForm::PrintKeys(int process /* = 0 */)
char thirdLine[512]="";
if (process)
{
- sprintf(firstLine,
- " ");
- sprintf(secondLine,
- " ");
- sprintf(thirdLine,
- " ");
+ sprintf(firstLine,
+ " ");
+ sprintf(secondLine,
+ " ");
+ sprintf(thirdLine,
+ " ");
}
else
{
if (this->OkToGenerate)
{
- sprintf(firstLine,
- "Press [c] to configure Press [g] to generate and exit");
+ sprintf(firstLine,
+ "Press [c] to configure Press [g] to generate and exit");
}
else
{
sprintf(firstLine, "Press [c] to configure ");
}
- if (this->AdvancedMode)
- {
- sprintf(thirdLine, "Press [t] to toggle advanced mode (Currently On)");
- }
- else
- {
- sprintf(thirdLine, "Press [t] to toggle advanced mode (Currently Off)");
- }
-
- sprintf(secondLine,
- "Press [h] for help Press [q] to quit without generating");
+ {
+ const char* toggleKeyInstruction =
+ "Press [t] to toggle advanced mode (Currently %s)";
+ sprintf(thirdLine,
+ toggleKeyInstruction,
+ this->AdvancedMode ? "On" : "Off");
+ }
+ sprintf(secondLine,
+ "Press [h] for help "
+ "Press [q] to quit without generating");
}
curses_move(y-4,0);
@@ -463,7 +462,7 @@ void cmCursesMainForm::PrintKeys(int process /* = 0 */)
// }
pos_form_cursor(this->Form);
-
+
}
// Print the key of the current entry and the CMake version
@@ -473,7 +472,7 @@ void cmCursesMainForm::UpdateStatusBar(const char* message)
int x,y;
getmaxyx(stdscr, y, x);
// If window size is too small, display error and return
- if ( x < cmCursesMainForm::MIN_WIDTH ||
+ if ( x < cmCursesMainForm::MIN_WIDTH ||
x < this->InitialWidth ||
y < cmCursesMainForm::MIN_HEIGHT )
{
@@ -482,10 +481,10 @@ void cmCursesMainForm::UpdateStatusBar(const char* message)
char fmt[] = "Window is too small. A size of at least %dx%d is required.";
printw(fmt,
(cmCursesMainForm::MIN_WIDTH < this->InitialWidth ?
- this->InitialWidth : cmCursesMainForm::MIN_WIDTH),
+ this->InitialWidth : cmCursesMainForm::MIN_WIDTH),
cmCursesMainForm::MIN_HEIGHT);
- touchwin(stdscr);
- wrefresh(stdscr);
+ touchwin(stdscr);
+ wrefresh(stdscr);
return;
}
@@ -502,10 +501,10 @@ void cmCursesMainForm::UpdateStatusBar(const char* message)
if ( lbl )
{
curField = lbl->GetValue();
-
+
// Get the help string of the current entry
// and add it to the help string
- cmCacheManager::CacheIterator it =
+ cmCacheManager::CacheIterator it =
this->CMakeInstance->GetCacheManager()->GetCacheIterator(curField);
if (!it.IsAtEnd())
{
@@ -549,9 +548,9 @@ void cmCursesMainForm::UpdateStatusBar(const char* message)
if ( curFieldLen < width )
{
strcpy(bar, curField);
- for(i=curFieldLen; i < width; ++i)
- {
- bar[i] = ' ';
+ for(i=curFieldLen; i < width; ++i)
+ {
+ bar[i] = ' ';
}
}
else
@@ -578,14 +577,14 @@ void cmCursesMainForm::UpdateStatusBar(const char* message)
else
{
strcpy(bar+curFieldLen+2, help);
- for(i=curFieldLen+helpLen+2; i < width; ++i)
- {
- bar[i] = ' ';
+ for(i=curFieldLen+helpLen+2; i < width; ++i)
+ {
+ bar[i] = ' ';
}
}
}
}
-
+
bar[width] = '\0';
@@ -605,7 +604,7 @@ void cmCursesMainForm::UpdateStatusBar(const char* message)
attron(A_STANDOUT);
char format[] = "%s";
printw(format, bar);
- attroff(A_STANDOUT);
+ attroff(A_STANDOUT);
curses_move(y-4,0);
printw(version);
pos_form_cursor(this->Form);
@@ -631,7 +630,7 @@ void cmCursesMainForm::UpdateProgress(const char *msg, float prog, void* vp)
cm->UpdateStatusBar(cmsg);
cm->PrintKeys(1);
curses_move(1,1);
- touchwin(stdscr);
+ touchwin(stdscr);
refresh();
}
@@ -643,7 +642,7 @@ int cmCursesMainForm::Configure(int noconfigure)
curses_move(1,1);
this->UpdateStatusBar("Configuring, please wait...");
this->PrintKeys(1);
- touchwin(stdscr);
+ touchwin(stdscr);
refresh();
this->CMakeInstance->SetProgressCallback(cmCursesMainForm::UpdateProgress, this);
@@ -652,7 +651,7 @@ int cmCursesMainForm::Configure(int noconfigure)
this->CMakeInstance->GetCacheManager()->SaveCache(
this->CMakeInstance->GetHomeOutputDirectory());
this->LoadCache(0);
-
+
// Get rid of previous errors
this->Errors = std::vector<std::string>();
@@ -674,8 +673,8 @@ int cmCursesMainForm::Configure(int noconfigure)
}
this->CMakeInstance->SetProgressCallback(0, 0);
- keypad(stdscr,TRUE); /* Use key symbols as
- KEY_DOWN*/
+ keypad(stdscr,TRUE); /* Use key symbols as
+ KEY_DOWN*/
if( retVal != 0 || !this->Errors.empty())
{
@@ -705,10 +704,10 @@ int cmCursesMainForm::Configure(int noconfigure)
CurrentForm = this;
this->Render(1,1,xx,yy);
}
-
+
this->InitializeUI();
this->Render(1, 1, xi, yi);
-
+
return 0;
}
@@ -731,8 +730,8 @@ int cmCursesMainForm::Generate()
int retVal = this->CMakeInstance->Generate();
this->CMakeInstance->SetProgressCallback(0, 0);
- keypad(stdscr,TRUE); /* Use key symbols as
- KEY_DOWN*/
+ keypad(stdscr,TRUE); /* Use key symbols as
+ KEY_DOWN*/
if( retVal != 0 || !this->Errors.empty())
{
@@ -764,10 +763,10 @@ int cmCursesMainForm::Generate()
CurrentForm = this;
this->Render(1,1,xx,yy);
}
-
+
this->InitializeUI();
this->Render(1, 1, xi, yi);
-
+
return 0;
}
@@ -798,11 +797,11 @@ void cmCursesMainForm::RemoveEntry(const char* value)
// copy from the list box to the cache manager
void cmCursesMainForm::FillCacheManagerFromUI()
-{
+{
size_t size = this->Entries->size();
for(size_t i=0; i < size; i++)
{
- cmCacheManager::CacheIterator it =
+ cmCacheManager::CacheIterator it =
this->CMakeInstance->GetCacheManager()->GetCacheIterator(
(*this->Entries)[i]->Key.c_str());
if (!it.IsAtEnd())
@@ -872,14 +871,14 @@ void cmCursesMainForm::HandleInput()
this->PrintKeys(1);
curses_move(y-5,static_cast<unsigned int>(searchstr.size()));
//curses_move(1,1);
- touchwin(stdscr);
+ touchwin(stdscr);
refresh();
}
int key = getch();
getmaxyx(stdscr, y, x);
// If window too small, handle 'q' only
- if ( x < cmCursesMainForm::MIN_WIDTH ||
+ if ( x < cmCursesMainForm::MIN_WIDTH ||
y < cmCursesMainForm::MIN_HEIGHT )
{
// quit
@@ -948,7 +947,7 @@ void cmCursesMainForm::HandleInput()
}
if ((!currentWidget || !widgetHandled) && !this->SearchMode)
{
- // If the current widget does not want to handle input,
+ // If the current widget does not want to handle input,
// we handle it.
sprintf(debugMessage, "Main form handling input, key: %d", key);
cmCursesForm::LogMessage(debugMessage);
@@ -1028,7 +1027,7 @@ void cmCursesMainForm::HandleInput()
this->Fields[findex-2]));
const char* curField = lbl->GetValue();
const char* helpString=0;
- cmCacheManager::CacheIterator it =
+ cmCacheManager::CacheIterator it =
this->CMakeInstance->GetCacheManager()->GetCacheIterator(curField);
if (!it.IsAtEnd())
{
@@ -1052,7 +1051,7 @@ void cmCursesMainForm::HandleInput()
CurrentForm = msgs;
msgs->Render(1,1,x,y);
msgs->HandleInput();
- CurrentForm = this;
+ CurrentForm = this;
this->Render(1,1,x,y);
set_current_field(this->Form, cur);
}
@@ -1137,7 +1136,7 @@ void cmCursesMainForm::HandleInput()
// each entry consists of fields: label, isnew, value
// therefore, the label field for the is findex-2
// (findex always corresponds to the value field)
- cmCursesWidget* lbl
+ cmCursesWidget* lbl
= reinterpret_cast<cmCursesWidget*>(
field_userptr(this->Fields[findex-2]));
if ( lbl )
@@ -1177,15 +1176,15 @@ void cmCursesMainForm::HandleInput()
}
}
- touchwin(stdscr);
- wrefresh(stdscr);
+ touchwin(stdscr);
+ wrefresh(stdscr);
}
}
int cmCursesMainForm::LoadCache(const char *)
{
- int r = this->CMakeInstance->LoadCache();
+ int r = this->CMakeInstance->LoadCache();
if(r < 0)
{
return r;
@@ -1194,7 +1193,7 @@ int cmCursesMainForm::LoadCache(const char *)
this->CMakeInstance->PreLoadCMakeFiles();
return r;
}
-
+
void cmCursesMainForm::JumpToCacheEntry(const char* astr)
{
std::string str;
@@ -1247,7 +1246,7 @@ void cmCursesMainForm::JumpToCacheEntry(const char* astr)
/*
char buffer[1024];
sprintf(buffer, "Line: %d != %d / %d\n", findex, idx, this->NumberOfVisibleEntries);
- touchwin(stdscr);
+ touchwin(stdscr);
refresh();
this->UpdateStatusBar( buffer );
usleep(100000);
@@ -1262,7 +1261,7 @@ void cmCursesMainForm::JumpToCacheEntry(const char* astr)
}
-const char* cmCursesMainForm::s_ConstHelpMessage =
+const char* cmCursesMainForm::s_ConstHelpMessage =
"CMake is used to configure and generate build files for software projects. "
"The basic steps for configuring a project with ccmake are as follows:\n\n"
"1. Run ccmake in the directory where you want the object and executable files to be placed (build directory). If the source directory is not the same as this build directory, you have to specify it as an argument on the command line.\n\n"
@@ -1301,6 +1300,5 @@ const char* cmCursesMainForm::s_ConstHelpMessage =
" g : generate build files and exit, only available when there are no "
"new options and no errors have been detected during last configuration.\n"
" l : shows last errors\n"
-" t : toggles advanced mode. In normal mode, only the most important options are shown. In advanced mode, all options are shown. We recommend using normal mode unless you are an expert.\n";
-
-
+" t : toggles advanced mode. In normal mode, only the most important options are shown. In advanced mode, all options are shown. We recommend using normal mode unless you are an expert.\n"
+" / : search for a variable name.\n";
diff --git a/Source/cmAddCustomCommandCommand.h b/Source/cmAddCustomCommandCommand.h
index 47b542c..05e7dc2 100644
--- a/Source/cmAddCustomCommandCommand.h
+++ b/Source/cmAddCustomCommandCommand.h
@@ -75,6 +75,10 @@ public:
"A target created in the same directory (CMakeLists.txt file) that "
"specifies any output of the custom command as a source file is given "
"a rule to generate the file using the command at build time. "
+ "Do not list the output in more than one independent target that may "
+ "build in parallel or the two instances of the rule may conflict "
+ "(instead use add_custom_target to drive the command and make the "
+ "other targets depend on that one). "
"If an output name is a relative path it will be interpreted "
"relative to the build tree directory corresponding to the current "
"source directory. "
diff --git a/Source/cmAddExecutableCommand.cxx b/Source/cmAddExecutableCommand.cxx
index a625c47..bac2430 100644
--- a/Source/cmAddExecutableCommand.cxx
+++ b/Source/cmAddExecutableCommand.cxx
@@ -58,7 +58,8 @@ bool cmAddExecutableCommand
}
// Special modifiers are not allowed with IMPORTED signature.
- if(importTarget && (use_win32 || use_macbundle || excludeFromAll))
+ if(importTarget
+ && (use_win32 || use_macbundle || excludeFromAll))
{
if(use_win32)
{
diff --git a/Source/cmAddLibraryCommand.cxx b/Source/cmAddLibraryCommand.cxx
index f522cee..efa29e6 100644
--- a/Source/cmAddLibraryCommand.cxx
+++ b/Source/cmAddLibraryCommand.cxx
@@ -31,13 +31,13 @@ bool cmAddLibraryCommand
}
bool excludeFromAll = false;
bool importTarget = false;
-
+
std::vector<std::string>::const_iterator s = args.begin();
std::string libName = *s;
++s;
-
+
// If the second argument is "SHARED" or "STATIC", then it controls
// the type of library. Otherwise, it is treated as a source or
// source list name. There may be two keyword arguments, check for them
@@ -85,11 +85,11 @@ bool cmAddLibraryCommand
}
}
- /* ideally we should check whether for the linker language of the target
+ /* ideally we should check whether for the linker language of the target
CMAKE_${LANG}_CREATE_SHARED_LIBRARY is defined and if not default to
- STATIC. But at this point we know only the name of the target, but not
+ STATIC. But at this point we know only the name of the target, but not
yet its linker language. */
- if ((type != cmTarget::STATIC_LIBRARY) &&
+ if ((type != cmTarget::STATIC_LIBRARY) &&
(this->Makefile->GetCMakeInstance()->GetPropertyAsBool(
"TARGET_SUPPORTS_SHARED_LIBS") == false))
{
@@ -103,16 +103,16 @@ bool cmAddLibraryCommand
type = cmTarget::STATIC_LIBRARY;
}
- // The IMPORTED signature requires a type to be specified explicitly.
- if(importTarget && !haveSpecifiedType)
- {
- this->SetError("called with IMPORTED argument but no library type.");
- return false;
- }
-
// Handle imported target creation.
if(importTarget)
{
+ // The IMPORTED signature requires a type to be specified explicitly.
+ if (!haveSpecifiedType)
+ {
+ this->SetError("called with IMPORTED argument but no library type.");
+ return false;
+ }
+
// Make sure the target does not already exist.
if(this->Makefile->FindTargetToUse(libName.c_str()))
{
@@ -158,15 +158,14 @@ bool cmAddLibraryCommand
}
std::vector<std::string> srclists;
- while (s != args.end())
+ while (s != args.end())
{
- srclists.push_back(*s);
+ srclists.push_back(*s);
++s;
}
- this->Makefile->AddLibrary(libName.c_str(), type, srclists,
- excludeFromAll);
-
+ this->Makefile->AddLibrary(libName.c_str(), type, srclists, excludeFromAll);
+
return true;
}
diff --git a/Source/cmArchiveWrite.cxx b/Source/cmArchiveWrite.cxx
index 25dc8ba..eab8a59 100644
--- a/Source/cmArchiveWrite.cxx
+++ b/Source/cmArchiveWrite.cxx
@@ -180,7 +180,8 @@ bool cmArchiveWrite::AddPath(const char* path,
{
return false;
}
- if(!cmSystemTools::FileIsDirectory(path))
+ if(!cmSystemTools::FileIsDirectory(path) ||
+ cmSystemTools::FileIsSymlink(path))
{
return true;
}
diff --git a/Source/cmBuildCommand.h b/Source/cmBuildCommand.h
index 703ff88..1d247d2 100644
--- a/Source/cmBuildCommand.h
+++ b/Source/cmBuildCommand.h
@@ -15,9 +15,9 @@
#include "cmCommand.h"
/** \class cmBuildCommand
- * \brief Build a CMAKE variable
+ * \brief build_command command
*
- * cmBuildCommand sets a variable to a value with expansion.
+ * cmBuildCommand implements the build_command CMake command
*/
class cmBuildCommand : public cmCommand
{
diff --git a/Source/cmBuildNameCommand.h b/Source/cmBuildNameCommand.h
index 35c0ae0..29a680f 100644
--- a/Source/cmBuildNameCommand.h
+++ b/Source/cmBuildNameCommand.h
@@ -15,9 +15,9 @@
#include "cmCommand.h"
/** \class cmBuildNameCommand
- * \brief BuildName a CMAKE variable
+ * \brief build_name command
*
- * cmBuildNameCommand sets a variable to a value with expansion.
+ * cmBuildNameCommand implements the build_name CMake command
*/
class cmBuildNameCommand : public cmCommand
{
diff --git a/Source/cmCMakeMinimumRequired.h b/Source/cmCMakeMinimumRequired.h
index 9bf7ef8..1121386 100644
--- a/Source/cmCMakeMinimumRequired.h
+++ b/Source/cmCMakeMinimumRequired.h
@@ -15,9 +15,9 @@
#include "cmCommand.h"
/** \class cmCMakeMinimumRequired
- * \brief Build a CMAKE variable
+ * \brief cmake_minimum_required command
*
- * cmCMakeMinimumRequired sets a variable to a value with expansion.
+ * cmCMakeMinimumRequired implements the cmake_minimum_required CMake command
*/
class cmCMakeMinimumRequired : public cmCommand
{
diff --git a/Source/cmCTest.cxx b/Source/cmCTest.cxx
index 75a564e..7bb8b27 100644
--- a/Source/cmCTest.cxx
+++ b/Source/cmCTest.cxx
@@ -655,10 +655,26 @@ bool cmCTest::InitializeFromCommand(cmCTestStartCommand* command)
}
cmMakefile* mf = command->GetMakefile();
- std::string fname = src_dir;
- fname += "/CTestConfig.cmake";
- cmSystemTools::ConvertToUnixSlashes(fname);
- if ( cmSystemTools::FileExists(fname.c_str()) )
+ std::string fname;
+
+ std::string src_dir_fname = src_dir;
+ src_dir_fname += "/CTestConfig.cmake";
+ cmSystemTools::ConvertToUnixSlashes(src_dir_fname);
+
+ std::string bld_dir_fname = bld_dir;
+ bld_dir_fname += "/CTestConfig.cmake";
+ cmSystemTools::ConvertToUnixSlashes(bld_dir_fname);
+
+ if ( cmSystemTools::FileExists(bld_dir_fname.c_str()) )
+ {
+ fname = bld_dir_fname;
+ }
+ else if ( cmSystemTools::FileExists(src_dir_fname.c_str()) )
+ {
+ fname = src_dir_fname;
+ }
+
+ if ( !fname.empty() )
{
cmCTestLog(this, OUTPUT, " Reading ctest configuration file: "
<< fname.c_str() << std::endl);
@@ -674,8 +690,12 @@ bool cmCTest::InitializeFromCommand(cmCTestStartCommand* command)
}
else
{
- cmCTestLog(this, WARNING, "Cannot locate CTest configuration: "
- << fname.c_str() << std::endl);
+ cmCTestLog(this, WARNING,
+ "Cannot locate CTest configuration: in BuildDirectory: "
+ << bld_dir_fname.c_str() << std::endl);
+ cmCTestLog(this, WARNING,
+ "Cannot locate CTest configuration: in SourceDirectory: "
+ << src_dir_fname.c_str() << std::endl);
}
this->SetCTestConfigurationFromCMakeVariable(mf, "NightlyStartTime",
@@ -2526,6 +2546,8 @@ void cmCTest::PopulateCustomVector(cmMakefile* mf, const char* def,
cmSystemTools::ExpandListArgument(dval, slist);
std::vector<std::string>::iterator it;
+ vec.clear();
+
for ( it = slist.begin(); it != slist.end(); ++it )
{
cmCTestLog(this, DEBUG, " -- " << it->c_str() << std::endl);
@@ -2801,7 +2823,7 @@ bool cmCTest::SetCTestConfigurationFromCMakeVariable(cmMakefile* mf,
}
cmCTestLog(this, HANDLER_VERBOSE_OUTPUT,
"SetCTestConfigurationFromCMakeVariable:"
- << dconfig << ":" << cmake_var);
+ << dconfig << ":" << cmake_var << std::endl);
this->SetCTestConfiguration(dconfig, ctvar);
return true;
}
@@ -3096,6 +3118,7 @@ bool cmCTest::CompressString(std::string& str)
ret = deflateInit(&strm, -1); //default compression level
if (ret != Z_OK)
{
+ delete[] out;
return false;
}
@@ -3109,6 +3132,7 @@ bool cmCTest::CompressString(std::string& str)
{
cmCTestLog(this, ERROR_MESSAGE, "Error during gzip compression."
<< std::endl);
+ delete[] out;
return false;
}
diff --git a/Source/cmCacheManager.cxx b/Source/cmCacheManager.cxx
index c8374db..ab0bb79 100644
--- a/Source/cmCacheManager.cxx
+++ b/Source/cmCacheManager.cxx
@@ -849,7 +849,8 @@ void cmCacheManager::CacheEntry::SetProperty(const char* prop,
//----------------------------------------------------------------------------
void cmCacheManager::CacheEntry::AppendProperty(const char* prop,
- const char* value)
+ const char* value,
+ bool asString)
{
if(strcmp(prop, "TYPE") == 0)
{
@@ -859,7 +860,7 @@ void cmCacheManager::CacheEntry::AppendProperty(const char* prop,
{
if(value)
{
- if(!this->Value.empty() && *value)
+ if(!this->Value.empty() && *value && !asString)
{
this->Value += ";";
}
@@ -868,7 +869,7 @@ void cmCacheManager::CacheEntry::AppendProperty(const char* prop,
}
else
{
- this->Properties.AppendProperty(prop, value, cmProperty::CACHE);
+ this->Properties.AppendProperty(prop, value, cmProperty::CACHE, asString);
}
}
@@ -893,11 +894,12 @@ void cmCacheManager::CacheIterator::SetProperty(const char* p, const char* v)
//----------------------------------------------------------------------------
void cmCacheManager::CacheIterator::AppendProperty(const char* p,
- const char* v)
+ const char* v,
+ bool asString)
{
if(!this->IsAtEnd())
{
- this->GetEntry().AppendProperty(p, v);
+ this->GetEntry().AppendProperty(p, v, asString);
}
}
diff --git a/Source/cmCacheManager.h b/Source/cmCacheManager.h
index 314017b..9c94d21 100644
--- a/Source/cmCacheManager.h
+++ b/Source/cmCacheManager.h
@@ -41,7 +41,8 @@ private:
cmPropertyMap Properties;
const char* GetProperty(const char*) const;
void SetProperty(const char* property, const char* value);
- void AppendProperty(const char* property, const char* value);
+ void AppendProperty(const char* property, const char* value,
+ bool asString=false);
bool Initialized;
CacheEntry() : Value(""), Type(UNINITIALIZED), Initialized(false)
{}
@@ -61,7 +62,8 @@ public:
bool GetPropertyAsBool(const char*) const ;
bool PropertyExists(const char*) const;
void SetProperty(const char* property, const char* value);
- void AppendProperty(const char* property, const char* value);
+ void AppendProperty(const char* property, const char* value,
+ bool asString=false);
void SetProperty(const char* property, bool value);
const char* GetValue() const { return this->GetEntry().Value.c_str(); }
bool GetValueAsBool() const;
diff --git a/Source/cmCommandArgumentLexer.cxx b/Source/cmCommandArgumentLexer.cxx
index 1367945..1d7140b 100644
--- a/Source/cmCommandArgumentLexer.cxx
+++ b/Source/cmCommandArgumentLexer.cxx
@@ -47,7 +47,7 @@
#if defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
/* C99 says to define __STDC_LIMIT_MACROS before including stdint.h,
- * if you want the limit (max/min) macros for int types.
+ * if you want the limit (max/min) macros for int types.
*/
#ifndef __STDC_LIMIT_MACROS
#define __STDC_LIMIT_MACROS 1
@@ -64,7 +64,7 @@ typedef uint32_t flex_uint32_t;
typedef signed char flex_int8_t;
typedef short int flex_int16_t;
typedef int flex_int32_t;
-typedef unsigned char flex_uint8_t;
+typedef unsigned char flex_uint8_t;
typedef unsigned short int flex_uint16_t;
typedef unsigned int flex_uint32_t;
@@ -189,7 +189,7 @@ typedef struct yy_buffer_state *YY_BUFFER_STATE;
#define EOB_ACT_LAST_MATCH 2
#define YY_LESS_LINENO(n)
-
+
/* Return all but the first "n" matched characters back to the input stream. */
#define yyless(n) \
do \
@@ -251,7 +251,7 @@ struct yy_buffer_state
int yy_bs_lineno; /**< The line count. */
int yy_bs_column; /**< The column count. */
-
+
/* Whether to try to fill the input buffer when we reach the
* end of it.
*/
@@ -832,25 +832,25 @@ YY_RULE_SETUP
case 2:
YY_RULE_SETUP
#line 72 "cmCommandArgumentLexer.in.l"
-{
+{
//std::cerr << __LINE__ << " here: [" << yytext << "]" << std::endl;
- yyextra->AllocateParserType(yylvalp, yytext+1, strlen(yytext)-2);
- return cal_NCURLY;
-}
+ yyextra->AllocateParserType(yylvalp, yytext+1, strlen(yytext)-2);
+ return cal_NCURLY;
+}
case 3:
YY_RULE_SETUP
#line 78 "cmCommandArgumentLexer.in.l"
-{
+{
//std::cerr << __LINE__ << " here: [" << yytext << "]" << std::endl;
- yyextra->AllocateParserType(yylvalp, yytext+1, strlen(yytext)-2);
- return cal_ATNAME;
-}
+ yyextra->AllocateParserType(yylvalp, yytext+1, strlen(yytext)-2);
+ return cal_ATNAME;
+}
case 4:
YY_RULE_SETUP
#line 84 "cmCommandArgumentLexer.in.l"
{
//std::cerr << __LINE__ << " here: [" << yytext << "]" << std::endl;
- //yyextra->AllocateParserType(yylvalp, yytext, strlen(yytext));
+ //yyextra->AllocateParserType(yylvalp, yytext, strlen(yytext));
yylvalp->str = yyextra->DCURLYVariable;
return cal_DCURLY;
}
@@ -859,7 +859,7 @@ YY_RULE_SETUP
#line 91 "cmCommandArgumentLexer.in.l"
{
//std::cerr << __LINE__ << " here: [" << yytext << "]" << std::endl;
- //yyextra->AllocateParserType(yylvalp, yytext, strlen(yytext));
+ //yyextra->AllocateParserType(yylvalp, yytext, strlen(yytext));
yylvalp->str = yyextra->RCURLYVariable;
return cal_RCURLY;
}
@@ -868,17 +868,17 @@ YY_RULE_SETUP
#line 98 "cmCommandArgumentLexer.in.l"
{
//std::cerr << __LINE__ << " here: [" << yytext << "]" << std::endl;
- //yyextra->AllocateParserType(yylvalp, yytext, strlen(yytext));
+ //yyextra->AllocateParserType(yylvalp, yytext, strlen(yytext));
yylvalp->str = yyextra->ATVariable;
return cal_AT;
}
case 7:
YY_RULE_SETUP
#line 105 "cmCommandArgumentLexer.in.l"
-{
+{
//std::cerr << __LINE__ << " here: [" << yytext << "]" << std::endl;
- yyextra->AllocateParserType(yylvalp, yytext, strlen(yytext));
- return cal_NAME;
+ yyextra->AllocateParserType(yylvalp, yytext, strlen(yytext));
+ return cal_NAME;
}
case 8:
YY_RULE_SETUP
@@ -888,40 +888,40 @@ YY_RULE_SETUP
{
return cal_ERROR;
}
- return cal_SYMBOL;
+ return cal_SYMBOL;
}
case 9:
/* rule 9 can match eol */
YY_RULE_SETUP
#line 119 "cmCommandArgumentLexer.in.l"
-{
+{
//std::cerr << __LINE__ << " here: [" << yytext << "]" << std::endl;
- yyextra->AllocateParserType(yylvalp, yytext, strlen(yytext));
- return cal_SYMBOL;
+ yyextra->AllocateParserType(yylvalp, yytext, strlen(yytext));
+ return cal_SYMBOL;
}
case 10:
YY_RULE_SETUP
#line 125 "cmCommandArgumentLexer.in.l"
{
- //yyextra->AllocateParserType(yylvalp, yytext, strlen(yytext));
+ //yyextra->AllocateParserType(yylvalp, yytext, strlen(yytext));
yylvalp->str = yyextra->DOLLARVariable;
- return cal_DOLLAR;
+ return cal_DOLLAR;
}
case 11:
YY_RULE_SETUP
#line 131 "cmCommandArgumentLexer.in.l"
{
- //yyextra->AllocateParserType(yylvalp, yytext, strlen(yytext));
+ //yyextra->AllocateParserType(yylvalp, yytext, strlen(yytext));
yylvalp->str = yyextra->LCURLYVariable;
- return cal_LCURLY;
+ return cal_LCURLY;
}
case 12:
YY_RULE_SETUP
#line 137 "cmCommandArgumentLexer.in.l"
{
- //yyextra->AllocateParserType(yylvalp, yytext, strlen(yytext));
+ //yyextra->AllocateParserType(yylvalp, yytext, strlen(yytext));
yylvalp->str = yyextra->BSLASHVariable;
- return cal_BSLASH;
+ return cal_BSLASH;
}
case 13:
YY_RULE_SETUP
@@ -1419,7 +1419,7 @@ static void cmCommandArgument_yy_load_buffer_state (yyscan_t yyscanner)
YY_BUFFER_STATE cmCommandArgument_yy_create_buffer (FILE * file, int size , yyscan_t yyscanner)
{
YY_BUFFER_STATE b;
-
+
b = (YY_BUFFER_STATE) cmCommandArgument_yyalloc(sizeof( struct yy_buffer_state ) ,yyscanner );
if ( ! b )
YY_FATAL_ERROR( "out of dynamic memory in cmCommandArgument_yy_create_buffer()" );
@@ -1463,7 +1463,7 @@ static void cmCommandArgument_yy_load_buffer_state (yyscan_t yyscanner)
#ifndef __cplusplus
extern int isatty (int );
#endif /* __cplusplus */
-
+
/* Initializes or reinitializes a buffer.
* This function is sometimes called more than once on the same buffer,
* such as during a cmCommandArgument_yyrestart() or at EOF.
@@ -1489,7 +1489,7 @@ extern int isatty (int );
}
b->yy_is_interactive = file ? (isatty( fileno(file) ) > 0) : 0;
-
+
errno = oerrno;
}
@@ -1595,9 +1595,9 @@ static void cmCommandArgument_yyensure_buffer_stack (yyscan_t yyscanner)
, yyscanner);
if ( ! yyg->yy_buffer_stack )
YY_FATAL_ERROR( "out of dynamic memory in cmCommandArgument_yyensure_buffer_stack()" );
-
+
memset(yyg->yy_buffer_stack, 0, num_to_alloc * sizeof(struct yy_buffer_state*));
-
+
yyg->yy_buffer_stack_max = num_to_alloc;
yyg->yy_buffer_stack_top = 0;
return;
@@ -1626,12 +1626,12 @@ static void cmCommandArgument_yyensure_buffer_stack (yyscan_t yyscanner)
* @param base the character buffer
* @param size the size in bytes of the character buffer
* @param yyscanner The scanner object.
- * @return the newly allocated buffer state object.
+ * @return the newly allocated buffer state object.
*/
YY_BUFFER_STATE cmCommandArgument_yy_scan_buffer (char * base, yy_size_t size , yyscan_t yyscanner)
{
YY_BUFFER_STATE b;
-
+
if ( size < 2 ||
base[size-2] != YY_END_OF_BUFFER_CHAR ||
base[size-1] != YY_END_OF_BUFFER_CHAR )
@@ -1667,14 +1667,14 @@ YY_BUFFER_STATE cmCommandArgument_yy_scan_buffer (char * base, yy_size_t size
*/
YY_BUFFER_STATE cmCommandArgument_yy_scan_string (yyconst char * yystr , yyscan_t yyscanner)
{
-
+
return cmCommandArgument_yy_scan_bytes(yystr,strlen(yystr) ,yyscanner);
}
/** Setup the input buffer state to scan the given bytes. The next call to cmCommandArgument_yylex() will
- * scan from a @e copy of @a bytes.
- * @param bytes the byte buffer to scan
- * @param len the number of bytes in the buffer pointed to by @a bytes.
+ * scan from a @e copy of @a yybytes.
+ * @param yybytes the byte buffer to scan
+ * @param _yybytes_len the number of bytes in the buffer pointed to by @a bytes.
* @param yyscanner The scanner object.
* @return the newly allocated buffer state object.
*/
@@ -1684,7 +1684,7 @@ YY_BUFFER_STATE cmCommandArgument_yy_scan_bytes (yyconst char * yybytes, int _
char *buf;
yy_size_t n;
int i;
-
+
/* Get memory for full buffer, including space for trailing EOB's. */
n = _yybytes_len + 2;
buf = (char *) cmCommandArgument_yyalloc(n ,yyscanner );
@@ -1752,10 +1752,10 @@ YY_EXTRA_TYPE cmCommandArgument_yyget_extra (yyscan_t yyscanner)
int cmCommandArgument_yyget_lineno (yyscan_t yyscanner)
{
struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
-
+
if (! YY_CURRENT_BUFFER)
return 0;
-
+
return yylineno;
}
@@ -1765,10 +1765,10 @@ int cmCommandArgument_yyget_lineno (yyscan_t yyscanner)
int cmCommandArgument_yyget_column (yyscan_t yyscanner)
{
struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
-
+
if (! YY_CURRENT_BUFFER)
return 0;
-
+
return yycolumn;
}
@@ -1829,13 +1829,13 @@ void cmCommandArgument_yyset_lineno (int line_number , yyscan_t yyscanner)
/* lineno is only valid if an input buffer exists. */
if (! YY_CURRENT_BUFFER )
- yy_fatal_error( "cmCommandArgument_yyset_lineno called with no buffer" , yyscanner);
-
+ yy_fatal_error( "cmCommandArgument_yyset_lineno called with no buffer" , yyscanner);
+
yylineno = line_number;
}
/** Set the current column.
- * @param line_number
+ * @param column_no
* @param yyscanner The scanner object.
*/
void cmCommandArgument_yyset_column (int column_no , yyscan_t yyscanner)
@@ -1844,8 +1844,8 @@ void cmCommandArgument_yyset_column (int column_no , yyscan_t yyscanner)
/* column is only valid if an input buffer exists. */
if (! YY_CURRENT_BUFFER )
- yy_fatal_error( "cmCommandArgument_yyset_column called with no buffer" , yyscanner);
-
+ yy_fatal_error( "cmCommandArgument_yyset_column called with no buffer" , yyscanner);
+
yycolumn = column_no;
}
@@ -1928,20 +1928,20 @@ int cmCommandArgument_yylex_init_extra(YY_EXTRA_TYPE yy_user_defined,yyscan_t* p
errno = EINVAL;
return 1;
}
-
+
*ptr_yy_globals = (yyscan_t) cmCommandArgument_yyalloc ( sizeof( struct yyguts_t ), &dummy_yyguts );
-
+
if (*ptr_yy_globals == NULL){
errno = ENOMEM;
return 1;
}
-
+
/* By setting to 0xAA, we expose bugs in
yy_init_globals. Leave at 0x00 for releases. */
memset(*ptr_yy_globals,0x00,sizeof(struct yyguts_t));
-
+
cmCommandArgument_yyset_extra (yy_user_defined, *ptr_yy_globals);
-
+
return yy_init_globals ( *ptr_yy_globals );
}
diff --git a/Source/cmComputeLinkInformation.cxx b/Source/cmComputeLinkInformation.cxx
index e3c33a2..f8ab686 100644
--- a/Source/cmComputeLinkInformation.cxx
+++ b/Source/cmComputeLinkInformation.cxx
@@ -1318,8 +1318,9 @@ void cmComputeLinkInformation::AddFrameworkItem(std::string const& item)
this->AddFrameworkPath(this->SplitFramework.match(1));
// Add the item using the -framework option.
- std::string fw = "-framework ";
- fw += this->SplitFramework.match(2);
+ this->Items.push_back(Item("-framework", false));
+ std::string fw = this->SplitFramework.match(2);
+ fw = this->LocalGenerator->EscapeForShell(fw.c_str());
this->Items.push_back(Item(fw, false));
}
@@ -1603,6 +1604,18 @@ void cmComputeLinkInformation::LoadImplicitLinkInfo()
cmSystemTools::ExpandListArgument(implicitLinks, implicitDirVec);
}
+ // Append library architecture to all implicit platform directories
+ // and add them to the set
+ if(const char* libraryArch =
+ this->Makefile->GetDefinition("CMAKE_LIBRARY_ARCHITECTURE"))
+ {
+ for (std::vector<std::string>::const_iterator i = implicitDirVec.begin();
+ i != implicitDirVec.end(); ++i)
+ {
+ this->ImplicitLinkDirs.insert(*i + "/" + libraryArch);
+ }
+ }
+
// Get language-specific implicit directories.
std::string implicitDirVar = "CMAKE_";
implicitDirVar += this->LinkLanguage;
diff --git a/Source/cmComputeTargetDepends.cxx b/Source/cmComputeTargetDepends.cxx
index a4ca363..8e701c4 100644
--- a/Source/cmComputeTargetDepends.cxx
+++ b/Source/cmComputeTargetDepends.cxx
@@ -276,9 +276,11 @@ void cmComputeTargetDepends::AddTargetDepend(int depender_index,
for(std::set<cmStdString>::const_iterator i = utils.begin();
i != utils.end(); ++i)
{
- cmTarget* transitive_dependee =
- dependee->GetMakefile()->FindTargetToUse(i->c_str());
- this->AddTargetDepend(depender_index, transitive_dependee, false);
+ if(cmTarget* transitive_dependee =
+ dependee->GetMakefile()->FindTargetToUse(i->c_str()))
+ {
+ this->AddTargetDepend(depender_index, transitive_dependee, false);
+ }
}
}
else
@@ -402,7 +404,7 @@ cmComputeTargetDepends
// Describe the depender.
e << " \"" << depender->GetName() << "\" of type "
- << cmTarget::TargetTypeNames[depender->GetType()] << "\n";
+ << cmTarget::GetTargetTypeName(depender->GetType()) << "\n";
// List its dependencies that are inside the component.
EdgeList const& nl = this->InitialGraph[i];
diff --git a/Source/cmCoreTryCompile.cxx b/Source/cmCoreTryCompile.cxx
index 96a214e..dca2fb3 100644
--- a/Source/cmCoreTryCompile.cxx
+++ b/Source/cmCoreTryCompile.cxx
@@ -22,12 +22,12 @@ int cmCoreTryCompile::TryCompileCode(std::vector<std::string> const& argv)
// which signature were we called with ?
this->SrcFileSignature = false;
unsigned int i;
-
+
const char* sourceDirectory = argv[2].c_str();
const char* projectName = 0;
const char* targetName = 0;
int extraArgs = 0;
-
+
// look for CMAKE_FLAGS and store them
std::vector<std::string> cmakeFlags;
for (i = 3; i < argv.size(); ++i)
@@ -37,8 +37,8 @@ int cmCoreTryCompile::TryCompileCode(std::vector<std::string> const& argv)
// CMAKE_FLAGS is the first argument because we need an argv[0] that
// is not used, so it matches regular command line parsing which has
// the program name as arg 0
- for (; i < argv.size() && argv[i] != "COMPILE_DEFINITIONS" &&
- argv[i] != "OUTPUT_VARIABLE";
+ for (; i < argv.size() && argv[i] != "COMPILE_DEFINITIONS" &&
+ argv[i] != "OUTPUT_VARIABLE";
++i)
{
extraArgs++;
@@ -73,8 +73,8 @@ int cmCoreTryCompile::TryCompileCode(std::vector<std::string> const& argv)
if (argv[i] == "COMPILE_DEFINITIONS")
{
extraArgs++;
- for (i = i + 1; i < argv.size() && argv[i] != "CMAKE_FLAGS" &&
- argv[i] != "OUTPUT_VARIABLE";
+ for (i = i + 1; i < argv.size() && argv[i] != "CMAKE_FLAGS" &&
+ argv[i] != "OUTPUT_VARIABLE";
++i)
{
extraArgs++;
@@ -101,7 +101,7 @@ int cmCoreTryCompile::TryCompileCode(std::vector<std::string> const& argv)
break;
}
}
-
+
// do we have a srcfile signature
if (argv.size() - extraArgs == 3)
{
@@ -133,7 +133,7 @@ int cmCoreTryCompile::TryCompileCode(std::vector<std::string> const& argv)
}
// make sure the binary directory exists
cmSystemTools::MakeDirectory(this->BinaryDirectory.c_str());
-
+
// do not allow recursive try Compiles
if (this->BinaryDirectory == this->Makefile->GetHomeOutputDirectory())
{
@@ -143,7 +143,7 @@ int cmCoreTryCompile::TryCompileCode(std::vector<std::string> const& argv)
this->Makefile->IssueMessage(cmake::FATAL_ERROR, e.str());
return -1;
}
-
+
std::string outFileName = this->BinaryDirectory + "/CMakeLists.txt";
// which signature are we using? If we are using var srcfile bindir
if (this->SrcFileSignature)
@@ -151,7 +151,7 @@ int cmCoreTryCompile::TryCompileCode(std::vector<std::string> const& argv)
// remove any CMakeCache.txt files so we will have a clean test
std::string ccFile = this->BinaryDirectory + "/CMakeCache.txt";
cmSystemTools::RemoveFile(ccFile.c_str());
-
+
// we need to create a directory and CMakeList file etc...
// first create the directories
sourceDirectory = this->BinaryDirectory.c_str();
@@ -226,7 +226,7 @@ int cmCoreTryCompile::TryCompileCode(std::vector<std::string> const& argv)
langFlags += "_FLAGS";
fprintf(fout, "SET(CMAKE_VERBOSE_MAKEFILE 1)\n");
fprintf(fout, "SET(CMAKE_%s_FLAGS \"", lang);
- const char* flags = this->Makefile->GetDefinition(langFlags.c_str());
+ const char* flags = this->Makefile->GetDefinition(langFlags.c_str());
if(flags)
{
fprintf(fout, " %s ", flags);
@@ -247,10 +247,10 @@ int cmCoreTryCompile::TryCompileCode(std::vector<std::string> const& argv)
}
/* for the TRY_COMPILEs we want to be able to specify the architecture.
- So the user can set CMAKE_OSX_ARCHITECTURE to i386;ppc and then set
+ So the user can set CMAKE_OSX_ARCHITECTURE to i386;ppc and then set
CMAKE_TRY_COMPILE_OSX_ARCHITECTURE first to i386 and then to ppc to
- have the tests run for each specific architecture. Since
- cmLocalGenerator doesn't allow building for "the other"
+ have the tests run for each specific architecture. Since
+ cmLocalGenerator doesn't allow building for "the other"
architecture only via CMAKE_OSX_ARCHITECTURES.
*/
if(this->Makefile->GetDefinition("CMAKE_TRY_COMPILE_OSX_ARCHITECTURES")!=0)
@@ -286,45 +286,45 @@ int cmCoreTryCompile::TryCompileCode(std::vector<std::string> const& argv)
this->BinaryDirectory.c_str());
/* Create the actual executable. */
fprintf(fout, "ADD_EXECUTABLE(cmTryCompileExec \"%s\")\n",source.c_str());
- fprintf(fout,
+ fprintf(fout,
"TARGET_LINK_LIBRARIES(cmTryCompileExec ${LINK_LIBRARIES})\n");
fclose(fout);
projectName = "CMAKE_TRY_COMPILE";
targetName = "cmTryCompileExec";
- // if the source is not in CMakeTmp
+ // if the source is not in CMakeTmp
if(source.find("CMakeTmp") == source.npos)
{
this->Makefile->AddCMakeDependFile(source.c_str());
}
-
+
}
// else the srcdir bindir project target signature
else
{
projectName = argv[3].c_str();
-
+
if (argv.size() - extraArgs == 5)
{
targetName = argv[4].c_str();
}
}
-
+
bool erroroc = cmSystemTools::GetErrorOccuredFlag();
cmSystemTools::ResetErrorOccuredFlag();
std::string output;
// actually do the try compile now that everything is setup
- int res = this->Makefile->TryCompile(sourceDirectory,
+ int res = this->Makefile->TryCompile(sourceDirectory,
this->BinaryDirectory.c_str(),
- projectName,
- targetName,
+ projectName,
+ targetName,
this->SrcFileSignature,
- &cmakeFlags,
+ &cmakeFlags,
&output);
if ( erroroc )
{
cmSystemTools::SetErrorOccured();
}
-
+
// set the result var to the return value to indicate success or failure
this->Makefile->AddCacheDefinition(argv[0].c_str(),
(res == 0 ? "TRUE" : "FALSE"),
@@ -335,7 +335,7 @@ int cmCoreTryCompile::TryCompileCode(std::vector<std::string> const& argv)
{
this->Makefile->AddDefinition(outputVariable.c_str(), output.c_str());
}
-
+
if (this->SrcFileSignature)
{
this->FindOutputFile(targetName);
@@ -369,7 +369,7 @@ void cmCoreTryCompile::CleanupFiles(const char* binDir)
{
return;
}
-
+
std::string bdir = binDir;
if(bdir.find("CMakeTmp") == std::string::npos)
{
@@ -378,7 +378,7 @@ void cmCoreTryCompile::CleanupFiles(const char* binDir)
"CMakeTmp:", binDir);
return;
}
-
+
cmsys::Directory dir;
dir.Load(binDir);
size_t fileNum;
@@ -388,8 +388,8 @@ void cmCoreTryCompile::CleanupFiles(const char* binDir)
if (strcmp(dir.GetFile(static_cast<unsigned long>(fileNum)),".") &&
strcmp(dir.GetFile(static_cast<unsigned long>(fileNum)),".."))
{
-
- if(deletedFiles.find( dir.GetFile(static_cast<unsigned long>(fileNum)))
+
+ if(deletedFiles.find( dir.GetFile(static_cast<unsigned long>(fileNum)))
== deletedFiles.end())
{
deletedFiles.insert(dir.GetFile(static_cast<unsigned long>(fileNum)));
diff --git a/Source/cmCoreTryCompile.h b/Source/cmCoreTryCompile.h
index e29dde8..5c67f13 100644
--- a/Source/cmCoreTryCompile.h
+++ b/Source/cmCoreTryCompile.h
@@ -28,27 +28,27 @@ public:
/**
* This is the core code for try compile. It is here so that other
* commands, such as TryRun can access the same logic without
- * duplication.
+ * duplication.
*/
int TryCompileCode(std::vector<std::string> const& argv);
- /**
- * This deletes all the files created by TryCompileCode.
+ /**
+ * This deletes all the files created by TryCompileCode.
* This way we do not have to rely on the timing and
* dependencies of makefiles.
*/
void CleanupFiles(const char* binDir);
- /**
- * This tries to find the (executable) file created by
+ /**
+ * This tries to find the (executable) file created by
TryCompileCode. The result is stored in OutputFile. If nothing is found,
the error message is stored in FindErrorMessage.
*/
void FindOutputFile(const char* targetName);
-
+
cmTypeMacro(cmCoreTryCompile, cmCommand);
-
+
std::string BinaryDirectory;
std::string OutputFile;
std::string FindErrorMessage;
diff --git a/Source/cmDependsFortranLexer.cxx b/Source/cmDependsFortranLexer.cxx
index a488884..438af2d 100644
--- a/Source/cmDependsFortranLexer.cxx
+++ b/Source/cmDependsFortranLexer.cxx
@@ -1991,9 +1991,9 @@ YY_BUFFER_STATE cmDependsFortran_yy_scan_string (yyconst char * yystr , yyscan_t
}
/** Setup the input buffer state to scan the given bytes. The next call to cmDependsFortran_yylex() will
- * scan from a @e copy of @a bytes.
- * @param bytes the byte buffer to scan
- * @param len the number of bytes in the buffer pointed to by @a bytes.
+ * scan from a @e copy of @a yybytes.
+ * @param yybytes the byte buffer to scan
+ * @param _yybytes_len the number of bytes in the buffer pointed to by @a bytes.
* @param yyscanner The scanner object.
* @return the newly allocated buffer state object.
*/
@@ -2154,7 +2154,7 @@ void cmDependsFortran_yyset_lineno (int line_number , yyscan_t yyscanner)
}
/** Set the current column.
- * @param line_number
+ * @param column_no
* @param yyscanner The scanner object.
*/
void cmDependsFortran_yyset_column (int column_no , yyscan_t yyscanner)
diff --git a/Source/cmDependsJavaLexer.cxx b/Source/cmDependsJavaLexer.cxx
index d7149c7..63cfebc 100644
--- a/Source/cmDependsJavaLexer.cxx
+++ b/Source/cmDependsJavaLexer.cxx
@@ -48,7 +48,7 @@ typedef uint32_t flex_uint32_t;
typedef signed char flex_int8_t;
typedef short int flex_int16_t;
typedef int flex_int32_t;
-typedef unsigned char flex_uint8_t;
+typedef unsigned char flex_uint8_t;
typedef unsigned short int flex_uint16_t;
typedef unsigned int flex_uint32_t;
#endif /* ! C99 */
@@ -169,7 +169,7 @@ typedef struct yy_buffer_state *YY_BUFFER_STATE;
#define EOB_ACT_LAST_MATCH 2
#define YY_LESS_LINENO(n)
-
+
/* Return all but the first "n" matched characters back to the input stream. */
#define yyless(n) \
do \
@@ -234,7 +234,7 @@ struct yy_buffer_state
int yy_bs_lineno; /**< The line count. */
int yy_bs_column; /**< The column count. */
-
+
/* Whether to try to fill the input buffer when we reach the
* end of it.
*/
@@ -1428,9 +1428,9 @@ YY_RULE_SETUP
case 107:
YY_RULE_SETUP
#line 200 "cmDependsJavaLexer.in.l"
-{
- yyextra->AllocateParserType(yylvalp, yytext, strlen(yytext));
- return jp_NAME;
+{
+ yyextra->AllocateParserType(yylvalp, yytext, strlen(yytext));
+ return jp_NAME;
}
case 108:
/* rule 108 can match eol */
@@ -1447,11 +1447,11 @@ YY_RULE_SETUP
case 110:
YY_RULE_SETUP
#line 207 "cmDependsJavaLexer.in.l"
-{
- std::cerr << "Unknown character: " << yytext[0]
- << " (" << (int)yytext[0] << ")" << std::endl;
- yyextra->Error("Unknown character");
- return jp_ERROR;
+{
+ std::cerr << "Unknown character: " << yytext[0]
+ << " (" << (int)yytext[0] << ")" << std::endl;
+ yyextra->Error("Unknown character");
+ return jp_ERROR;
}
case 111:
YY_RULE_SETUP
@@ -1933,7 +1933,7 @@ static void cmDependsJava_yy_load_buffer_state (yyscan_t yyscanner)
YY_BUFFER_STATE cmDependsJava_yy_create_buffer (FILE * file, int size , yyscan_t yyscanner)
{
YY_BUFFER_STATE b;
-
+
b = (YY_BUFFER_STATE) cmDependsJava_yyalloc(sizeof( struct yy_buffer_state ) ,yyscanner );
if ( ! b )
YY_FATAL_ERROR( "out of dynamic memory in cmDependsJava_yy_create_buffer()" );
@@ -1977,7 +1977,7 @@ static void cmDependsJava_yy_load_buffer_state (yyscan_t yyscanner)
#ifndef __cplusplus
extern int isatty (int );
#endif /* __cplusplus */
-
+
/* Initializes or reinitializes a buffer.
* This function is sometimes called more than once on the same buffer,
* such as during a cmDependsJava_yyrestart() or at EOF.
@@ -2003,7 +2003,7 @@ extern int isatty (int );
}
b->yy_is_interactive = file ? (isatty( fileno(file) ) > 0) : 0;
-
+
errno = oerrno;
}
@@ -2107,9 +2107,9 @@ static void cmDependsJava_yyensure_buffer_stack (yyscan_t yyscanner)
yyg->yy_buffer_stack = (struct yy_buffer_state**)cmDependsJava_yyalloc
(nuto_alloc * sizeof(struct yy_buffer_state*)
, yyscanner);
-
+
memset(yyg->yy_buffer_stack, 0, nuto_alloc * sizeof(struct yy_buffer_state*));
-
+
yyg->yy_buffer_stack_max = nuto_alloc;
yyg->yy_buffer_stack_top = 0;
return;
@@ -2136,12 +2136,12 @@ static void cmDependsJava_yyensure_buffer_stack (yyscan_t yyscanner)
* @param base the character buffer
* @param size the size in bytes of the character buffer
* @param yyscanner The scanner object.
- * @return the newly allocated buffer state object.
+ * @return the newly allocated buffer state object.
*/
YY_BUFFER_STATE cmDependsJava_yy_scan_buffer (char * base, yy_size_t size , yyscan_t yyscanner)
{
YY_BUFFER_STATE b;
-
+
if ( size < 2 ||
base[size-2] != YY_END_OF_BUFFER_CHAR ||
base[size-1] != YY_END_OF_BUFFER_CHAR )
@@ -2168,8 +2168,8 @@ YY_BUFFER_STATE cmDependsJava_yy_scan_buffer (char * base, yy_size_t size , yy
}
/** Setup the input buffer state to scan a string. The next call to cmDependsJava_yylex() will
- * scan from a @e copy of @a str.
- * @param str a NUL-terminated string to scan
+ * scan from a @e copy of @a yy_str.
+ * @param yy_str a NUL-terminated string to scan
* @param yyscanner The scanner object.
* @return the newly allocated buffer state object.
* @note If you want to scan bytes that may contain NUL values, then use
@@ -2177,7 +2177,7 @@ YY_BUFFER_STATE cmDependsJava_yy_scan_buffer (char * base, yy_size_t size , yy
*/
YY_BUFFER_STATE cmDependsJava_yy_scan_string (yyconst char * yy_str , yyscan_t yyscanner)
{
-
+
return cmDependsJava_yy_scan_bytes(yy_str,strlen(yy_str) ,yyscanner);
}
@@ -2194,7 +2194,7 @@ YY_BUFFER_STATE cmDependsJava_yy_scan_bytes (yyconst char * bytes, int len , y
char *buf;
yy_size_t n;
int i;
-
+
/* Get memory for full buffer, including space for trailing EOB's. */
n = len + 2;
buf = (char *) cmDependsJava_yyalloc(n ,yyscanner );
@@ -2262,10 +2262,10 @@ YY_EXTRA_TYPE cmDependsJava_yyget_extra (yyscan_t yyscanner)
int cmDependsJava_yyget_lineno (yyscan_t yyscanner)
{
struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
-
+
if (! YY_CURRENT_BUFFER)
return 0;
-
+
return yylineno;
}
@@ -2275,10 +2275,10 @@ int cmDependsJava_yyget_lineno (yyscan_t yyscanner)
int cmDependsJava_yyget_column (yyscan_t yyscanner)
{
struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
-
+
if (! YY_CURRENT_BUFFER)
return 0;
-
+
return yycolumn;
}
@@ -2339,13 +2339,13 @@ void cmDependsJava_yyset_lineno (int line_number , yyscan_t yyscanner)
/* lineno is only valid if an input buffer exists. */
if (! YY_CURRENT_BUFFER )
- yy_fatal_error( "cmDependsJava_yyset_lineno called with no buffer" , yyscanner);
-
+ yy_fatal_error( "cmDependsJava_yyset_lineno called with no buffer" , yyscanner);
+
yylineno = line_number;
}
/** Set the current column.
- * @param line_number
+ * @param column_no
* @param yyscanner The scanner object.
*/
void cmDependsJava_yyset_column (int column_no , yyscan_t yyscanner)
@@ -2354,8 +2354,8 @@ void cmDependsJava_yyset_column (int column_no , yyscan_t yyscanner)
/* column is only valid if an input buffer exists. */
if (! YY_CURRENT_BUFFER )
- yy_fatal_error( "cmDependsJava_yyset_column called with no buffer" , yyscanner);
-
+ yy_fatal_error( "cmDependsJava_yyset_column called with no buffer" , yyscanner);
+
yycolumn = column_no;
}
diff --git a/Source/cmDocumentVariables.cxx b/Source/cmDocumentVariables.cxx
index ea25e60..ed303c9 100644
--- a/Source/cmDocumentVariables.cxx
+++ b/Source/cmDocumentVariables.cxx
@@ -126,7 +126,7 @@ void cmDocumentVariables::DefineVariables(cmake* cm)
"This variable is set to the program that will be"
" needed to build the output of CMake. If the "
"generator selected was Visual Studio 6, the "
- "CMAKE_MAKE_PROGRAM will be set to msdev, for "
+ "CMAKE_BUILD_TOOL will be set to msdev, for "
"Unix makefiles it will be set to make or gmake, "
"and for Visual Studio 7 it set to devenv. For "
"Nmake Makefiles the value is nmake. This can be "
@@ -719,6 +719,20 @@ void cmDocumentVariables::DefineVariables(cmake* cm)
"Variables That Change Behavior");
cm->DefineProperty
+ ("CMAKE_DISABLE_FIND_PACKAGE_<PackageName>", cmProperty::VARIABLE,
+ "Variable for disabling find_package() calls.",
+ "Every non-REQUIRED find_package() call in a project can be disabled "
+ "by setting the variable CMAKE_DISABLE_FIND_PACKAGE_<PackageName> to "
+ "TRUE. This can be used to build a project without an optional package, "
+ "although that package is installed.\n"
+ "This switch should be used during the initial CMake run. Otherwise if "
+ "the package has already been found in a previous CMake run, the "
+ "variables which have been stored in the cache will still be there. "
+ "In the case it is recommended to remove the cache variables for "
+ "this package from the cache using the cache editor or cmake -U", false,
+ "Variables That Change Behavior");
+
+ cm->DefineProperty
("CMAKE_USER_MAKE_RULES_OVERRIDE", cmProperty::VARIABLE,
"Specify a CMake file that overrides platform information.",
"CMake loads the specified file while enabling support for each "
@@ -939,7 +953,7 @@ void cmDocumentVariables::DefineVariables(cmake* cm)
cm->DefineProperty
("WIN32", cmProperty::VARIABLE,
"True on windows systems, including win64.",
- "Set to true when the target system is Windows and on cygwin.",false,
+ "Set to true when the target system is Windows.",false,
"Variables That Describe the System");
cm->DefineProperty
@@ -1035,6 +1049,15 @@ void cmDocumentVariables::DefineVariables(cmake* cm)
"Variables that Control the Build");
cm->DefineProperty
+ ("CMAKE_Fortran_FORMAT", cmProperty::VARIABLE,
+ "Set to FIXED or FREE to indicate the Fortran source layout.",
+ "This variable is used to initialize the Fortran_FORMAT "
+ "property on all the targets. "
+ "See that target property for additional information.",
+ false,
+ "Variables that Control the Build");
+
+ cm->DefineProperty
("CMAKE_Fortran_MODULE_DIRECTORY", cmProperty::VARIABLE,
"Fortran module output directory.",
"This variable is used to initialize the "
@@ -1071,6 +1094,24 @@ void cmDocumentVariables::DefineVariables(cmake* cm)
"Variables that Control the Build");
cm->DefineProperty
+ ("CMAKE_AUTOMOC", cmProperty::VARIABLE,
+ "Whether to handle moc automatically for Qt targets.",
+ "This variable is used to initialize the "
+ "AUTOMOC property on all the targets. "
+ "See that target property for additional information.",
+ false,
+ "Variables that Control the Build");
+
+ cm->DefineProperty
+ ("CMAKE_AUTOMOC_MOC_OPTIONS", cmProperty::VARIABLE,
+ "Additional options for moc when using automoc (see CMAKE_AUTOMOC).",
+ "This variable is used to initialize the "
+ "AUTOMOC_MOC_OPTIONS property on all the targets. "
+ "See that target property for additional information.",
+ false,
+ "Variables that Control the Build");
+
+ cm->DefineProperty
("CMAKE_DEBUG_POSTFIX", cmProperty::VARIABLE,
"See variable CMAKE_<CONFIG>_POSTFIX.",
"This variable is a special case of the more-general "
@@ -1187,7 +1228,14 @@ void cmDocumentVariables::DefineVariables(cmake* cm)
"Therefore a specific build configuration must be chosen even "
"if the generated build system supports multiple configurations.",false,
"Variables that Control the Build");
-
+ cm->DefineProperty
+ ("CMAKE_LINK_INTERFACE_LIBRARIES", cmProperty::VARIABLE,
+ "Default value for LINK_INTERFACE_LIBRARIES of targets.",
+ "This variable is used to initialize the "
+ "LINK_INTERFACE_LIBRARIES property on all the targets. "
+ "See that target property for additional information.",
+ false,
+ "Variables that Control the Build");
// Variables defined when the a language is enabled These variables will
// also be defined whenever CMake has loaded its support for compiling (LANG)
diff --git a/Source/cmDocumentation.cxx b/Source/cmDocumentation.cxx
index bfe11c1..07683d0 100644
--- a/Source/cmDocumentation.cxx
+++ b/Source/cmDocumentation.cxx
@@ -21,7 +21,7 @@ static const char *cmDocumentationStandardOptions[][3] =
{
{"--copyright [file]", "Print the CMake copyright and exit.",
"If a file is specified, the copyright is written into it."},
- {"--help", "Print usage information and exit.",
+ {"--help,-help,-usage,-h,-H,/?", "Print usage information and exit.",
"Usage describes the basic command line interface and its options."},
{"--help-full [file]", "Print full help and exit.",
"Full help displays most of the documentation provided by the UNIX "
@@ -34,7 +34,8 @@ static const char *cmDocumentationStandardOptions[][3] =
{"--help-man [file]", "Print full help as a UNIX man page and exit.",
"This option is used by the cmake build to generate the UNIX man page. "
"If a file is specified, the help is written into it."},
- {"--version [file]", "Show program name/version banner and exit.",
+ {"--version,-version,/V [file]",
+ "Show program name/version banner and exit.",
"If a file is specified, the version is written into it."},
{0,0,0}
};
@@ -235,24 +236,24 @@ cmDocumentation::cmDocumentation()
sec = new cmDocumentationSection("See Also","SEE ALSO");
sec->Append(cmDocumentationStandardSeeAlso);
- this->AllSections["Standard See Also"] = sec;
+ this->AllSections["Standard See Also"] = sec;
sec = new cmDocumentationSection("Options","OPTIONS");
sec->Append(cmDocumentationStandardOptions);
- this->AllSections["Options"] = sec;
+ this->AllSections["Options"] = sec;
sec = new cmDocumentationSection("Properties","PROPERTIES");
sec->Append(cmPropertiesDocumentationDescription);
- this->AllSections["Properties Description"] = sec;
+ this->AllSections["Properties Description"] = sec;
sec = new cmDocumentationSection("Generators","GENERATORS");
sec->Append(cmDocumentationGeneratorsHeader);
- this->AllSections["Generators"] = sec;
+ this->AllSections["Generators"] = sec;
sec = new cmDocumentationSection("Compatibility Commands",
"COMPATIBILITY COMMANDS");
sec->Append(cmCompatCommandsDocumentationDescription);
- this->AllSections["Compatibility Commands"] = sec;
+ this->AllSections["Compatibility Commands"] = sec;
this->PropertySections.push_back("Properties of Global Scope");
@@ -279,7 +280,7 @@ cmDocumentation::~cmDocumentation()
{
delete [] *i;
}
- for(std::map<std::string,cmDocumentationSection *>::iterator i =
+ for(std::map<std::string,cmDocumentationSection *>::iterator i =
this->AllSections.begin();
i != this->AllSections.end(); ++i)
{
@@ -314,7 +315,7 @@ bool cmDocumentation::PrintCopyright(std::ostream& os)
//----------------------------------------------------------------------------
bool cmDocumentation::PrintVersion(std::ostream& os)
{
- os << this->GetNameString() << " version "
+ os << this->GetNameString() << " version "
<< cmVersion::GetCMakeVersion() << "\n";
return true;
}
@@ -331,7 +332,7 @@ void cmDocumentation::AddSectionToPrint(const char *section)
//----------------------------------------------------------------------------
void cmDocumentation::ClearSections()
{
- this->PrintSections.erase(this->PrintSections.begin(),
+ this->PrintSections.erase(this->PrintSections.begin(),
this->PrintSections.end());
this->ModulesFound.clear();
}
@@ -359,7 +360,7 @@ void cmDocumentation::AddDocumentIntroToPrint(const char* intro[2])
bool cmDocumentation::PrintDocumentation(Type ht, std::ostream& os,
const char* docname)
{
- if ((this->CurrentFormatter->GetForm() != HTMLForm)
+ if ((this->CurrentFormatter->GetForm() != HTMLForm)
&& (this->CurrentFormatter->GetForm() != DocbookForm)
&& (this->CurrentFormatter->GetForm() != ManForm))
{
@@ -394,8 +395,8 @@ bool cmDocumentation::PrintDocumentation(Type ht, std::ostream& os,
this->PrintDocumentationList(os,"Commands");
this->PrintDocumentationList(os,"Compatibility Commands");
return true;
- case cmDocumentation::ModuleList:
- // find the modules first, print the custom module docs only if
+ case cmDocumentation::ModuleList:
+ // find the modules first, print the custom module docs only if
// any custom modules have been found actually, Alex
this->CreateCustomModulesSection();
this->CreateModulesSection();
@@ -406,43 +407,43 @@ bool cmDocumentation::PrintDocumentation(Type ht, std::ostream& os,
}
this->PrintDocumentationList(os,"Modules");
return true;
- case cmDocumentation::PropertyList:
+ case cmDocumentation::PropertyList:
this->PrintDocumentationList(os,"Properties Description");
- for (std::vector<std::string>::iterator i =
+ for (std::vector<std::string>::iterator i =
this->PropertySections.begin();
i != this->PropertySections.end(); ++i)
{
this->PrintDocumentationList(os,i->c_str());
}
return true;
- case cmDocumentation::VariableList:
- for (std::vector<std::string>::iterator i =
+ case cmDocumentation::VariableList:
+ for (std::vector<std::string>::iterator i =
this->VariableSections.begin();
i != this->VariableSections.end(); ++i)
{
this->PrintDocumentationList(os,i->c_str());
}
return true;
- case cmDocumentation::Full:
+ case cmDocumentation::Full:
return this->PrintDocumentationFull(os);
- case cmDocumentation::Modules:
+ case cmDocumentation::Modules:
return this->PrintDocumentationModules(os);
- case cmDocumentation::CustomModules:
+ case cmDocumentation::CustomModules:
return this->PrintDocumentationCustomModules(os);
- case cmDocumentation::Policies:
+ case cmDocumentation::Policies:
return this->PrintDocumentationPolicies(os);
- case cmDocumentation::Properties:
+ case cmDocumentation::Properties:
return this->PrintDocumentationProperties(os);
- case cmDocumentation::Variables:
+ case cmDocumentation::Variables:
return this->PrintDocumentationVariables(os);
- case cmDocumentation::Commands:
+ case cmDocumentation::Commands:
return this->PrintDocumentationCurrentCommands(os);
- case cmDocumentation::CompatCommands:
+ case cmDocumentation::CompatCommands:
return this->PrintDocumentationCompatCommands(os);
- case cmDocumentation::Copyright:
+ case cmDocumentation::Copyright:
return this->PrintCopyright(os);
- case cmDocumentation::Version:
+ case cmDocumentation::Version:
return true;
default: return false;
}
@@ -451,7 +452,7 @@ bool cmDocumentation::PrintDocumentation(Type ht, std::ostream& os,
//----------------------------------------------------------------------------
bool cmDocumentation::CreateModulesSection()
{
- cmDocumentationSection *sec =
+ cmDocumentationSection *sec =
new cmDocumentationSection("Standard CMake Modules", "MODULES");
this->AllSections["Modules"] = sec;
std::string cmakeModules = this->CMakeRoot;
@@ -485,7 +486,7 @@ bool cmDocumentation::CreateCustomModulesSection()
{
if (!sectionHasHeader)
{
- cmDocumentationSection *sec =
+ cmDocumentationSection *sec =
new cmDocumentationSection("Custom CMake Modules","CUSTOM MODULES");
this->AllSections["Custom CMake Modules"] = sec;
sec->Append(cmDocumentationCustomModulesHeader[0]);
@@ -502,10 +503,10 @@ bool cmDocumentation::CreateCustomModulesSection()
//----------------------------------------------------------------------------
void cmDocumentation
-::CreateModuleDocsForDir(cmsys::Directory& dir,
+::CreateModuleDocsForDir(cmsys::Directory& dir,
cmDocumentationSection &moduleSection)
{
- // sort the files alphabetically, so the docs for one module are easier
+ // sort the files alphabetically, so the docs for one module are easier
// to find than if they are in random order
std::vector<std::string> sortedFiles;
for(unsigned int i = 0; i < dir.GetNumberOfFiles(); ++i)
@@ -530,7 +531,7 @@ void cmDocumentation
std::string path = dir.GetPath();
path += "/";
path += (*fname);
- this->CreateSingleModule(path.c_str(), moduleName.c_str(),
+ this->CreateSingleModule(path.c_str(), moduleName.c_str(),
moduleSection);
}
}
@@ -539,7 +540,7 @@ void cmDocumentation
}
//----------------------------------------------------------------------------
-bool cmDocumentation::CreateSingleModule(const char* fname,
+bool cmDocumentation::CreateSingleModule(const char* fname,
const char* moduleName,
cmDocumentationSection &moduleSection)
{
@@ -548,7 +549,7 @@ bool cmDocumentation::CreateSingleModule(const char* fname,
{
std::cerr << "Internal error: can not open module." << fname << std::endl;
return false;
- }
+ }
std::string line;
std::string text;
std::string brief;
@@ -561,14 +562,14 @@ bool cmDocumentation::CreateSingleModule(const char* fname,
// blank line
if(line.size() <= 2)
{
- text += "\n";
+ text += "\n";
newParagraph = true;
}
- else if(line[2] == '-')
+ else if(line[2] == '-')
{
brief = line.c_str()+4;
}
- else
+ else
{
// two spaces
if(line[1] == ' ' && line[2] == ' ')
@@ -630,11 +631,11 @@ bool cmDocumentation::CreateSingleModule(const char* fname,
bool cmDocumentation::PrintRequestedDocumentation(std::ostream& os)
{
bool result = true;
-
+
// Loop over requested documentation types.
- for(std::vector<RequestedHelpItem>::const_iterator
+ for(std::vector<RequestedHelpItem>::const_iterator
i = this->RequestedHelpItems.begin();
- i != this->RequestedHelpItems.end();
+ i != this->RequestedHelpItems.end();
++i)
{
this->SetForm(i->HelpForm);
@@ -660,13 +661,13 @@ bool cmDocumentation::PrintRequestedDocumentation(std::ostream& os)
docname = cmSystemTools::GetFilenameWithoutLastExtension(i->Filename);
}
}
-
+
// Print this documentation type to the stream.
if(!this->PrintDocumentation(i->HelpType, *s, docname.c_str()) || !*s)
{
result = false;
}
-
+
// Close the file if we wrote one.
if(fout)
{
@@ -876,8 +877,8 @@ bool cmDocumentation::CheckOptions(int argc, const char* const* argv,
GET_OPT_ARGUMENT(help.Filename);
help.HelpForm = cmDocumentation::UsageForm;
}
- else if((strcmp(argv[i], "--version") == 0) ||
- (strcmp(argv[i], "-version") == 0) ||
+ else if((strcmp(argv[i], "--version") == 0) ||
+ (strcmp(argv[i], "-version") == 0) ||
(strcmp(argv[i], "/V") == 0))
{
help.HelpType = cmDocumentation::Version;
@@ -904,14 +905,14 @@ void cmDocumentation::Print(Form f, std::ostream& os)
//----------------------------------------------------------------------------
void cmDocumentation::Print(std::ostream& os)
{
- // if the formatter supports it, print a master index for
+ // if the formatter supports it, print a master index for
// all sections
this->CurrentFormatter->PrintIndex(os, this->PrintSections);
for(unsigned int i=0; i < this->PrintSections.size(); ++i)
{
std::string name = this->PrintSections[i]->
GetName((this->CurrentFormatter->GetForm()));
- this->CurrentFormatter->PrintSection(os,*this->PrintSections[i],
+ this->CurrentFormatter->PrintSection(os,*this->PrintSections[i],
name.c_str());
}
}
@@ -929,7 +930,7 @@ void cmDocumentation::SetDocName(const char *docname)
}
//----------------------------------------------------------------------------
-void cmDocumentation::SetSection(const char *name,
+void cmDocumentation::SetSection(const char *name,
cmDocumentationSection *section)
{
if (this->AllSections.find(name) != this->AllSections.end())
@@ -940,22 +941,22 @@ void cmDocumentation::SetSection(const char *name,
}
//----------------------------------------------------------------------------
-void cmDocumentation::SetSection(const char *name,
+void cmDocumentation::SetSection(const char *name,
std::vector<cmDocumentationEntry> &docs)
{
- cmDocumentationSection *sec =
- new cmDocumentationSection(name,
+ cmDocumentationSection *sec =
+ new cmDocumentationSection(name,
cmSystemTools::UpperCase(name).c_str());
sec->Append(docs);
this->SetSection(name,sec);
}
//----------------------------------------------------------------------------
-void cmDocumentation::SetSection(const char *name,
+void cmDocumentation::SetSection(const char *name,
const char *docs[][3])
{
- cmDocumentationSection *sec =
- new cmDocumentationSection(name,
+ cmDocumentationSection *sec =
+ new cmDocumentationSection(name,
cmSystemTools::UpperCase(name).c_str());
sec->Append(docs);
this->SetSection(name,sec);
@@ -965,15 +966,15 @@ void cmDocumentation::SetSection(const char *name,
void cmDocumentation
::SetSections(std::map<std::string,cmDocumentationSection *> &sections)
{
- for (std::map<std::string,cmDocumentationSection *>::const_iterator
+ for (std::map<std::string,cmDocumentationSection *>::const_iterator
it = sections.begin(); it != sections.end(); ++it)
{
this->SetSection(it->first.c_str(),it->second);
- }
+ }
}
//----------------------------------------------------------------------------
-void cmDocumentation::PrependSection(const char *name,
+void cmDocumentation::PrependSection(const char *name,
const char *docs[][3])
{
cmDocumentationSection *sec = 0;
@@ -991,7 +992,7 @@ void cmDocumentation::PrependSection(const char *name,
}
//----------------------------------------------------------------------------
-void cmDocumentation::PrependSection(const char *name,
+void cmDocumentation::PrependSection(const char *name,
std::vector<cmDocumentationEntry> &docs)
{
cmDocumentationSection *sec = 0;
@@ -1009,7 +1010,7 @@ void cmDocumentation::PrependSection(const char *name,
}
//----------------------------------------------------------------------------
-void cmDocumentation::AppendSection(const char *name,
+void cmDocumentation::AppendSection(const char *name,
const char *docs[][3])
{
cmDocumentationSection *sec = 0;
@@ -1027,7 +1028,7 @@ void cmDocumentation::AppendSection(const char *name,
}
//----------------------------------------------------------------------------
-void cmDocumentation::AppendSection(const char *name,
+void cmDocumentation::AppendSection(const char *name,
std::vector<cmDocumentationEntry> &docs)
{
cmDocumentationSection *sec = 0;
@@ -1045,7 +1046,7 @@ void cmDocumentation::AppendSection(const char *name,
}
//----------------------------------------------------------------------------
-void cmDocumentation::AppendSection(const char *name,
+void cmDocumentation::AppendSection(const char *name,
cmDocumentationEntry &docs)
{
@@ -1055,7 +1056,7 @@ void cmDocumentation::AppendSection(const char *name,
}
//----------------------------------------------------------------------------
-void cmDocumentation::PrependSection(const char *name,
+void cmDocumentation::PrependSection(const char *name,
cmDocumentationEntry &docs)
{
@@ -1067,7 +1068,7 @@ void cmDocumentation::PrependSection(const char *name,
//----------------------------------------------------------------------------
void cmDocumentation::SetSeeAlsoList(const char *data[][3])
{
- cmDocumentationSection *sec =
+ cmDocumentationSection *sec =
new cmDocumentationSection("See Also", "SEE ALSO");
this->AllSections["See Also"] = sec;
this->SeeAlsoString = ".B ";
@@ -1075,7 +1076,7 @@ void cmDocumentation::SetSeeAlsoList(const char *data[][3])
while(data[i][1])
{
this->SeeAlsoString += data[i][1];
- this->SeeAlsoString += data[i+1][1]? "(1), ":"(1)";
+ this->SeeAlsoString += data[i+1][1]? "(1), ":"(1)";
++i;
}
sec->Append(0,this->SeeAlsoString.c_str(),0);
@@ -1096,9 +1097,9 @@ bool cmDocumentation::PrintDocumentationGeneric(std::ostream& os,
os << "Required argument missing.\n";
return false;
}
- const std::vector<cmDocumentationEntry> &entries =
+ const std::vector<cmDocumentationEntry> &entries =
this->AllSections[section]->GetEntries();
- for(std::vector<cmDocumentationEntry>::const_iterator ei =
+ for(std::vector<cmDocumentationEntry>::const_iterator ei =
entries.begin();
ei != entries.end(); ++ei)
{
@@ -1138,7 +1139,7 @@ bool cmDocumentation::PrintDocumentationSingleModule(std::ostream& os)
os << "Argument --help-module needs a module name.\n";
return false;
}
-
+
std::string moduleName;
// find the module
std::vector<std::string> dirs;
@@ -1172,10 +1173,10 @@ bool cmDocumentation::PrintDocumentationSingleModule(std::ostream& os)
if(!moduleName.empty())
{
- cmDocumentationSection *sec =
+ cmDocumentationSection *sec =
new cmDocumentationSection("Standard CMake Modules", "MODULES");
this->AllSections["Modules"] = sec;
- if (this->CreateSingleModule(moduleName.c_str(),
+ if (this->CreateSingleModule(moduleName.c_str(),
this->CurrentArgument.c_str(),
*this->AllSections["Modules"]))
{
@@ -1204,7 +1205,7 @@ bool cmDocumentation::PrintDocumentationSingleModule(std::ostream& os)
bool cmDocumentation::PrintDocumentationSingleProperty(std::ostream& os)
{
bool done = false;
- for (std::vector<std::string>::iterator i =
+ for (std::vector<std::string>::iterator i =
this->PropertySections.begin();
!done && i != this->PropertySections.end(); ++i)
{
@@ -1241,7 +1242,7 @@ bool cmDocumentation::PrintDocumentationSinglePolicy(std::ostream& os)
bool cmDocumentation::PrintDocumentationSingleVariable(std::ostream& os)
{
bool done = false;
- for (std::vector<std::string>::iterator i =
+ for (std::vector<std::string>::iterator i =
this->VariableSections.begin();
!done && i != this->VariableSections.end(); ++i)
{
@@ -1270,9 +1271,9 @@ bool cmDocumentation::PrintDocumentationList(std::ostream& os,
return false;
}
- const std::vector<cmDocumentationEntry> &entries =
+ const std::vector<cmDocumentationEntry> &entries =
this->AllSections[section]->GetEntries();
- for(std::vector<cmDocumentationEntry>::const_iterator ei =
+ for(std::vector<cmDocumentationEntry>::const_iterator ei =
entries.begin();
ei != entries.end(); ++ei)
{
@@ -1364,7 +1365,7 @@ bool cmDocumentation::PrintDocumentationProperties(std::ostream& os)
this->ClearSections();
this->AddDocumentIntroToPrint(GET_DOCUMENT_INTRO(Properties));
this->AddSectionToPrint("Properties Description");
- for (std::vector<std::string>::iterator i =
+ for (std::vector<std::string>::iterator i =
this->PropertySections.begin();
i != this->PropertySections.end(); ++i)
{
@@ -1383,7 +1384,7 @@ bool cmDocumentation::PrintDocumentationVariables(std::ostream& os)
{
this->ClearSections();
this->AddDocumentIntroToPrint(GET_DOCUMENT_INTRO(Variables));
- for (std::vector<std::string>::iterator i =
+ for (std::vector<std::string>::iterator i =
this->VariableSections.begin();
i != this->VariableSections.end(); ++i)
{
@@ -1464,10 +1465,10 @@ void cmDocumentation::CreateFullDocumentation()
this->AddSectionToPrint("Commands");
emitted.insert("Commands");
-
+
this->AddSectionToPrint("Properties Description");
emitted.insert("Properties Description");
- for (std::vector<std::string>::iterator i =
+ for (std::vector<std::string>::iterator i =
this->PropertySections.begin();
i != this->PropertySections.end(); ++i)
{
@@ -1481,7 +1482,7 @@ void cmDocumentation::CreateFullDocumentation()
emitted.insert("Author");
// add any sections not yet written out, or to be written out
- for (std::map<std::string, cmDocumentationSection*>::iterator i =
+ for (std::map<std::string, cmDocumentationSection*>::iterator i =
this->AllSections.begin();
i != this->AllSections.end(); ++i)
{
@@ -1579,6 +1580,6 @@ const char* cmDocumentation::GetDefaultDocName(Type ht) const
//----------------------------------------------------------------------------
bool cmDocumentation::IsOption(const char* arg) const
{
- return ((arg[0] == '-') || (strcmp(arg, "/V") == 0) ||
+ return ((arg[0] == '-') || (strcmp(arg, "/V") == 0) ||
(strcmp(arg, "/?") == 0));
}
diff --git a/Source/cmDocumentationFormatter.h b/Source/cmDocumentationFormatter.h
index f8cdc96..665b9b6 100644
--- a/Source/cmDocumentationFormatter.h
+++ b/Source/cmDocumentationFormatter.h
@@ -16,7 +16,7 @@
/** This is just a helper class to make it build with MSVC 6.0.
Actually the enums and internal classes could directly go into
-cmDocumentation, but then MSVC6 complains in RequestedHelpItem that
+cmDocumentation, but then MSVC6 complains in RequestedHelpItem that
cmDocumentation is an undefined type and so it doesn't know the enums.
Moving the enums to a class which is then already completely parsed helps
against this. */
@@ -24,10 +24,10 @@ class cmDocumentationEnums
{
public:
/** Types of help provided. */
- enum Type
+ enum Type
{ None, Usage, Single, SingleModule, SingleProperty, SingleVariable,
List, ModuleList, PropertyList, VariableList,
- Full, Properties, Variables, Modules, CustomModules, Commands,
+ Full, Properties, Variables, Modules, CustomModules, Commands,
CompatCommands, Copyright, Version, Policies, SinglePolicy };
/** Forms of documentation output. */
@@ -36,7 +36,7 @@ public:
class cmDocumentationSection;
-/** Base class for printing the documentation in the various supported
+/** Base class for printing the documentation in the various supported
formats. */
class cmDocumentationFormatter
{
@@ -46,7 +46,7 @@ public:
void PrintFormatted(std::ostream& os, const char* text);
virtual cmDocumentationEnums::Form GetForm() const = 0;
-
+
virtual void PrintHeader(const char* /*docname*/,
const char* /*appname*/,
std::ostream& /*os*/) {}
@@ -60,7 +60,7 @@ public:
std::vector<const cmDocumentationSection *>&)
{}
- /** Compute a prefix for links into a section (#<prefix>_SOMETHING). */
+ /** Compute a prefix for links into a section (#\<prefix\>_SOMETHING). */
std::string ComputeSectionLinkPrefix(std::string const& name);
};
diff --git a/Source/cmExprLexer.cxx b/Source/cmExprLexer.cxx
index a642f55..53dfca7 100644
--- a/Source/cmExprLexer.cxx
+++ b/Source/cmExprLexer.cxx
@@ -44,7 +44,7 @@ typedef uint32_t flex_uint32_t;
typedef signed char flex_int8_t;
typedef short int flex_int16_t;
typedef int flex_int32_t;
-typedef unsigned char flex_uint8_t;
+typedef unsigned char flex_uint8_t;
typedef unsigned short int flex_uint16_t;
typedef unsigned int flex_uint32_t;
#endif /* ! C99 */
@@ -165,7 +165,7 @@ typedef struct yy_buffer_state *YY_BUFFER_STATE;
#define EOB_ACT_LAST_MATCH 2
#define YY_LESS_LINENO(n)
-
+
/* Return all but the first "n" matched characters back to the input
stream. */
#define yyless(n) \
@@ -231,7 +231,7 @@ struct yy_buffer_state
int yy_bs_lineno; /**< The line count. */
int yy_bs_column; /**< The column count. */
-
+
/* Whether to try to fill the input buffer when we reach the
* end of it.
*/
@@ -787,7 +787,7 @@ do_action: /* This label is used only to access EOF actions. */
case 1:
YY_RULE_SETUP
#line 88 "/home/andy/vtk/CMake/Source/cmExprLexer.in.l"
-{ yylvalp->Number = atoi(yytext); return exp_NUMBER; }
+{ yylvalp->Number = atoi(yytext); return exp_NUMBER; }
case 2:
YY_RULE_SETUP
#line 90 "/home/andy/vtk/CMake/Source/cmExprLexer.in.l"
@@ -795,43 +795,43 @@ YY_RULE_SETUP
case 3:
YY_RULE_SETUP
#line 91 "/home/andy/vtk/CMake/Source/cmExprLexer.in.l"
-{ return exp_MINUS; }
+{ return exp_MINUS; }
case 4:
YY_RULE_SETUP
#line 92 "/home/andy/vtk/CMake/Source/cmExprLexer.in.l"
-{ return exp_TIMES; }
+{ return exp_TIMES; }
case 5:
YY_RULE_SETUP
#line 93 "/home/andy/vtk/CMake/Source/cmExprLexer.in.l"
-{ return exp_DIVIDE; }
+{ return exp_DIVIDE; }
case 6:
YY_RULE_SETUP
#line 94 "/home/andy/vtk/CMake/Source/cmExprLexer.in.l"
-{ return exp_MOD; }
+{ return exp_MOD; }
case 7:
YY_RULE_SETUP
#line 95 "/home/andy/vtk/CMake/Source/cmExprLexer.in.l"
-{ return exp_OR; }
+{ return exp_OR; }
case 8:
YY_RULE_SETUP
#line 96 "/home/andy/vtk/CMake/Source/cmExprLexer.in.l"
-{ return exp_AND; }
+{ return exp_AND; }
case 9:
YY_RULE_SETUP
#line 97 "/home/andy/vtk/CMake/Source/cmExprLexer.in.l"
-{ return exp_XOR; }
+{ return exp_XOR; }
case 10:
YY_RULE_SETUP
#line 98 "/home/andy/vtk/CMake/Source/cmExprLexer.in.l"
-{ return exp_NOT; }
+{ return exp_NOT; }
case 11:
YY_RULE_SETUP
#line 99 "/home/andy/vtk/CMake/Source/cmExprLexer.in.l"
-{ return exp_SHIFTLEFT; }
+{ return exp_SHIFTLEFT; }
case 12:
YY_RULE_SETUP
#line 100 "/home/andy/vtk/CMake/Source/cmExprLexer.in.l"
-{ return exp_SHIFTRIGHT; }
+{ return exp_SHIFTRIGHT; }
case 13:
YY_RULE_SETUP
#line 101 "/home/andy/vtk/CMake/Source/cmExprLexer.in.l"
@@ -1319,7 +1319,7 @@ static void cmExpr_yy_load_buffer_state (yyscan_t yyscanner)
YY_BUFFER_STATE cmExpr_yy_create_buffer (FILE * file, int size , yyscan_t yyscanner)
{
YY_BUFFER_STATE b;
-
+
b = (YY_BUFFER_STATE) cmExpr_yyalloc(sizeof( struct yy_buffer_state ) ,yyscanner );
if ( ! b )
YY_FATAL_ERROR( "out of dynamic memory in cmExpr_yy_create_buffer()" );
@@ -1363,7 +1363,7 @@ static void cmExpr_yy_load_buffer_state (yyscan_t yyscanner)
#ifndef __cplusplus
extern int isatty (int );
#endif /* __cplusplus */
-
+
/* Initializes or reinitializes a buffer.
* This function is sometimes called more than once on the same buffer,
* such as during a cmExpr_yyrestart() or at EOF.
@@ -1389,7 +1389,7 @@ extern int isatty (int );
}
b->yy_is_interactive = file ? (isatty( fileno(file) ) > 0) : 0;
-
+
errno = oerrno;
}
@@ -1493,9 +1493,9 @@ static void cmExpr_yyensure_buffer_stack (yyscan_t yyscanner)
yyg->yy_buffer_stack = (struct yy_buffer_state**)cmExpr_yyalloc
(nuto_alloc * sizeof(struct yy_buffer_state*)
, yyscanner);
-
+
memset(yyg->yy_buffer_stack, 0, nuto_alloc * sizeof(struct yy_buffer_state*));
-
+
yyg->yy_buffer_stack_max = nuto_alloc;
yyg->yy_buffer_stack_top = 0;
return;
@@ -1522,12 +1522,12 @@ static void cmExpr_yyensure_buffer_stack (yyscan_t yyscanner)
* @param base the character buffer
* @param size the size in bytes of the character buffer
* @param yyscanner The scanner object.
- * @return the newly allocated buffer state object.
+ * @return the newly allocated buffer state object.
*/
YY_BUFFER_STATE cmExpr_yy_scan_buffer (char * base, yy_size_t size , yyscan_t yyscanner)
{
YY_BUFFER_STATE b;
-
+
if ( size < 2 ||
base[size-2] != YY_END_OF_BUFFER_CHAR ||
base[size-1] != YY_END_OF_BUFFER_CHAR )
@@ -1554,8 +1554,7 @@ YY_BUFFER_STATE cmExpr_yy_scan_buffer (char * base, yy_size_t size , yyscan_t
}
/** Setup the input buffer state to scan a string. The next call to cmExpr_yylex() will
- * scan from a @e copy of @a str.
- * @param str a NUL-terminated string to scan
+ * scan from a @e copy of @a yy_str.
* @param yy_str a NUL-terminated string to scan
* @param yyscanner The scanner object.
* @return the newly allocated buffer state object.
@@ -1564,7 +1563,7 @@ YY_BUFFER_STATE cmExpr_yy_scan_buffer (char * base, yy_size_t size , yyscan_t
*/
YY_BUFFER_STATE cmExpr_yy_scan_string (yyconst char * yy_str , yyscan_t yyscanner)
{
-
+
return cmExpr_yy_scan_bytes(yy_str,strlen(yy_str) ,yyscanner);
}
@@ -1581,7 +1580,7 @@ YY_BUFFER_STATE cmExpr_yy_scan_bytes (yyconst char * bytes, int len , yyscan_t
char *buf;
yy_size_t n;
int i;
-
+
/* Get memory for full buffer, including space for trailing EOB's. */
n = len + 2;
buf = (char *) cmExpr_yyalloc(n ,yyscanner );
@@ -1649,10 +1648,10 @@ YY_EXTRA_TYPE cmExpr_yyget_extra (yyscan_t yyscanner)
int cmExpr_yyget_lineno (yyscan_t yyscanner)
{
struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
-
+
if (! YY_CURRENT_BUFFER)
return 0;
-
+
return yylineno;
}
@@ -1662,10 +1661,10 @@ int cmExpr_yyget_lineno (yyscan_t yyscanner)
int cmExpr_yyget_column (yyscan_t yyscanner)
{
struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
-
+
if (! YY_CURRENT_BUFFER)
return 0;
-
+
return yycolumn;
}
@@ -1726,13 +1725,13 @@ void cmExpr_yyset_lineno (int line_number , yyscan_t yyscanner)
/* lineno is only valid if an input buffer exists. */
if (! YY_CURRENT_BUFFER )
- yy_fatal_error( "cmExpr_yyset_lineno called with no buffer" , yyscanner);
-
+ yy_fatal_error( "cmExpr_yyset_lineno called with no buffer" , yyscanner);
+
yylineno = line_number;
}
/** Set the current column.
- * @param line_number
+ * @param column_no
* @param yyscanner The scanner object.
*/
void cmExpr_yyset_column (int column_no , yyscan_t yyscanner)
@@ -1741,8 +1740,8 @@ void cmExpr_yyset_column (int column_no , yyscan_t yyscanner)
/* column is only valid if an input buffer exists. */
if (! YY_CURRENT_BUFFER )
- yy_fatal_error( "cmExpr_yyset_column called with no buffer" , yyscanner);
-
+ yy_fatal_error( "cmExpr_yyset_column called with no buffer" , yyscanner);
+
yycolumn = column_no;
}
diff --git a/Source/cmExtraCodeBlocksGenerator.cxx b/Source/cmExtraCodeBlocksGenerator.cxx
index 4f93067..38002ec 100644
--- a/Source/cmExtraCodeBlocksGenerator.cxx
+++ b/Source/cmExtraCodeBlocksGenerator.cxx
@@ -19,6 +19,7 @@
#include "cmGeneratedFileStream.h"
#include "cmTarget.h"
#include "cmSystemTools.h"
+#include "cmXMLSafe.h"
#include <cmsys/SystemTools.hxx>
@@ -266,10 +267,17 @@ void cmExtraCodeBlocksGenerator
}
// Convert
+ const char* cmakeRoot = mf->GetDefinition("CMAKE_ROOT");
for (std::vector<std::string>::const_iterator jt = listFiles.begin();
jt != listFiles.end();
++jt)
{
+ // don't put cmake's own files into the project (#12110):
+ if (jt->find(cmakeRoot) == 0)
+ {
+ continue;
+ }
+
const std::string &relative = cmSystemTools::RelativePath(
it->second[0]->GetMakefile()->GetHomeDirectory(),
jt->c_str());
@@ -573,15 +581,70 @@ void cmExtraCodeBlocksGenerator::AppendTarget(cmGeneratedFileStream& fout,
" <Option type=\"" << cbTargetType << "\" />\n"
" <Option compiler=\"" << compiler << "\" />\n"
" <Compiler>\n";
+
+ // the compilerdefines for this target
+ const char* cdefs = target->GetMakefile()->GetProperty(
+ "COMPILE_DEFINITIONS");
+ if(cdefs)
+ {
+ // Expand the list.
+ std::vector<std::string> defs;
+ cmSystemTools::ExpandListArgument(cdefs, defs);
+ for(std::vector<std::string>::const_iterator di = defs.begin();
+ di != defs.end(); ++di)
+ {
+ cmXMLSafe safedef(di->c_str());
+ fout <<" <Add option=\"-D" << safedef.str() << "\" />\n";
+ }
+ }
+
// the include directories for this target
+ std::set<std::string> uniqIncludeDirs;
const std::vector<std::string>& incDirs =
target->GetMakefile()->GetIncludeDirectories();
for(std::vector<std::string>::const_iterator dirIt=incDirs.begin();
dirIt != incDirs.end();
++dirIt)
{
+ uniqIncludeDirs.insert(*dirIt);
+ }
+
+
+ std::string systemIncludeDirs = makefile->GetSafeDefinition(
+ "CMAKE_EXTRA_GENERATOR_C_SYSTEM_INCLUDE_DIRS");
+ if (!systemIncludeDirs.empty())
+ {
+ std::vector<std::string> dirs;
+ cmSystemTools::ExpandListArgument(systemIncludeDirs.c_str(), dirs);
+ for(std::vector<std::string>::const_iterator dirIt=dirs.begin();
+ dirIt != dirs.end();
+ ++dirIt)
+ {
+ uniqIncludeDirs.insert(*dirIt);
+ }
+ }
+
+ systemIncludeDirs = makefile->GetSafeDefinition(
+ "CMAKE_EXTRA_GENERATOR_CXX_SYSTEM_INCLUDE_DIRS");
+ if (!systemIncludeDirs.empty())
+ {
+ std::vector<std::string> dirs;
+ cmSystemTools::ExpandListArgument(systemIncludeDirs.c_str(), dirs);
+ for(std::vector<std::string>::const_iterator dirIt=dirs.begin();
+ dirIt != dirs.end();
+ ++dirIt)
+ {
+ uniqIncludeDirs.insert(*dirIt);
+ }
+ }
+
+ for(std::set<std::string>::const_iterator dirIt=uniqIncludeDirs.begin();
+ dirIt != uniqIncludeDirs.end();
+ ++dirIt)
+ {
fout <<" <Add directory=\"" << dirIt->c_str() << "\" />\n";
}
+
fout<<" </Compiler>\n";
}
else // e.g. all and the GLOBAL and UTILITY targets
diff --git a/Source/cmExtraEclipseCDT4Generator.cxx b/Source/cmExtraEclipseCDT4Generator.cxx
index 8e26b8e..248a30a 100644
--- a/Source/cmExtraEclipseCDT4Generator.cxx
+++ b/Source/cmExtraEclipseCDT4Generator.cxx
@@ -17,6 +17,7 @@
#include "cmMakefile.h"
#include "cmGeneratedFileStream.h"
#include "cmTarget.h"
+#include "cmSourceFile.h"
#include "cmSystemTools.h"
#include <stdlib.h>
@@ -34,6 +35,8 @@ cmExtraEclipseCDT4Generator
// this->SupportedGlobalGenerators.push_back("MSYS Makefiles");
#endif
this->SupportedGlobalGenerators.push_back("Unix Makefiles");
+
+ this->SupportsVirtualFolders = true;
}
//----------------------------------------------------------------------------
@@ -57,6 +60,24 @@ void cmExtraEclipseCDT4Generator::Generate()
const cmMakefile* mf
= this->GlobalGenerator->GetLocalGenerators()[0]->GetMakefile();
+ std::string eclipseVersion = mf->GetSafeDefinition("CMAKE_ECLIPSE_VERSION");
+ cmsys::RegularExpression regex(".*([0-9]+\\.[0-9]+).*");
+ if (regex.find(eclipseVersion.c_str()))
+ {
+ unsigned int majorVersion = 0;
+ unsigned int minorVersion = 0;
+ int res=sscanf(regex.match(1).c_str(), "%u.%u", &majorVersion,
+ &minorVersion);
+ if (res == 2)
+ {
+ int version = majorVersion * 1000 + minorVersion;
+ if (version < 3006) // 3.6 is Helios
+ {
+ this->SupportsVirtualFolders = false;
+ }
+ }
+ }
+
// TODO: Decide if these are local or member variables
this->HomeDirectory = mf->GetHomeDirectory();
this->HomeOutputDirectory = mf->GetHomeOutputDirectory();
@@ -66,6 +87,16 @@ void cmExtraEclipseCDT4Generator::Generate()
this->GenerateSourceProject = (this->IsOutOfSourceBuild &&
mf->IsOn("ECLIPSE_CDT4_GENERATE_SOURCE_PROJECT"));
+ if (cmSystemTools::IsSubDirectory(this->HomeOutputDirectory.c_str(),
+ this->HomeDirectory.c_str()))
+ {
+ mf->IssueMessage(cmake::WARNING, "The build directory is a subdirectory "
+ "of the source directory.\n"
+ "This is not supported well by Eclipse. It is strongly "
+ "recommended to use a build directory which is a "
+ "sibling of the source directory.");
+ }
+
// NOTE: This is not good, since it pollutes the source tree. However,
// Eclipse doesn't allow CVS/SVN to work when the .project is not in
// the cvs/svn root directory. Hence, this is provided as an option.
@@ -394,16 +425,128 @@ void cmExtraEclipseCDT4Generator::CreateProjectFile()
linkSourceDirectory.c_str()))
{
this->AppendLinkedResource(fout, sourceLinkedResourceName,
- this->GetEclipsePath(linkSourceDirectory));
+ this->GetEclipsePath(linkSourceDirectory),
+ LinkToFolder);
this->SrcLinkedResources.push_back(sourceLinkedResourceName);
}
}
+ if (this->SupportsVirtualFolders)
+ {
+ this->CreateLinksToSubprojects(fout);
+
+ this->CreateLinksForTargets(fout);
+ }
+
+ // I'm not sure this makes too much sense. There can be different
+ // output directories in different subdirs, so we would need more of them.
+
+ // for EXECUTABLE_OUTPUT_PATH when not in binary dir
+ this->AppendOutLinkedResource(fout,
+ mf->GetSafeDefinition("CMAKE_RUNTIME_OUTPUT_DIRECTORY"),
+ mf->GetSafeDefinition("EXECUTABLE_OUTPUT_PATH"));
+ // for LIBRARY_OUTPUT_PATH when not in binary dir
+ this->AppendOutLinkedResource(fout,
+ mf->GetSafeDefinition("CMAKE_LIBRARY_OUTPUT_DIRECTORY"),
+ mf->GetSafeDefinition("LIBRARY_OUTPUT_PATH"));
+
+ fout << "\t</linkedResources>\n";
+
+ fout << "</projectDescription>\n";
+}
+
+
+//----------------------------------------------------------------------------
+void cmExtraEclipseCDT4Generator::CreateLinksForTargets(
+ cmGeneratedFileStream& fout)
+{
+ std::string linkName = "[Targets]";
+ this->AppendLinkedResource(fout, linkName, "virtual:/virtual",VirtualFolder);
+
+ for (std::vector<cmLocalGenerator*>::const_iterator
+ lgIt = this->GlobalGenerator->GetLocalGenerators().begin();
+ lgIt != this->GlobalGenerator->GetLocalGenerators().end();
+ ++lgIt)
+ {
+ cmMakefile* makefile = (*lgIt)->GetMakefile();
+ const cmTargets& targets = makefile->GetTargets();
+
+ for(cmTargets::const_iterator ti=targets.begin(); ti!=targets.end();++ti)
+ {
+ std::string linkName2 = linkName;
+ linkName2 += "/";
+ switch(ti->second.GetType())
+ {
+ case cmTarget::EXECUTABLE:
+ case cmTarget::STATIC_LIBRARY:
+ case cmTarget::SHARED_LIBRARY:
+ case cmTarget::MODULE_LIBRARY:
+ {
+ const char* prefix = (ti->second.GetType()==cmTarget::EXECUTABLE ?
+ "[exe] " : "[lib] ");
+ linkName2 += prefix;
+ linkName2 += ti->first;
+ this->AppendLinkedResource(fout, linkName2, "virtual:/virtual",
+ VirtualFolder);
+ std::vector<cmSourceGroup> sourceGroups=makefile->GetSourceGroups();
+ // get the files from the source lists then add them to the groups
+ cmTarget* tgt = const_cast<cmTarget*>(&ti->second);
+ std::vector<cmSourceFile*>const & files = tgt->GetSourceFiles();
+ for(std::vector<cmSourceFile*>::const_iterator sfIt = files.begin();
+ sfIt != files.end();
+ sfIt++)
+ {
+ // Add the file to the list of sources.
+ std::string source = (*sfIt)->GetFullPath();
+ cmSourceGroup& sourceGroup =
+ makefile->FindSourceGroup(source.c_str(), sourceGroups);
+ sourceGroup.AssignSource(*sfIt);
+ }
+
+ for(std::vector<cmSourceGroup>::iterator sgIt = sourceGroups.begin();
+ sgIt != sourceGroups.end();
+ ++sgIt)
+ {
+ std::string linkName3 = linkName2;
+ linkName3 += "/";
+ linkName3 += sgIt->GetFullName();
+ this->AppendLinkedResource(fout, linkName3, "virtual:/virtual",
+ VirtualFolder);
+
+ std::vector<const cmSourceFile*> sFiles = sgIt->GetSourceFiles();
+ for(std::vector<const cmSourceFile*>::const_iterator fileIt =
+ sFiles.begin();
+ fileIt != sFiles.end();
+ ++fileIt)
+ {
+ std::string linkName4 = linkName3;
+ linkName4 += "/";
+ linkName4 +=
+ cmSystemTools::GetFilenameName((*fileIt)->GetFullPath());
+ this->AppendLinkedResource(fout, linkName4,
+ (*fileIt)->GetFullPath(), LinkToFile);
+ }
+ }
+ }
+ break;
+ // ignore all others:
+ default:
+ break;
+ }
+ }
+ }
+}
+
+
+//----------------------------------------------------------------------------
+void cmExtraEclipseCDT4Generator::CreateLinksToSubprojects(
+ cmGeneratedFileStream& fout)
+{
// for each sub project create a linked resource to the source dir
// - only if it is an out-of-source build
this->AppendLinkedResource(fout, "[Subprojects]",
- "virtual:/virtual", true);
+ "virtual:/virtual", VirtualFolder);
for (std::map<cmStdString, std::vector<cmLocalGenerator*> >::const_iterator
it = this->GlobalGenerator->GetProjectMap().begin();
@@ -421,28 +564,15 @@ void cmExtraEclipseCDT4Generator::CreateProjectFile()
std::string linkName = "[Subprojects]/";
linkName += it->first;
this->AppendLinkedResource(fout, linkName,
- this->GetEclipsePath(linkSourceDirectory));
+ this->GetEclipsePath(linkSourceDirectory),
+ LinkToFolder
+ );
this->SrcLinkedResources.push_back(it->first);
}
}
-
- // I'm not sure this makes too much sense. There can be different
- // output directories in different subdirs, so we would need more of them.
-
- // for EXECUTABLE_OUTPUT_PATH when not in binary dir
- this->AppendOutLinkedResource(fout,
- mf->GetSafeDefinition("CMAKE_RUNTIME_OUTPUT_DIRECTORY"),
- mf->GetSafeDefinition("EXECUTABLE_OUTPUT_PATH"));
- // for LIBRARY_OUTPUT_PATH when not in binary dir
- this->AppendOutLinkedResource(fout,
- mf->GetSafeDefinition("CMAKE_LIBRARY_OUTPUT_DIRECTORY"),
- mf->GetSafeDefinition("LIBRARY_OUTPUT_PATH"));
-
- fout << "\t</linkedResources>\n";
-
- fout << "</projectDescription>\n";
}
+
//----------------------------------------------------------------------------
void cmExtraEclipseCDT4Generator::AppendIncludeDirectories(
cmGeneratedFileStream& fout,
@@ -575,6 +705,18 @@ void cmExtraEclipseCDT4Generator::CreateCProjectFile() const
// - make it type 'src'
// - and exclude it from type 'out'
std::string excludeFromOut;
+/* I don't know what the pathentry kind="src" are good for, e.g. autocompletion
+ * works also without them. Done wrong, the indexer complains, see #12417
+ * and #12213.
+ * The CDT documentation is very terse on that:
+ * "CDT_SOURCE: Entry kind constant describing a path entry identifying a
+ * folder containing source code to be compiled."
+ * Also on the cdt-dev list didn't bring any information:
+ * http://web.archiveorange.com/archive/v/B4NlJDNIpYoOS1SbxFNy
+ * So I'm disabling them for now, hoping that somebody will report if something
+ * is not workging anymore.
+ * Alex */
+#ifdef DO_CREATE_SRC_PATH_ENTRIES
for (std::vector<std::string>::const_iterator
it = this->SrcLinkedResources.begin();
it != this->SrcLinkedResources.end();
@@ -591,6 +733,7 @@ void cmExtraEclipseCDT4Generator::CreateCProjectFile() const
excludeFromOut += this->EscapeForXML(*it) + "/|";
}
}
+#endif
excludeFromOut += "**/CMakeFiles/";
fout << "<pathentry excluding=\"" << excludeFromOut
<< "\" kind=\"out\" path=\"\"/>\n";
@@ -654,7 +797,8 @@ void cmExtraEclipseCDT4Generator::CreateCProjectFile() const
}
}
// add system defined c macros
- const char* cDefs=mf->GetDefinition("CMAKE_ECLIPSE_C_SYSTEM_DEFINED_MACROS");
+ const char* cDefs=mf->GetDefinition(
+ "CMAKE_EXTRA_GENERATOR_C_SYSTEM_DEFINED_MACROS");
if(cDefs)
{
// Expand the list.
@@ -689,7 +833,7 @@ void cmExtraEclipseCDT4Generator::CreateCProjectFile() const
}
// add system defined c++ macros
const char* cxxDefs = mf->GetDefinition(
- "CMAKE_ECLIPSE_CXX_SYSTEM_DEFINED_MACROS");
+ "CMAKE_EXTRA_GENERATOR_CXX_SYSTEM_DEFINED_MACROS");
if(cxxDefs)
{
// Expand the list.
@@ -737,12 +881,11 @@ void cmExtraEclipseCDT4Generator::CreateCProjectFile() const
// now also the system include directories, in case we found them in
// CMakeSystemSpecificInformation.cmake. This makes Eclipse find the
// standard headers.
- mf->GetDefinition("CMAKE_ECLIPSE_C_SYSTEM_INCLUDE_DIRS");
std::string compiler = mf->GetSafeDefinition("CMAKE_C_COMPILER");
if (!compiler.empty())
{
std::string systemIncludeDirs = mf->GetSafeDefinition(
- "CMAKE_ECLIPSE_C_SYSTEM_INCLUDE_DIRS");
+ "CMAKE_EXTRA_GENERATOR_C_SYSTEM_INCLUDE_DIRS");
std::vector<std::string> dirs;
cmSystemTools::ExpandListArgument(systemIncludeDirs.c_str(), dirs);
this->AppendIncludeDirectories(fout, dirs, emmited);
@@ -751,7 +894,7 @@ void cmExtraEclipseCDT4Generator::CreateCProjectFile() const
if (!compiler.empty())
{
std::string systemIncludeDirs = mf->GetSafeDefinition(
- "CMAKE_ECLIPSE_CXX_SYSTEM_INCLUDE_DIRS");
+ "CMAKE_EXTRA_GENERATOR_CXX_SYSTEM_INCLUDE_DIRS");
std::vector<std::string> dirs;
cmSystemTools::ExpandListArgument(systemIncludeDirs.c_str(), dirs);
this->AppendIncludeDirectories(fout, dirs, emmited);
@@ -768,6 +911,8 @@ void cmExtraEclipseCDT4Generator::CreateCProjectFile() const
const std::string make = mf->GetRequiredDefinition("CMAKE_MAKE_PROGRAM");
const std::string makeArgs = mf->GetSafeDefinition(
"CMAKE_ECLIPSE_MAKE_ARGUMENTS");
+ const std::string cmake = mf->GetRequiredDefinition("CMAKE_COMMAND");
+
cmGlobalGenerator* generator
= const_cast<cmGlobalGenerator*>(this->GlobalGenerator);
@@ -856,6 +1001,29 @@ void cmExtraEclipseCDT4Generator::CreateCProjectFile() const
std::string fastTarget = ti->first;
fastTarget += "/fast";
this->AppendTarget(fout, fastTarget, make, makeArgs, subdir, prefix);
+
+ // Add Build and Clean targets in the virtual folder of targets:
+ if (this->SupportsVirtualFolders)
+ {
+ std::string virtDir = "[Targets]/";
+ virtDir += prefix;
+ virtDir += ti->first;
+ std::string buildArgs = "-C \"";
+ buildArgs += makefile->GetHomeOutputDirectory();
+ buildArgs += "\" ";
+ buildArgs += makeArgs;
+ this->AppendTarget(fout, "Build", make, buildArgs, virtDir, "",
+ ti->first.c_str());
+
+ std::string cleanArgs = "-E chdir \"";
+ cleanArgs += makefile->GetCurrentOutputDirectory();
+ cleanArgs += "\" \"";
+ cleanArgs += cmake;
+ cleanArgs += "\" -P \"";
+ cleanArgs += (*it)->GetTargetDirectory(ti->second);
+ cleanArgs += "/cmake_clean.cmake\"";
+ this->AppendTarget(fout, "Clean", cmake, cleanArgs, virtDir, "", "");
+ }
}
break;
// ignore these:
@@ -987,17 +1155,26 @@ void cmExtraEclipseCDT4Generator
// we need the "make" and the C (or C++) compiler which are used, Alex
std::string make = makefile.GetRequiredDefinition("CMAKE_MAKE_PROGRAM");
std::string compiler = makefile.GetSafeDefinition("CMAKE_C_COMPILER");
+ std::string arg1 = makefile.GetSafeDefinition("CMAKE_C_COMPILER_ARG1");
if (compiler.empty())
{
compiler = makefile.GetSafeDefinition("CMAKE_CXX_COMPILER");
+ arg1 = makefile.GetSafeDefinition("CMAKE_CXX_COMPILER_ARG1");
}
if (compiler.empty()) //Hmm, what to do now ?
{
compiler = "gcc";
}
-
// the following right now hardcodes gcc behaviour :-/
+ std::string compilerArgs =
+ "-E -P -v -dD ${plugin_state_location}/${specs_file}";
+ if (!arg1.empty())
+ {
+ arg1 += " ";
+ compilerArgs = arg1 + compilerArgs;
+ }
+
fout <<
"<storageModule moduleId=\"scannerConfiguration\">\n"
"<autodiscovery enabled=\"true\" problemReportingEnabled=\"true\""
@@ -1007,7 +1184,7 @@ void cmExtraEclipseCDT4Generator
cmExtraEclipseCDT4Generator::AppendScannerProfile(fout,
"org.eclipse.cdt.make.core.GCCStandardMakePerProjectProfile",
true, "", true, "specsFile",
- "-E -P -v -dD ${plugin_state_location}/${specs_file}",
+ compilerArgs,
compiler, true, true);
cmExtraEclipseCDT4Generator::AppendScannerProfile(fout,
"org.eclipse.cdt.make.core.GCCStandardMakePerFileProfile",
@@ -1031,9 +1208,17 @@ void cmExtraEclipseCDT4Generator::AppendTarget(cmGeneratedFileStream& fout,
const std::string& make,
const std::string& makeArgs,
const std::string& path,
- const char* prefix)
+ const char* prefix,
+ const char* makeTarget
+ )
{
std::string targetXml = cmExtraEclipseCDT4Generator::EscapeForXML(target);
+ std::string makeTargetXml = targetXml;
+ if (makeTarget != NULL)
+ {
+ makeTargetXml = cmExtraEclipseCDT4Generator::EscapeForXML(makeTarget);
+ }
+ cmExtraEclipseCDT4Generator::EscapeForXML(target);
std::string pathXml = cmExtraEclipseCDT4Generator::EscapeForXML(path);
fout <<
"<target name=\"" << prefix << targetXml << "\""
@@ -1043,7 +1228,7 @@ void cmExtraEclipseCDT4Generator::AppendTarget(cmGeneratedFileStream& fout,
<< cmExtraEclipseCDT4Generator::GetEclipsePath(make)
<< "</buildCommand>\n"
"<buildArguments>" << makeArgs << "</buildArguments>\n"
- "<buildTarget>" << targetXml << "</buildTarget>\n"
+ "<buildTarget>" << makeTargetXml << "</buildTarget>\n"
"<stopOnError>true</stopOnError>\n"
"<useDefaultCommand>false</useDefaultCommand>\n"
"</target>\n"
@@ -1083,20 +1268,25 @@ void cmExtraEclipseCDT4Generator
::AppendLinkedResource (cmGeneratedFileStream& fout,
const std::string& name,
const std::string& path,
- bool isVirtualFolder)
+ LinkType linkType)
{
const char* locationTag = "location";
- if (isVirtualFolder) // ... and not a linked folder
+ const char* typeTag = "2";
+ if (linkType == VirtualFolder) // ... and not a linked folder
{
locationTag = "locationURI";
}
+ if (linkType == LinkToFile)
+ {
+ typeTag = "1";
+ }
fout <<
"\t\t<link>\n"
"\t\t\t<name>"
<< cmExtraEclipseCDT4Generator::EscapeForXML(name)
<< "</name>\n"
- "\t\t\t<type>2</type>\n"
+ "\t\t\t<type>" << typeTag << "</type>\n"
"\t\t\t<" << locationTag << ">"
<< cmExtraEclipseCDT4Generator::EscapeForXML(path)
<< "</" << locationTag << ">\n"
@@ -1145,7 +1335,7 @@ bool cmExtraEclipseCDT4Generator
else
{
this->AppendLinkedResource(fout, name,
- this->GetEclipsePath(outputPath));
+ this->GetEclipsePath(outputPath), LinkToFolder);
this->OutLinkedResources.push_back(name);
return true;
}
diff --git a/Source/cmExtraEclipseCDT4Generator.h b/Source/cmExtraEclipseCDT4Generator.h
index a683731..61302e7 100644
--- a/Source/cmExtraEclipseCDT4Generator.h
+++ b/Source/cmExtraEclipseCDT4Generator.h
@@ -25,6 +25,8 @@ class cmGeneratedFileStream;
class cmExtraEclipseCDT4Generator : public cmExternalMakefileProjectGenerator
{
public:
+ enum LinkType {VirtualFolder, LinkToFolder, LinkToFile };
+
cmExtraEclipseCDT4Generator();
static cmExternalMakefileProjectGenerator* New() {
@@ -73,7 +75,8 @@ private:
const std::string& make,
const std::string& makeArguments,
const std::string& path,
- const char* prefix = "");
+ const char* prefix = "",
+ const char* makeTarget = NULL);
static void AppendScannerProfile (cmGeneratedFileStream& fout,
const std::string& profileID,
bool openActionEnabled,
@@ -88,7 +91,7 @@ private:
static void AppendLinkedResource (cmGeneratedFileStream& fout,
const std::string& name,
const std::string& path,
- bool isVirtualFolder = false);
+ LinkType linkType);
bool AppendOutLinkedResource(cmGeneratedFileStream& fout,
const std::string& defname,
@@ -101,12 +104,16 @@ private:
static void AddEnvVar(cmGeneratedFileStream& fout, const char* envVar,
cmMakefile* mf);
+ void CreateLinksToSubprojects(cmGeneratedFileStream& fout);
+ void CreateLinksForTargets(cmGeneratedFileStream& fout);
+
std::vector<std::string> SrcLinkedResources;
std::vector<std::string> OutLinkedResources;
std::string HomeDirectory;
std::string HomeOutputDirectory;
bool IsOutOfSourceBuild;
bool GenerateSourceProject;
+ bool SupportsVirtualFolders;
};
diff --git a/Source/cmFileCommand.cxx b/Source/cmFileCommand.cxx
index 9a3de9b..f933666 100644
--- a/Source/cmFileCommand.cxx
+++ b/Source/cmFileCommand.cxx
@@ -2753,6 +2753,10 @@ cmFileCommand::HandleDownloadCommand(std::vector<std::string> const& args)
::CURLcode res = ::curl_easy_setopt(curl, CURLOPT_URL, url.c_str());
check_curl_result(res, "DOWNLOAD cannot set url: ");
+ // enable HTTP ERROR parsing
+ res = ::curl_easy_setopt(curl, CURLOPT_FAILONERROR, 1);
+ check_curl_result(res, "DOWNLOAD cannot set http failure option: ");
+
res = ::curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION,
cmWriteToFileCallback);
check_curl_result(res, "DOWNLOAD cannot set write function: ");
@@ -2982,6 +2986,7 @@ cmFileCommand::HandleUploadCommand(std::vector<std::string> const& args)
std::string errStr = "UPLOAD cannot stat file '";
errStr += filename + "'.";
this->SetError(errStr.c_str());
+ fclose(fin);
return false;
}
@@ -2991,6 +2996,7 @@ cmFileCommand::HandleUploadCommand(std::vector<std::string> const& args)
if(!curl)
{
this->SetError("UPLOAD error initializing curl.");
+ fclose(fin);
return false;
}
diff --git a/Source/cmFindBase.cxx b/Source/cmFindBase.cxx
index ce9deb1..183da4a 100644
--- a/Source/cmFindBase.cxx
+++ b/Source/cmFindBase.cxx
@@ -299,11 +299,7 @@ bool cmFindBase::ParseArguments(std::vector<std::string> const& argsIn)
this->GetIgnoredPaths(ignored);
this->FilterPaths(this->SearchPaths, ignored);
- // Handle search root stuff.
- this->RerootPaths(this->SearchPaths);
-
- // Add a trailing slash to all prefixes to aid the search process.
- this->AddTrailingSlashes(this->SearchPaths);
+ this->ComputeFinalPaths();
return true;
}
diff --git a/Source/cmFindCommon.cxx b/Source/cmFindCommon.cxx
index a05e337..b44864e 100644
--- a/Source/cmFindCommon.cxx
+++ b/Source/cmFindCommon.cxx
@@ -471,8 +471,13 @@ void cmFindCommon::AddPathInternal(std::string const& in_path,
}
//----------------------------------------------------------------------------
-void cmFindCommon::AddTrailingSlashes(std::vector<std::string>& paths)
+void cmFindCommon::ComputeFinalPaths()
{
+ std::vector<std::string>& paths = this->SearchPaths;
+
+ // Expand list of paths inside all search roots.
+ this->RerootPaths(paths);
+
// Add a trailing slash to all paths to aid the search process.
for(std::vector<std::string>::iterator i = paths.begin();
i != paths.end(); ++i)
diff --git a/Source/cmFindCommon.h b/Source/cmFindCommon.h
index 875c223..542805f 100644
--- a/Source/cmFindCommon.h
+++ b/Source/cmFindCommon.h
@@ -47,8 +47,8 @@ protected:
void FilterPaths(std::vector<std::string>& paths,
const std::set<std::string>& ignore);
- /** Add trailing slashes to all search paths. */
- void AddTrailingSlashes(std::vector<std::string>& paths);
+ /** Compute final search path list (reroot + trailing slash). */
+ void ComputeFinalPaths();
/** Compute the current default root path mode. */
void SelectDefaultRootPathMode();
diff --git a/Source/cmFindPackageCommand.cxx b/Source/cmFindPackageCommand.cxx
index 5f106bc..7d3f09b 100644
--- a/Source/cmFindPackageCommand.cxx
+++ b/Source/cmFindPackageCommand.cxx
@@ -191,6 +191,9 @@ void cmFindPackageCommand::GenerateDocumentation()
"\"<config-file>-version.cmake\" or \"<config-file>Version.cmake\". "
"If no such version file is available then the configuration file "
"is assumed to not be compatible with any requested version. "
+ "A basic version file containing generic version matching code can be "
+ "created using the macro write_basic_config_version_file(), see its "
+ "documentation for more details. "
"When a version file is found it is loaded to check the requested "
"version number. "
"The version file is loaded in a nested scope in which the following "
@@ -335,6 +338,10 @@ void cmFindPackageCommand::GenerateDocumentation()
this->CommandDocumentation += this->GenericDocumentationPathsOrder;
this->CommandDocumentation +=
"\n"
+ "Every non-REQUIRED find_package() call can be disabled by setting the "
+ "variable CMAKE_DISABLE_FIND_PACKAGE_<package> to TRUE. See the "
+ "documentation for the CMAKE_DISABLE_FIND_PACKAGE_<package> variable for "
+ "more information.\n"
"See the cmake_policy() command documentation for discussion of the "
"NO_POLICY_SCOPE option."
;
@@ -607,6 +614,24 @@ bool cmFindPackageCommand
}
}
+ std::string disableFindPackageVar = "CMAKE_DISABLE_FIND_PACKAGE_";
+ disableFindPackageVar += this->Name;
+ if(this->Makefile->IsOn(disableFindPackageVar.c_str()))
+ {
+ if (this->Required)
+ {
+ cmOStringStream e;
+ e << "for module " << this->Name << " called with REQUIRED, but "
+ << disableFindPackageVar
+ << " is enabled. A REQUIRED package cannot be disabled.";
+ this->SetError(e.str().c_str());
+ return false;
+ }
+
+ return true;
+ }
+
+
this->SetModuleVariables(components);
// See if there is a Find<package>.cmake module.
@@ -1174,20 +1199,20 @@ void cmFindPackageCommand::AppendSuccessInformation()
if ((cmSystemTools::IsOn(result)) || (cmSystemTools::IsOn(upperResult)))
{
this->AppendToProperty("PACKAGES_FOUND");
- if (!this->Quiet)
- {
- this->AppendToProperty("ENABLED_FEATURES");
- }
}
else
{
this->AppendToProperty("PACKAGES_NOT_FOUND");
- if (!this->Quiet)
- {
- this->AppendToProperty("DISABLED_FEATURES");
- }
}
+ // Record whether the find was quiet or not, so this can be used
+ // e.g. in FeatureSummary.cmake
+ std::string quietInfoPropName = "_CMAKE_";
+ quietInfoPropName += this->Name;
+ quietInfoPropName += "_QUIET";
+ this->Makefile->GetCMakeInstance()->SetProperty(quietInfoPropName.c_str(),
+ this->Quiet ? "TRUE" : "FALSE");
+
// set a global property to record the required version of this package
std::string versionInfoPropName = "_CMAKE_";
versionInfoPropName += this->Name;
@@ -1218,7 +1243,7 @@ void cmFindPackageCommand::ComputePrefixes()
this->AddPrefixesCMakeSystemVariable();
this->AddPrefixesSystemRegistry();
this->AddPrefixesUserGuess();
- this->ComputeFinalPrefixes();
+ this->ComputeFinalPaths();
}
//----------------------------------------------------------------------------
@@ -1549,18 +1574,6 @@ void cmFindPackageCommand::AddPrefixesUserHints()
}
//----------------------------------------------------------------------------
-void cmFindPackageCommand::ComputeFinalPrefixes()
-{
- std::vector<std::string>& prefixes = this->SearchPaths;
-
- // Construct the final set of prefixes.
- this->RerootPaths(prefixes);
-
- // Add a trailing slash to all prefixes to aid the search process.
- this->AddTrailingSlashes(prefixes);
-}
-
-//----------------------------------------------------------------------------
bool cmFindPackageCommand::SearchDirectory(std::string const& dir)
{
assert(!dir.empty() && dir[dir.size()-1] == '/');
diff --git a/Source/cmFindPackageCommand.h b/Source/cmFindPackageCommand.h
index 2b2e1da..e736352 100644
--- a/Source/cmFindPackageCommand.h
+++ b/Source/cmFindPackageCommand.h
@@ -93,7 +93,6 @@ private:
void AddPrefixesCMakeSystemVariable();
void AddPrefixesUserGuess();
void AddPrefixesUserHints();
- void ComputeFinalPrefixes();
void LoadPackageRegistryDir(std::string const& dir);
void LoadPackageRegistryWinUser();
void LoadPackageRegistryWinSystem();
diff --git a/Source/cmGlobalGenerator.cxx b/Source/cmGlobalGenerator.cxx
index 6c8938e..124519a 100644
--- a/Source/cmGlobalGenerator.cxx
+++ b/Source/cmGlobalGenerator.cxx
@@ -18,6 +18,7 @@
#include "cmExternalMakefileProjectGenerator.h"
#include "cmake.h"
#include "cmMakefile.h"
+#include "cmQtAutomoc.h"
#include "cmSourceFile.h"
#include "cmVersion.h"
#include "cmExportInstallFileGenerator.h"
@@ -76,6 +77,79 @@ cmGlobalGenerator::~cmGlobalGenerator()
this->ClearExportSets();
}
+void cmGlobalGenerator::ResolveLanguageCompiler(const std::string &lang,
+ cmMakefile *mf,
+ bool optional) {
+ std::string langComp = "CMAKE_";
+ langComp += lang;
+ langComp += "_COMPILER";
+
+ if(!mf->GetDefinition(langComp.c_str()))
+ {
+ if(!optional)
+ {
+ cmSystemTools::Error(langComp.c_str(),
+ " not set, after EnableLanguage");
+ }
+ return;
+ }
+ const char* name = mf->GetRequiredDefinition(langComp.c_str());
+ std::string path;
+ if(!cmSystemTools::FileIsFullPath(name))
+ {
+ path = cmSystemTools::FindProgram(name);
+ }
+ else
+ {
+ path = name;
+ }
+ if((path.size() == 0 || !cmSystemTools::FileExists(path.c_str()))
+ && (optional==false))
+ {
+ std::string message = "your ";
+ message += lang;
+ message += " compiler: \"";
+ message += name;
+ message += "\" was not found. Please set ";
+ message += langComp;
+ message += " to a valid compiler path or name.";
+ cmSystemTools::Error(message.c_str());
+ path = name;
+ }
+ std::string doc = lang;
+ doc += " compiler.";
+ const char* cname = this->GetCMakeInstance()->
+ GetCacheManager()->GetCacheValue(langComp.c_str());
+ std::string changeVars;
+ if(cname && (path != cname) && (optional==false))
+ {
+ std::string cnameString = cname;
+ std::string pathString = path;
+ // get rid of potentially multiple slashes:
+ cmSystemTools::ConvertToUnixSlashes(cnameString);
+ cmSystemTools::ConvertToUnixSlashes(pathString);
+ if (cnameString != pathString)
+ {
+ const char* cvars =
+ this->GetCMakeInstance()->GetProperty(
+ "__CMAKE_DELETE_CACHE_CHANGE_VARS_");
+ if(cvars)
+ {
+ changeVars += cvars;
+ changeVars += ";";
+ }
+ changeVars += langComp;
+ changeVars += ";";
+ changeVars += cname;
+ this->GetCMakeInstance()->SetProperty(
+ "__CMAKE_DELETE_CACHE_CHANGE_VARS_",
+ changeVars.c_str());
+ }
+ }
+ mf->AddCacheDefinition(langComp.c_str(), path.c_str(),
+ doc.c_str(), cmCacheManager::FILEPATH);
+}
+
// Find the make program for the generator, required for try compiles
void cmGlobalGenerator::FindMakeProgram(cmMakefile* mf)
{
@@ -269,7 +343,7 @@ cmGlobalGenerator::EnableLanguage(std::vector<std::string>const& languages,
cmOStringStream windowsVersionString;
windowsVersionString << osvi.dwMajorVersion << "." << osvi.dwMinorVersion;
windowsVersionString.str();
- mf->AddDefinition("CMAKE_HOST_SYSTEM_VERSION",
+ mf->AddDefinition("CMAKE_HOST_SYSTEM_VERSION",
windowsVersionString.str().c_str());
#endif
// Read the DetermineSystem file
@@ -618,8 +692,8 @@ void cmGlobalGenerator::SetLanguageEnabledMaps(const char* l, cmMakefile* mf)
if (sscanf(linkerPref, "%d", &preference)!=1)
{
// backward compatibility: before 2.6 LINKER_PREFERENCE
- // was either "None" or "Prefered", and only the first character was
- // tested. So if there is a custom language out there and it is
+ // was either "None" or "Prefered", and only the first character was
+ // tested. So if there is a custom language out there and it is
// "Prefered", set its preference high
if (linkerPref[0]=='P')
{
@@ -782,7 +856,7 @@ void cmGlobalGenerator::Configure()
// so create the map from project name to vector of local generators
this->FillProjectMap();
- if ( !this->CMakeInstance->GetScriptMode() )
+ if ( this->CMakeInstance->GetWorkingMode() == cmake::NORMAL_MODE)
{
const char* msg = "Configuring done";
if(cmSystemTools::GetErrorOccuredFlag())
@@ -832,6 +906,10 @@ void cmGlobalGenerator::Generate()
return;
}
+ // Iterate through all targets and set up automoc for those which have
+ // the AUTOMOC property set
+ this->CreateAutomocTargets();
+
// For each existing cmLocalGenerator
unsigned int i;
@@ -950,6 +1028,35 @@ bool cmGlobalGenerator::CheckTargets()
return true;
}
+//----------------------------------------------------------------------------
+void cmGlobalGenerator::CreateAutomocTargets()
+{
+#ifdef CMAKE_BUILD_WITH_CMAKE
+ for(unsigned int i=0; i < this->LocalGenerators.size(); ++i)
+ {
+ cmTargets& targets =
+ this->LocalGenerators[i]->GetMakefile()->GetTargets();
+ for(cmTargets::iterator ti = targets.begin();
+ ti != targets.end(); ++ti)
+ {
+ cmTarget& target = ti->second;
+ if(target.GetType() == cmTarget::EXECUTABLE ||
+ target.GetType() == cmTarget::STATIC_LIBRARY ||
+ target.GetType() == cmTarget::SHARED_LIBRARY ||
+ target.GetType() == cmTarget::MODULE_LIBRARY)
+ {
+ if(target.GetPropertyAsBool("AUTOMOC") && !target.IsImported())
+ {
+ cmQtAutomoc automoc;
+ automoc.SetupAutomocTarget(&target);
+ }
+ }
+ }
+ }
+#endif
+}
+
+
void cmGlobalGenerator::CheckLocalGenerators()
{
std::map<cmStdString, cmStdString> notFoundMap;
@@ -1019,9 +1126,9 @@ void cmGlobalGenerator::CheckLocalGenerators()
if(notFoundMap.size())
{
std::string notFoundVars;
- for(std::map<cmStdString, cmStdString>::const_iterator
+ for(std::map<cmStdString, cmStdString>::const_iterator
ii = notFoundMap.begin();
- ii != notFoundMap.end();
+ ii != notFoundMap.end();
++ii)
{
notFoundVars += ii->first;
@@ -1057,7 +1164,7 @@ int cmGlobalGenerator::TryCompile(const char *srcdir, const char *bindir,
{
this->FirstTimeProgress = 0.95f;
}
- this->CMakeInstance->UpdateProgress("Configuring",
+ this->CMakeInstance->UpdateProgress("Configuring",
this->FirstTimeProgress);
}
@@ -1136,7 +1243,7 @@ int cmGlobalGenerator::Build(
const char *config,
bool clean, bool fast,
double timeout,
- bool verbose,
+ cmSystemTools::OutputOption outputflag,
const char* extraOptions,
std::vector<std::string> const& nativeOptions)
{
@@ -1161,7 +1268,7 @@ int cmGlobalGenerator::Build(
{
outputPtr = &outputBuffer;
}
-
+
// should we do a clean first?
if (clean)
{
@@ -1176,7 +1283,7 @@ int cmGlobalGenerator::Build(
}
if (!cmSystemTools::RunSingleCommand(cleanCommand.c_str(), outputPtr,
- &retVal, 0, verbose, timeout))
+ &retVal, 0, outputflag, timeout))
{
cmSystemTools::SetRunCommandHideConsole(hideconsole);
cmSystemTools::Error("Generator: execution of make clean failed.");
@@ -1199,7 +1306,7 @@ int cmGlobalGenerator::Build(
// now build
std::string makeCommand =
this->GenerateBuildCommand(makeCommandCSTR, projectName,
- extraOptions, target,
+ extraOptions, target,
config, false, fast);
if(output)
{
@@ -1217,7 +1324,7 @@ int cmGlobalGenerator::Build(
}
if (!cmSystemTools::RunSingleCommand(command, outputPtr,
- &retVal, 0, verbose, timeout))
+ &retVal, 0, outputflag, timeout))
{
cmSystemTools::SetRunCommandHideConsole(hideconsole);
cmSystemTools::Error
@@ -1272,8 +1379,8 @@ void cmGlobalGenerator::AddLocalGenerator(cmLocalGenerator *lg)
if(this->FirstTimeProgress > 0.95f)
{
this->FirstTimeProgress = 0.95f;
- }
- this->CMakeInstance->UpdateProgress("Configuring",
+ }
+ this->CMakeInstance->UpdateProgress("Configuring",
this->FirstTimeProgress);
return;
}
@@ -1296,8 +1403,8 @@ void cmGlobalGenerator::AddInstallComponent(const char* component)
}
}
-void cmGlobalGenerator::AddTargetToExports(const char* exportSetName,
- cmTarget* target,
+void cmGlobalGenerator::AddTargetToExports(const char* exportSetName,
+ cmTarget* target,
cmInstallTargetGenerator* archive,
cmInstallTargetGenerator* runTime,
cmInstallTargetGenerator* library,
@@ -1331,7 +1438,7 @@ void cmGlobalGenerator::ClearExportSets()
const std::vector<cmTargetExport*>* cmGlobalGenerator::GetExportSet(
const char* name) const
{
- std::map<cmStdString, std::vector<cmTargetExport*> >::const_iterator
+ std::map<cmStdString, std::vector<cmTargetExport*> >::const_iterator
exportSetIt = this->ExportSets.find(name);
if (exportSetIt != this->ExportSets.end())
{
@@ -1443,7 +1550,7 @@ void cmGlobalGenerator::GetEnabledLanguages(std::vector<std::string>& lang)
int cmGlobalGenerator::GetLinkerPreference(const char* lang)
{
- std::map<cmStdString, int>::const_iterator it =
+ std::map<cmStdString, int>::const_iterator it =
this->LanguageToLinkerPreference.find(lang);
if (it != this->LanguageToLinkerPreference.end())
{
diff --git a/Source/cmGlobalGenerator.h b/Source/cmGlobalGenerator.h
index 5268731..ded3345 100644
--- a/Source/cmGlobalGenerator.h
+++ b/Source/cmGlobalGenerator.h
@@ -17,7 +17,7 @@
#include "cmTarget.h" // For cmTargets
#include "cmTargetDepend.h" // For cmTargetDependSet
-
+#include "cmSystemTools.h" // for cmSystemTools::OutputOption
class cmake;
class cmMakefile;
class cmLocalGenerator;
@@ -77,13 +77,20 @@ public:
cmMakefile *, bool optional);
/**
+ * Resolve the CMAKE_<lang>_COMPILER setting for the given language.
+ * Intended to be called from EnableLanguage.
+ */
+ void ResolveLanguageCompiler(const std::string &lang, cmMakefile *mf,
+ bool optional);
+
+ /**
* Try to determine system infomation, get it from another generator
*/
virtual void EnableLanguagesFromGenerator(cmGlobalGenerator *gen,
cmMakefile* mf);
/**
- * Try running cmake and building a file. This is used for dynalically
+ * Try running cmake and building a file. This is used for dynamically
* loaded commands, not as part of the usual build process.
*/
virtual int TryCompile(const char *srcdir, const char *bindir,
@@ -102,7 +109,8 @@ public:
std::string *output,
const char *makeProgram, const char *config,
bool clean, bool fast,
- double timeout, bool verbose=false,
+ double timeout,
+ cmSystemTools::OutputOption outputflag=cmSystemTools::OUTPUT_NONE,
const char* extraOptions = 0,
std::vector<std::string> const& nativeOptions =
std::vector<std::string>());
@@ -119,6 +127,7 @@ public:
///! Get the CMake instance
cmake *GetCMakeInstance() { return this->CMakeInstance; };
+ const cmake *GetCMakeInstance() const { return this->CMakeInstance; };
void SetConfiguredFilesPath(cmGlobalGenerator* gen);
const std::vector<cmLocalGenerator *>& GetLocalGenerators() const {
@@ -161,8 +170,8 @@ public:
int TryCompileTimeout;
- bool GetForceUnixPaths() {return this->ForceUnixPaths;}
- bool GetToolSupportsColor() { return this->ToolSupportsColor; }
+ bool GetForceUnixPaths() const { return this->ForceUnixPaths; }
+ bool GetToolSupportsColor() const { return this->ToolSupportsColor; }
///! return the language for the given extension
const char* GetLanguageFromExtension(const char* ext);
@@ -177,11 +186,11 @@ public:
virtual const char* GetCMakeCFGInitDirectory() { return "."; }
/** Get whether the generator should use a script for link commands. */
- bool GetUseLinkScript() { return this->UseLinkScript; }
+ bool GetUseLinkScript() const { return this->UseLinkScript; }
/** Get whether the generator should produce special marks on rules
producing symbolic (non-file) outputs. */
- bool GetNeedSymbolicMark() { return this->NeedSymbolicMark; }
+ bool GetNeedSymbolicMark() const { return this->NeedSymbolicMark; }
/*
* Determine what program to use for building the project.
@@ -211,7 +220,8 @@ public:
/** Get the manifest of all targets that will be built for each
configuration. This is valid during generation only. */
- cmTargetManifest const& GetTargetManifest() { return this->TargetManifest; }
+ cmTargetManifest const& GetTargetManifest() const
+ { return this->TargetManifest; }
/** Get the content of a directory. Directory listings are loaded
from disk at most once and cached. During the generation step
@@ -222,17 +232,17 @@ public:
void AddTarget(cmTargets::value_type &v);
- virtual const char* GetAllTargetName() { return "ALL_BUILD"; }
- virtual const char* GetInstallTargetName() { return "INSTALL"; }
- virtual const char* GetInstallLocalTargetName() { return 0; }
- virtual const char* GetInstallStripTargetName() { return 0; }
- virtual const char* GetPreinstallTargetName() { return 0; }
- virtual const char* GetTestTargetName() { return "RUN_TESTS"; }
- virtual const char* GetPackageTargetName() { return "PACKAGE"; }
- virtual const char* GetPackageSourceTargetName(){ return 0; }
- virtual const char* GetEditCacheTargetName() { return 0; }
- virtual const char* GetRebuildCacheTargetName() { return 0; }
- virtual const char* GetCleanTargetName() { return 0; }
+ virtual const char* GetAllTargetName() const { return "ALL_BUILD"; }
+ virtual const char* GetInstallTargetName() const { return "INSTALL"; }
+ virtual const char* GetInstallLocalTargetName() const { return 0; }
+ virtual const char* GetInstallStripTargetName() const { return 0; }
+ virtual const char* GetPreinstallTargetName() const { return 0; }
+ virtual const char* GetTestTargetName() const { return "RUN_TESTS"; }
+ virtual const char* GetPackageTargetName() const { return "PACKAGE"; }
+ virtual const char* GetPackageSourceTargetName() const { return 0; }
+ virtual const char* GetEditCacheTargetName() const { return 0; }
+ virtual const char* GetRebuildCacheTargetName() const { return 0; }
+ virtual const char* GetCleanTargetName() const { return 0; }
// Class to track a set of dependencies.
typedef cmTargetDependSet TargetDependSet;
@@ -281,6 +291,8 @@ protected:
virtual bool CheckALLOW_DUPLICATE_CUSTOM_TARGETS();
bool CheckTargets();
+ void CreateAutomocTargets();
+
// Fill the ProjectMap, this must be called after LocalGenerators
// has been populated.
diff --git a/Source/cmGlobalKdevelopGenerator.h b/Source/cmGlobalKdevelopGenerator.h
index 63f7c1f..a1ad39d 100644
--- a/Source/cmGlobalKdevelopGenerator.h
+++ b/Source/cmGlobalKdevelopGenerator.h
@@ -23,8 +23,8 @@ class cmLocalGenerator;
* cmGlobalKdevelopGenerator produces a project file for KDevelop 3 (KDevelop
* > 3.1.1). The project is based on the "Custom Makefile based C/C++"
* project of KDevelop. Such a project consists of Unix Makefiles in the
- * build directory together with a <your_project>.kdevelop project file,
- * which contains the project settings and a <your_project>.kdevelop.filelist
+ * build directory together with a \<your_project\>.kdevelop project file,
+ * which contains the project settings and a \<your_project\>.kdevelop.filelist
* file, which lists the source files relative to the kdevelop project
* directory. The kdevelop project directory is the base source directory.
*/
@@ -36,19 +36,19 @@ public:
virtual const char* GetName() const
{ return cmGlobalKdevelopGenerator::GetActualName();}
static const char* GetActualName() { return "KDevelop3";}
- static cmExternalMakefileProjectGenerator* New()
+ static cmExternalMakefileProjectGenerator* New()
{ return new cmGlobalKdevelopGenerator; }
/** Get the documentation entry for this generator. */
- virtual void GetDocumentation(cmDocumentationEntry& entry,
+ virtual void GetDocumentation(cmDocumentationEntry& entry,
const char* fullName) const;
virtual void Generate();
private:
/*** Create the foo.kdevelop.filelist file, return false if it doesn't
- succeed. If the file already exists the contents will be merged.
+ succeed. If the file already exists the contents will be merged.
*/
bool CreateFilelistFile(const std::vector<cmLocalGenerator*>& lgs,
- const std::string& outputDir,
+ const std::string& outputDir,
const std::string& projectDirIn,
const std::string& projectname,
std::string& cmakeFilePattern,
@@ -62,13 +62,13 @@ private:
listfiles used by this CMakeLists.txt */
void CreateProjectFile(const std::string& outputDir,
const std::string& projectDir,
- const std::string& projectname,
- const std::string& executable,
+ const std::string& projectname,
+ const std::string& executable,
const std::string& cmakeFilePattern,
const std::string& fileToOpen);
/*** Reads the old foo.kdevelop line by line and only replaces the
- "important" lines
+ "important" lines
*/
void MergeProjectFiles(const std::string& outputDir,
const std::string& projectDir,
@@ -78,10 +78,10 @@ private:
const std::string& fileToOpen,
const std::string& sessionFilename);
///! Creates a new foo.kdevelop and a new foo.kdevses file
- void CreateNewProjectFile(const std::string& outputDir,
- const std::string& projectDir,
+ void CreateNewProjectFile(const std::string& outputDir,
+ const std::string& projectDir,
const std::string& filename,
- const std::string& executable,
+ const std::string& executable,
const std::string& cmakeFilePattern,
const std::string& fileToOpen,
const std::string& sessionFilename);
diff --git a/Source/cmGlobalMinGWMakefileGenerator.cxx b/Source/cmGlobalMinGWMakefileGenerator.cxx
index 2f558dc..a9e7798 100644
--- a/Source/cmGlobalMinGWMakefileGenerator.cxx
+++ b/Source/cmGlobalMinGWMakefileGenerator.cxx
@@ -66,18 +66,6 @@ cmLocalGenerator *cmGlobalMinGWMakefileGenerator::CreateLocalGenerator()
lg->SetPassMakeflags(false);
lg->SetUnixCD(true);
lg->SetMinGWMake(true);
-
- // mingw32-make has trouble running code like
- //
- // @echo message with spaces
- //
- // If quotes are added
- //
- // @echo "message with spaces"
- //
- // it runs but the quotes are displayed. Instead just use cmake to
- // echo.
- lg->SetNativeEchoCommand("@$(CMAKE_COMMAND) -E echo ", false);
return lg;
}
diff --git a/Source/cmGlobalUnixMakefileGenerator3.cxx b/Source/cmGlobalUnixMakefileGenerator3.cxx
index 169d77d..a23c0d8 100644
--- a/Source/cmGlobalUnixMakefileGenerator3.cxx
+++ b/Source/cmGlobalUnixMakefileGenerator3.cxx
@@ -39,7 +39,6 @@ void cmGlobalUnixMakefileGenerator3
bool optional)
{
this->cmGlobalGenerator::EnableLanguage(languages, mf, optional);
- std::string path;
for(std::vector<std::string>::const_iterator l = languages.begin();
l != languages.end(); ++l)
{
@@ -47,74 +46,7 @@ void cmGlobalUnixMakefileGenerator3
{
continue;
}
- const char* lang = l->c_str();
- std::string langComp = "CMAKE_";
- langComp += lang;
- langComp += "_COMPILER";
-
- if(!mf->GetDefinition(langComp.c_str()))
- {
- if(!optional)
- {
- cmSystemTools::Error(langComp.c_str(),
- " not set, after EnableLanguage");
- }
- continue;
- }
- const char* name = mf->GetRequiredDefinition(langComp.c_str());
- if(!cmSystemTools::FileIsFullPath(name))
- {
- path = cmSystemTools::FindProgram(name);
- }
- else
- {
- path = name;
- }
- if((path.size() == 0 || !cmSystemTools::FileExists(path.c_str()))
- && (optional==false))
- {
- std::string message = "your ";
- message += lang;
- message += " compiler: \"";
- message += name;
- message += "\" was not found. Please set ";
- message += langComp;
- message += " to a valid compiler path or name.";
- cmSystemTools::Error(message.c_str());
- path = name;
- }
- std::string doc = lang;
- doc += " compiler.";
- const char* cname = this->GetCMakeInstance()->
- GetCacheManager()->GetCacheValue(langComp.c_str());
- std::string changeVars;
- if(cname && (path != cname) && (optional==false))
- {
- std::string cnameString = cname;
- std::string pathString = path;
- // get rid of potentially multiple slashes:
- cmSystemTools::ConvertToUnixSlashes(cnameString);
- cmSystemTools::ConvertToUnixSlashes(pathString);
- if (cnameString != pathString)
- {
- const char* cvars =
- this->GetCMakeInstance()->GetProperty(
- "__CMAKE_DELETE_CACHE_CHANGE_VARS_");
- if(cvars)
- {
- changeVars += cvars;
- changeVars += ";";
- }
- changeVars += langComp;
- changeVars += ";";
- changeVars += cname;
- this->GetCMakeInstance()->SetProperty(
- "__CMAKE_DELETE_CACHE_CHANGE_VARS_",
- changeVars.c_str());
- }
- }
- mf->AddCacheDefinition(langComp.c_str(), path.c_str(),
- doc.c_str(), cmCacheManager::FILEPATH);
+ this->ResolveLanguageCompiler(*l, mf, optional);
}
}
diff --git a/Source/cmGlobalUnixMakefileGenerator3.h b/Source/cmGlobalUnixMakefileGenerator3.h
index d21d5b9..9663b55 100644
--- a/Source/cmGlobalUnixMakefileGenerator3.h
+++ b/Source/cmGlobalUnixMakefileGenerator3.h
@@ -36,7 +36,7 @@ class cmLocalUnixMakefileGenerator3;
targets that are required to make the process work.
Makefile2 in turn will recursively make targets in the correct order. Each
- target has its own directory <target>.dir and its own makefile build.make in
+ target has its own directory \<target\>.dir and its own makefile build.make in
that directory. Also in that directory is a couple makefiles per source file
used by the target. Typically these are named source.obj.build.make and
source.obj.build.depend.make. The source.obj.build.make contains the rules
@@ -90,7 +90,7 @@ public:
void WriteHelpRule(std::ostream& ruleFileStream,
cmLocalUnixMakefileGenerator3 *);
- // write the top lvel target rules
+ // write the top level target rules
void WriteConvenienceRules(std::ostream& ruleFileStream,
std::set<cmStdString> &emitted);
@@ -136,18 +136,18 @@ protected:
// does this generator need a requires step for any of its targets
bool NeedRequiresStep(cmTarget const&);
- // Setup target names
- virtual const char* GetAllTargetName() { return "all"; }
- virtual const char* GetInstallTargetName() { return "install"; }
- virtual const char* GetInstallLocalTargetName() { return "install/local"; }
- virtual const char* GetInstallStripTargetName() { return "install/strip"; }
- virtual const char* GetPreinstallTargetName() { return "preinstall"; }
- virtual const char* GetTestTargetName() { return "test"; }
- virtual const char* GetPackageTargetName() { return "package"; }
- virtual const char* GetPackageSourceTargetName(){ return "package_source"; }
- virtual const char* GetEditCacheTargetName() { return "edit_cache"; }
- virtual const char* GetRebuildCacheTargetName() { return "rebuild_cache"; }
- virtual const char* GetCleanTargetName() { return "clean"; }
+ // Target name hooks for superclass.
+ const char* GetAllTargetName() const { return "all"; }
+ const char* GetInstallTargetName() const { return "install"; }
+ const char* GetInstallLocalTargetName() const { return "install/local"; }
+ const char* GetInstallStripTargetName() const { return "install/strip"; }
+ const char* GetPreinstallTargetName() const { return "preinstall"; }
+ const char* GetTestTargetName() const { return "test"; }
+ const char* GetPackageTargetName() const { return "package"; }
+ const char* GetPackageSourceTargetName() const { return "package_source"; }
+ const char* GetEditCacheTargetName() const { return "edit_cache"; }
+ const char* GetRebuildCacheTargetName() const { return "rebuild_cache"; }
+ const char* GetCleanTargetName() const { return "clean"; }
virtual bool CheckALLOW_DUPLICATE_CUSTOM_TARGETS() { return true; }
diff --git a/Source/cmGlobalVisualStudio10Generator.cxx b/Source/cmGlobalVisualStudio10Generator.cxx
index 328a3da..ec8f4a5 100644
--- a/Source/cmGlobalVisualStudio10Generator.cxx
+++ b/Source/cmGlobalVisualStudio10Generator.cxx
@@ -175,3 +175,39 @@ std::string cmGlobalVisualStudio10Generator
}
return makeCommand;
}
+
+//----------------------------------------------------------------------------
+bool cmGlobalVisualStudio10Generator::Find64BitTools(cmMakefile* mf)
+{
+ if(!this->PlatformToolset.empty())
+ {
+ return true;
+ }
+ // This edition does not come with 64-bit tools. Look for them.
+ //
+ // TODO: Detect available tools? x64\v100 exists but does not work?
+ // KHLM\\SOFTWARE\\Microsoft\\MSBuild\\ToolsVersions\\4.0;VCTargetsPath
+ // c:/Program Files (x86)/MSBuild/Microsoft.Cpp/v4.0/Platforms/
+ // {Itanium,Win32,x64}/PlatformToolsets/{v100,v90,Windows7.1SDK}
+ std::string winSDK_7_1;
+ if(cmSystemTools::ReadRegistryValue(
+ "HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Microsoft SDKs\\"
+ "Windows\\v7.1;InstallationFolder", winSDK_7_1))
+ {
+ cmOStringStream m;
+ m << "Found Windows SDK v7.1: " << winSDK_7_1;
+ mf->DisplayStatus(m.str().c_str(), -1);
+ this->PlatformToolset = "Windows7.1SDK";
+ return true;
+ }
+ else
+ {
+ cmOStringStream e;
+ e << "Cannot enable 64-bit tools with Visual Studio 2010 Express.\n"
+ << "Install the Microsoft Windows SDK v7.1 to get 64-bit tools:\n"
+ << " http://msdn.microsoft.com/en-us/windows/bb980924.aspx";
+ mf->IssueMessage(cmake::FATAL_ERROR, e.str().c_str());
+ cmSystemTools::SetFatalErrorOccured();
+ return false;
+ }
+}
diff --git a/Source/cmGlobalVisualStudio10Generator.h b/Source/cmGlobalVisualStudio10Generator.h
index bef5642..18b483d 100644
--- a/Source/cmGlobalVisualStudio10Generator.h
+++ b/Source/cmGlobalVisualStudio10Generator.h
@@ -74,11 +74,11 @@ public:
virtual std::string GetUserMacrosRegKeyBase();
virtual const char* GetCMakeCFGInitDirectory()
{ return "$(Configuration)";}
+ bool Find64BitTools(cmMakefile* mf);
protected:
virtual const char* GetIDEVersion() { return "10.0"; }
std::string PlatformToolset;
-private:
bool ExpressEdition;
};
#endif
diff --git a/Source/cmGlobalVisualStudio10IA64Generator.cxx b/Source/cmGlobalVisualStudio10IA64Generator.cxx
new file mode 100644
index 0000000..5f70f6b
--- /dev/null
+++ b/Source/cmGlobalVisualStudio10IA64Generator.cxx
@@ -0,0 +1,51 @@
+/*============================================================================
+ CMake - Cross Platform Makefile Generator
+ Copyright 2000-2009 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 "cmGlobalVisualStudio10IA64Generator.h"
+#include "cmMakefile.h"
+#include "cmake.h"
+
+//----------------------------------------------------------------------------
+cmGlobalVisualStudio10IA64Generator::cmGlobalVisualStudio10IA64Generator()
+{
+}
+
+//----------------------------------------------------------------------------
+void cmGlobalVisualStudio10IA64Generator
+::GetDocumentation(cmDocumentationEntry& entry) const
+{
+ entry.Name = this->GetName();
+ entry.Brief = "Generates Visual Studio 10 Itanium project files.";
+ entry.Full = "";
+}
+
+//----------------------------------------------------------------------------
+void cmGlobalVisualStudio10IA64Generator
+::AddPlatformDefinitions(cmMakefile* mf)
+{
+ this->cmGlobalVisualStudio10Generator::AddPlatformDefinitions(mf);
+ mf->AddDefinition("CMAKE_FORCE_IA64", "TRUE");
+ mf->AddDefinition("MSVC_C_ARCHITECTURE_ID", "x64");
+ mf->AddDefinition("MSVC_CXX_ARCHITECTURE_ID", "x64");
+}
+
+//----------------------------------------------------------------------------
+void cmGlobalVisualStudio10IA64Generator
+::EnableLanguage(std::vector<std::string> const& languages,
+ cmMakefile* mf, bool optional)
+{
+ if(this->IsExpressEdition() && !this->Find64BitTools(mf))
+ {
+ return;
+ }
+ this->cmGlobalVisualStudio10Generator
+ ::EnableLanguage(languages, mf, optional);
+}
diff --git a/Source/cmGlobalVisualStudio10IA64Generator.h b/Source/cmGlobalVisualStudio10IA64Generator.h
new file mode 100644
index 0000000..a088272
--- /dev/null
+++ b/Source/cmGlobalVisualStudio10IA64Generator.h
@@ -0,0 +1,40 @@
+/*============================================================================
+ CMake - Cross Platform Makefile Generator
+ Copyright 2000-2009 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 cmGlobalVisualStudio10IA64Generator_h
+#define cmGlobalVisualStudio10IA64Generator_h
+
+#include "cmGlobalVisualStudio10Generator.h"
+
+class cmGlobalVisualStudio10IA64Generator :
+ public cmGlobalVisualStudio10Generator
+{
+public:
+ cmGlobalVisualStudio10IA64Generator();
+ static cmGlobalGenerator* New() {
+ return new cmGlobalVisualStudio10IA64Generator; }
+
+ ///! Get the name for the generator.
+ virtual const char* GetName() const {
+ return cmGlobalVisualStudio10IA64Generator::GetActualName();}
+ static const char* GetActualName() {return "Visual Studio 10 IA64";}
+
+ virtual const char* GetPlatformName() const {return "Itanium";}
+
+ /** Get the documentation entry for this generator. */
+ virtual void GetDocumentation(cmDocumentationEntry& entry) const;
+
+ virtual void AddPlatformDefinitions(cmMakefile* mf);
+
+ virtual void EnableLanguage(std::vector<std::string>const& languages,
+ cmMakefile *, bool optional);
+};
+#endif
diff --git a/Source/cmGlobalVisualStudio10Win64Generator.cxx b/Source/cmGlobalVisualStudio10Win64Generator.cxx
index 8600777..49dc473 100644
--- a/Source/cmGlobalVisualStudio10Win64Generator.cxx
+++ b/Source/cmGlobalVisualStudio10Win64Generator.cxx
@@ -38,42 +38,6 @@ void cmGlobalVisualStudio10Win64Generator
}
//----------------------------------------------------------------------------
-bool cmGlobalVisualStudio10Win64Generator::Find64BitTools(cmMakefile* mf)
-{
- if(!this->PlatformToolset.empty())
- {
- return true;
- }
- // This edition does not come with 64-bit tools. Look for them.
- //
- // TODO: Detect available tools? x64\v100 exists but does not work?
- // KHLM\\SOFTWARE\\Microsoft\\MSBuild\\ToolsVersions\\4.0;VCTargetsPath
- // c:/Program Files (x86)/MSBuild/Microsoft.Cpp/v4.0/Platforms/
- // {Itanium,Win32,x64}/PlatformToolsets/{v100,v90,Windows7.1SDK}
- std::string winSDK_7_1;
- if(cmSystemTools::ReadRegistryValue(
- "HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Microsoft SDKs\\"
- "Windows\\v7.1;InstallationFolder", winSDK_7_1))
- {
- cmOStringStream m;
- m << "Found Windows SDK v7.1: " << winSDK_7_1;
- mf->DisplayStatus(m.str().c_str(), -1);
- this->PlatformToolset = "Windows7.1SDK";
- return true;
- }
- else
- {
- cmOStringStream e;
- e << "Cannot enable 64-bit tools with Visual Studio 2010 Express.\n"
- << "Install the Microsoft Windows SDK v7.1 to get 64-bit tools:\n"
- << " http://msdn.microsoft.com/en-us/windows/bb980924.aspx";
- mf->IssueMessage(cmake::FATAL_ERROR, e.str().c_str());
- cmSystemTools::SetFatalErrorOccured();
- return false;
- }
-}
-
-//----------------------------------------------------------------------------
void cmGlobalVisualStudio10Win64Generator
::EnableLanguage(std::vector<std::string> const& languages,
cmMakefile* mf, bool optional)
diff --git a/Source/cmGlobalVisualStudio10Win64Generator.h b/Source/cmGlobalVisualStudio10Win64Generator.h
index e6d3dc5..8a2de4c 100644
--- a/Source/cmGlobalVisualStudio10Win64Generator.h
+++ b/Source/cmGlobalVisualStudio10Win64Generator.h
@@ -34,7 +34,6 @@ public:
virtual void AddPlatformDefinitions(cmMakefile* mf);
- bool Find64BitTools(cmMakefile* mf);
virtual void EnableLanguage(std::vector<std::string>const& languages,
cmMakefile *, bool optional);
};
diff --git a/Source/cmGlobalVisualStudio11Generator.cxx b/Source/cmGlobalVisualStudio11Generator.cxx
new file mode 100644
index 0000000..97308bb
--- /dev/null
+++ b/Source/cmGlobalVisualStudio11Generator.cxx
@@ -0,0 +1,45 @@
+/*============================================================================
+ 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.
+============================================================================*/
+#include "cmGlobalVisualStudio11Generator.h"
+#include "cmMakefile.h"
+
+//----------------------------------------------------------------------------
+cmGlobalVisualStudio11Generator::cmGlobalVisualStudio11Generator()
+{
+ this->FindMakeProgramFile = "CMakeVS11FindMake.cmake";
+ this->ExpressEdition = false; // TODO: VS 11 Express support
+ this->PlatformToolset = "v110";
+}
+
+//----------------------------------------------------------------------------
+void cmGlobalVisualStudio11Generator::AddPlatformDefinitions(cmMakefile* mf)
+{
+ mf->AddDefinition("MSVC11", "1");
+ mf->AddDefinition("MSVC_C_ARCHITECTURE_ID", "X86");
+ mf->AddDefinition("MSVC_CXX_ARCHITECTURE_ID", "X86");
+}
+
+//----------------------------------------------------------------------------
+void cmGlobalVisualStudio11Generator::WriteSLNHeader(std::ostream& fout)
+{
+ fout << "Microsoft Visual Studio Solution File, Format Version 12.00\n";
+ fout << "# Visual Studio 11\n";
+}
+
+//----------------------------------------------------------------------------
+void cmGlobalVisualStudio11Generator
+::GetDocumentation(cmDocumentationEntry& entry) const
+{
+ entry.Name = this->GetName();
+ entry.Brief = "Generates Visual Studio 11 project files.";
+ entry.Full = "";
+}
diff --git a/Source/cmGlobalVisualStudio11Generator.h b/Source/cmGlobalVisualStudio11Generator.h
new file mode 100644
index 0000000..14019a7
--- /dev/null
+++ b/Source/cmGlobalVisualStudio11Generator.h
@@ -0,0 +1,43 @@
+/*============================================================================
+ 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 cmGlobalVisualStudio11Generator_h
+#define cmGlobalVisualStudio11Generator_h
+
+#include "cmGlobalVisualStudio10Generator.h"
+
+
+/** \class cmGlobalVisualStudio11Generator */
+class cmGlobalVisualStudio11Generator:
+ public cmGlobalVisualStudio10Generator
+{
+public:
+ cmGlobalVisualStudio11Generator();
+ static cmGlobalGenerator* New() {
+ return new cmGlobalVisualStudio11Generator; }
+
+ ///! Get the name for the generator.
+ virtual const char* GetName() const {
+ return cmGlobalVisualStudio11Generator::GetActualName();}
+ static const char* GetActualName() {return "Visual Studio 11";}
+ virtual void AddPlatformDefinitions(cmMakefile* mf);
+
+ virtual void WriteSLNHeader(std::ostream& fout);
+
+ /** Get the documentation entry for this generator. */
+ virtual void GetDocumentation(cmDocumentationEntry& entry) const;
+
+ /** TODO: VS 11 user macro support. */
+ virtual std::string GetUserMacrosDirectory() { return ""; }
+protected:
+ virtual const char* GetIDEVersion() { return "11.0"; }
+};
+#endif
diff --git a/Source/cmGlobalVisualStudio11Win64Generator.cxx b/Source/cmGlobalVisualStudio11Win64Generator.cxx
new file mode 100644
index 0000000..10c9027
--- /dev/null
+++ b/Source/cmGlobalVisualStudio11Win64Generator.cxx
@@ -0,0 +1,33 @@
+/*============================================================================
+ 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.
+============================================================================*/
+#include "cmGlobalVisualStudio11Win64Generator.h"
+#include "cmMakefile.h"
+#include "cmake.h"
+
+//----------------------------------------------------------------------------
+void cmGlobalVisualStudio11Win64Generator
+::GetDocumentation(cmDocumentationEntry& entry) const
+{
+ entry.Name = this->GetName();
+ entry.Brief = "Generates Visual Studio 11 Win64 project files.";
+ entry.Full = "";
+}
+
+//----------------------------------------------------------------------------
+void cmGlobalVisualStudio11Win64Generator
+::AddPlatformDefinitions(cmMakefile* mf)
+{
+ this->cmGlobalVisualStudio11Generator::AddPlatformDefinitions(mf);
+ mf->AddDefinition("CMAKE_FORCE_WIN64", "TRUE");
+ mf->AddDefinition("MSVC_C_ARCHITECTURE_ID", "x64");
+ mf->AddDefinition("MSVC_CXX_ARCHITECTURE_ID", "x64");
+}
diff --git a/Source/cmGlobalVisualStudio11Win64Generator.h b/Source/cmGlobalVisualStudio11Win64Generator.h
new file mode 100644
index 0000000..53f1953
--- /dev/null
+++ b/Source/cmGlobalVisualStudio11Win64Generator.h
@@ -0,0 +1,37 @@
+/*============================================================================
+ 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 cmGlobalVisualStudio11Win64Generator_h
+#define cmGlobalVisualStudio11Win64Generator_h
+
+#include "cmGlobalVisualStudio11Generator.h"
+
+class cmGlobalVisualStudio11Win64Generator :
+ public cmGlobalVisualStudio11Generator
+{
+public:
+ cmGlobalVisualStudio11Win64Generator() {}
+ static cmGlobalGenerator* New() {
+ return new cmGlobalVisualStudio11Win64Generator; }
+
+ ///! Get the name for the generator.
+ virtual const char* GetName() const {
+ return cmGlobalVisualStudio11Win64Generator::GetActualName();}
+ static const char* GetActualName() {return "Visual Studio 11 Win64";}
+
+ virtual const char* GetPlatformName() const {return "x64";}
+
+ /** Get the documentation entry for this generator. */
+ virtual void GetDocumentation(cmDocumentationEntry& entry) const;
+
+ virtual void AddPlatformDefinitions(cmMakefile* mf);
+};
+#endif
diff --git a/Source/cmGlobalVisualStudio7Generator.cxx b/Source/cmGlobalVisualStudio7Generator.cxx
index 51b8918..84e7f1b 100644
--- a/Source/cmGlobalVisualStudio7Generator.cxx
+++ b/Source/cmGlobalVisualStudio7Generator.cxx
@@ -739,18 +739,6 @@ void cmGlobalVisualStudio7Generator
entry.Full = "";
}
-// make sure "special" targets have GUID's
-void cmGlobalVisualStudio7Generator::Configure()
-{
- cmGlobalGenerator::Configure();
- this->CreateGUID("ALL_BUILD");
- this->CreateGUID("INSTALL");
- this->CreateGUID("RUN_TESTS");
- this->CreateGUID("EDIT_CACHE");
- this->CreateGUID("REBUILD_CACHE");
- this->CreateGUID("PACKAGE");
-}
-
//----------------------------------------------------------------------------
void
cmGlobalVisualStudio7Generator
diff --git a/Source/cmGlobalVisualStudio7Generator.h b/Source/cmGlobalVisualStudio7Generator.h
index b6c84e8..adfb757 100644
--- a/Source/cmGlobalVisualStudio7Generator.h
+++ b/Source/cmGlobalVisualStudio7Generator.h
@@ -26,9 +26,9 @@ class cmGlobalVisualStudio7Generator : public cmGlobalVisualStudioGenerator
{
public:
cmGlobalVisualStudio7Generator();
- static cmGlobalGenerator* New() {
+ static cmGlobalGenerator* New() {
return new cmGlobalVisualStudio7Generator; }
-
+
///! Get the name for the generator.
virtual const char* GetName() const {
return cmGlobalVisualStudio7Generator::GetActualName();}
@@ -39,21 +39,21 @@ public:
/** Get the documentation entry for this generator. */
virtual void GetDocumentation(cmDocumentationEntry& entry) const;
-
+
/**
* Try to determine system infomation such as shared library
- * extension, pthreads, byte order etc.
+ * extension, pthreads, byte order etc.
*/
- virtual void EnableLanguage(std::vector<std::string>const& languages,
+ virtual void EnableLanguage(std::vector<std::string>const& languages,
cmMakefile *, bool optional);
/**
- * Try running cmake and building a file. This is used for dynalically
+ * Try running cmake and building a file. This is used for dynamically
* loaded commands, not as part of the usual build process.
*/
virtual std::string GenerateBuildCommand(const char* makeProgram,
- const char *projectName,
- const char* additionalOptions,
+ const char *projectName,
+ const char* additionalOptions,
const char *targetName,
const char* config,
bool ignoreErrors,
@@ -62,7 +62,7 @@ public:
/**
* Generate the all required files for building this project/tree. This
* basically creates a series of LocalGenerators for each directory and
- * requests that they Generate.
+ * requests that they Generate.
*/
virtual void Generate();
@@ -75,14 +75,11 @@ public:
* Get the list of configurations
*/
std::vector<std::string> *GetConfigurations();
-
+
///! Create a GUID or get an existing one.
void CreateGUID(const char* name);
std::string GetGUID(const char* name);
- ///! do configure step
- virtual void Configure();
-
/** Append the subdirectory for the given configuration. */
virtual void AppendDirectoryForConfig(const char* prefix,
const char* config,
@@ -100,13 +97,13 @@ protected:
virtual const char* GetIDEVersion() { return "7.0"; }
static cmIDEFlagTable const* GetExtraFlagTableVS7();
- virtual void OutputSLNFile(cmLocalGenerator* root,
+ virtual void OutputSLNFile(cmLocalGenerator* root,
std::vector<cmLocalGenerator*>& generators);
virtual void WriteSLNFile(std::ostream& fout, cmLocalGenerator* root,
std::vector<cmLocalGenerator*>& generators);
- virtual void WriteProject(std::ostream& fout,
+ virtual void WriteProject(std::ostream& fout,
const char* name, const char* path, cmTarget &t);
- virtual void WriteProjectDepends(std::ostream& fout,
+ virtual void WriteProjectDepends(std::ostream& fout,
const char* name, const char* path, cmTarget &t);
virtual void WriteProjectConfigurations(std::ostream& fout,
const char* name,
@@ -127,11 +124,11 @@ protected:
std::ostream& fout,
cmLocalGenerator* root,
OrderedTargetDependSet const& projectTargets);
-
+
void GenerateConfigurations(cmMakefile* mf);
- virtual void WriteExternalProject(std::ostream& fout,
- const char* name,
+ virtual void WriteExternalProject(std::ostream& fout,
+ const char* name,
const char* path,
const std::set<cmStdString>&
dependencies);
diff --git a/Source/cmGlobalVisualStudio9IA64Generator.cxx b/Source/cmGlobalVisualStudio9IA64Generator.cxx
new file mode 100644
index 0000000..d49739b
--- /dev/null
+++ b/Source/cmGlobalVisualStudio9IA64Generator.cxx
@@ -0,0 +1,48 @@
+/*============================================================================
+ CMake - Cross Platform Makefile Generator
+ Copyright 2000-2009 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 "cmGlobalVisualStudio9IA64Generator.h"
+#include "cmLocalVisualStudio7Generator.h"
+#include "cmMakefile.h"
+
+
+cmGlobalVisualStudio9IA64Generator::cmGlobalVisualStudio9IA64Generator()
+{
+ this->ArchitectureId = "Itanium";
+}
+
+///! Create a local generator appropriate to this Global Generator
+cmLocalGenerator *cmGlobalVisualStudio9IA64Generator::CreateLocalGenerator()
+{
+ cmLocalVisualStudio7Generator *lg = new cmLocalVisualStudio7Generator;
+ lg->SetVersion9();
+ lg->SetPlatformName(this->GetPlatformName());
+ lg->SetExtraFlagTable(this->GetExtraFlagTableVS8());
+ lg->SetGlobalGenerator(this);
+ return lg;
+}
+
+//----------------------------------------------------------------------------
+void cmGlobalVisualStudio9IA64Generator
+::GetDocumentation(cmDocumentationEntry& entry) const
+{
+ entry.Name = this->GetName();
+ entry.Brief = "Generates Visual Studio 9 2008 Itanium project files.";
+ entry.Full = "";
+}
+
+//----------------------------------------------------------------------------
+void cmGlobalVisualStudio9IA64Generator
+::AddPlatformDefinitions(cmMakefile* mf)
+{
+ cmGlobalVisualStudio9Generator::AddPlatformDefinitions(mf);
+ mf->AddDefinition("CMAKE_FORCE_IA64", "TRUE");
+}
diff --git a/Source/cmGlobalVisualStudio9IA64Generator.h b/Source/cmGlobalVisualStudio9IA64Generator.h
new file mode 100644
index 0000000..e33ee15
--- /dev/null
+++ b/Source/cmGlobalVisualStudio9IA64Generator.h
@@ -0,0 +1,50 @@
+/*============================================================================
+ CMake - Cross Platform Makefile Generator
+ Copyright 2000-2009 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 cmGlobalVisualStudio9IA64Generator_h
+#define cmGlobalVisualStudio9IA64Generator_h
+
+#include "cmGlobalVisualStudio9Generator.h"
+
+
+/** \class cmGlobalVisualStudio8IA64Generator
+ * \brief Write a Unix makefiles.
+ *
+ * cmGlobalVisualStudio8IA64Generator manages UNIX build process for a tree
+ */
+class cmGlobalVisualStudio9IA64Generator :
+ public cmGlobalVisualStudio9Generator
+{
+public:
+ cmGlobalVisualStudio9IA64Generator();
+ static cmGlobalGenerator* New() {
+ return new cmGlobalVisualStudio9IA64Generator; }
+
+ ///! Get the name for the generator.
+ virtual const char* GetName() const {
+ return cmGlobalVisualStudio9IA64Generator::GetActualName();}
+ static const char* GetActualName() {return "Visual Studio 9 2008 IA64";}
+
+ virtual const char* GetPlatformName() const {return "Itanium";}
+
+ /** Get the documentation entry for this generator. */
+ virtual void GetDocumentation(cmDocumentationEntry& entry) const;
+
+ ///! create the correct local generator
+ virtual cmLocalGenerator *CreateLocalGenerator();
+
+ /**
+ * Try to determine system infomation such as shared library
+ * extension, pthreads, byte order etc.
+ */
+ virtual void AddPlatformDefinitions(cmMakefile *);
+};
+#endif
diff --git a/Source/cmGlobalXCodeGenerator.cxx b/Source/cmGlobalXCodeGenerator.cxx
index 2cbd3ed..32eaef8 100644
--- a/Source/cmGlobalXCodeGenerator.cxx
+++ b/Source/cmGlobalXCodeGenerator.cxx
@@ -327,7 +327,9 @@ std::string
cmGlobalXCodeGenerator::PostBuildMakeTarget(std::string const& tName,
std::string const& configName)
{
- std::string out = "PostBuild." + tName;
+ std::string target = tName;
+ cmSystemTools::ReplaceString(target, " ", "_");
+ std::string out = "PostBuild." + target;
if(this->XcodeVersion > 20)
{
out += "." + configName;
@@ -336,6 +338,9 @@ cmGlobalXCodeGenerator::PostBuildMakeTarget(std::string const& tName,
}
//----------------------------------------------------------------------------
+#define CMAKE_CHECK_BUILD_SYSTEM_TARGET "ZERO_CHECK"
+
+//----------------------------------------------------------------------------
void
cmGlobalXCodeGenerator::AddExtraTargets(cmLocalGenerator* root,
std::vector<cmLocalGenerator*>& gens)
@@ -366,8 +371,18 @@ cmGlobalXCodeGenerator::AddExtraTargets(cmLocalGenerator* root,
makecommand.push_back(this->CurrentXCodeHackMakefile.c_str());
makecommand.push_back(""); // placeholder, see below
- // Add Re-Run CMake rules
- this->CreateReRunCMakeFile(root, gens);
+ // Add ZERO_CHECK
+ bool regenerate = !mf->IsOn("CMAKE_SUPPRESS_REGENERATION");
+ if (regenerate)
+ {
+ this->CreateReRunCMakeFile(root, gens);
+ std::string file = this->ConvertToRelativeForMake(
+ this->CurrentReRunCMakeMakefile.c_str());
+ cmSystemTools::ReplaceString(file, "\\ ", " ");
+ mf->AddUtilityCommand(CMAKE_CHECK_BUILD_SYSTEM_TARGET, true, no_depends,
+ no_working_directory,
+ "make", "-f", file.c_str());
+ }
// now make the allbuild depend on all the non-utility targets
// in the project
@@ -379,10 +394,17 @@ cmGlobalXCodeGenerator::AddExtraTargets(cmLocalGenerator* root,
{
continue;
}
+
cmTargets& tgts = lg->GetMakefile()->GetTargets();
for(cmTargets::iterator l = tgts.begin(); l != tgts.end(); l++)
{
cmTarget& target = l->second;
+
+ if (regenerate && (l->first != CMAKE_CHECK_BUILD_SYSTEM_TARGET))
+ {
+ target.AddUtility(CMAKE_CHECK_BUILD_SYSTEM_TARGET);
+ }
+
// make all exe, shared libs and modules
// run the depend check makefile as a post build rule
// this will make sure that when the next target is built
@@ -402,8 +424,8 @@ cmGlobalXCodeGenerator::AddExtraTargets(cmLocalGenerator* root,
cmTarget::POST_BUILD,
"Depend check for xcode",
dir.c_str());
-
}
+
if(!target.GetPropertyAsBool("EXCLUDE_FROM_ALL"))
{
allbuild->AddUtility(target.GetName());
@@ -469,6 +491,7 @@ void cmGlobalXCodeGenerator::ClearXCodeObjects()
delete this->XCodeObjects[i];
}
this->XCodeObjects.clear();
+ this->XCodeObjectIDs.clear();
this->GroupMap.clear();
this->GroupNameMap.clear();
this->TargetGroup.clear();
@@ -476,6 +499,27 @@ void cmGlobalXCodeGenerator::ClearXCodeObjects()
}
//----------------------------------------------------------------------------
+void cmGlobalXCodeGenerator::addObject(cmXCodeObject *obj)
+{
+ if(obj->GetType() == cmXCodeObject::OBJECT)
+ {
+ cmStdString id = obj->GetId();
+
+ // If this is a duplicate id, it's an error:
+ //
+ if(this->XCodeObjectIDs.count(id))
+ {
+ cmSystemTools::Error(
+ "Xcode generator: duplicate object ids not allowed");
+ }
+
+ this->XCodeObjectIDs.insert(id);
+ }
+
+ this->XCodeObjects.push_back(obj);
+}
+
+//----------------------------------------------------------------------------
cmXCodeObject*
cmGlobalXCodeGenerator::CreateObject(cmXCodeObject::PBXType ptype)
{
@@ -488,7 +532,7 @@ cmGlobalXCodeGenerator::CreateObject(cmXCodeObject::PBXType ptype)
{
obj = new cmXCode21Object(ptype, cmXCodeObject::OBJECT);
}
- this->XCodeObjects.push_back(obj);
+ this->addObject(obj);
return obj;
}
@@ -497,7 +541,7 @@ cmXCodeObject*
cmGlobalXCodeGenerator::CreateObject(cmXCodeObject::Type type)
{
cmXCodeObject* obj = new cmXCodeObject(cmXCodeObject::None, type);
- this->XCodeObjects.push_back(obj);
+ this->addObject(obj);
return obj;
}
@@ -540,6 +584,13 @@ cmGlobalXCodeGenerator::CreateXCodeSourceFile(cmLocalGenerator* lg,
{
lg->AppendFlags(flags, cmtarget.GetProperty("COMPILE_FLAGS"));
}
+ const char* srcfmt = sf->GetProperty("Fortran_FORMAT");
+ switch(this->CurrentLocalGenerator->GetFortranFormat(srcfmt))
+ {
+ case cmLocalGenerator::FortranFormatFixed: flags="-fixed "+flags; break;
+ case cmLocalGenerator::FortranFormatFree: flags="-free "+flags; break;
+ default: break;
+ }
lg->AppendFlags(flags, sf->GetProperty("COMPILE_FLAGS"));
// Add per-source definitions.
@@ -728,7 +779,8 @@ cmGlobalXCodeGenerator::CreateXCodeFileReference(cmSourceFile* sf,
bool cmGlobalXCodeGenerator::SpecialTargetEmitted(std::string const& tname)
{
if(tname == "ALL_BUILD" || tname == "XCODE_DEPEND_HELPER" ||
- tname == "install" || tname == "package" || tname == "RUN_TESTS" )
+ tname == "install" || tname == "package" || tname == "RUN_TESTS" ||
+ tname == CMAKE_CHECK_BUILD_SYSTEM_TARGET )
{
if(this->TargetDoneSet.find(tname) != this->TargetDoneSet.end())
{
@@ -1114,11 +1166,6 @@ void cmGlobalXCodeGenerator::CreateCustomCommands(cmXCodeObject* buildPhases,
commands.push_back(*(*i)->GetCustomCommand());
}
}
- std::vector<cmCustomCommand> reruncom;
- cmXCodeObject* cmakeReRunPhase =
- this->CreateBuildPhase("CMake ReRun", "cmakeReRunPhase",
- cmtarget, reruncom);
- buildPhases->AddObject(cmakeReRunPhase);
// create prebuild phase
cmXCodeObject* cmakeRulesBuildPhase =
this->CreateBuildPhase("CMake Rules",
@@ -1182,19 +1229,30 @@ void cmGlobalXCodeGenerator::CreateCustomCommands(cmXCodeObject* buildPhases,
}
//----------------------------------------------------------------------------
+// This function removes each occurence of the flag and returns the last one
+// (i.e., the dominant flag in GCC)
std::string cmGlobalXCodeGenerator::ExtractFlag(const char* flag,
std::string& flags)
{
std::string retFlag;
- std::string::size_type pos = flags.find(flag);
- if(pos != flags.npos && (pos ==0 || flags[pos-1]==' '))
+ std::string::size_type pos = flags.rfind(flag);
+ bool saved = false;
+ while(pos != flags.npos)
{
- while(pos < flags.size() && flags[pos] != ' ')
+ if(pos == 0 || flags[pos-1]==' ')
{
- retFlag += flags[pos];
- flags[pos] = ' ';
- pos++;
+ while(pos < flags.size() && flags[pos] != ' ')
+ {
+ if(!saved)
+ {
+ retFlag += flags[pos];
+ }
+ flags[pos] = ' ';
+ pos++;
+ }
}
+ saved = true;
+ pos = flags.rfind(flag);
}
return retFlag;
}
@@ -1207,20 +1265,6 @@ cmGlobalXCodeGenerator::AddCommandsToBuildPhase(cmXCodeObject* buildphase,
const & commands,
const char* name)
{
- if(strcmp(name, "cmakeReRunPhase") == 0)
- {
- std::string cdir = this->CurrentMakefile->GetHomeOutputDirectory();
- cdir = this->ConvertToRelativeForMake(cdir.c_str());
- std::string makecmd = "make -C ";
- makecmd += cdir;
- makecmd += " -f ";
- makecmd +=
- this->ConvertToRelativeForMake(this->CurrentReRunCMakeMakefile.c_str());
- cmSystemTools::ReplaceString(makecmd, "\\ ", "\\\\ ");
- buildphase->AddAttribute("shellScript",
- this->CreateString(makecmd.c_str()));
- return;
- }
// collect multiple outputs of custom commands into a set
// which will be used for every configuration
@@ -1284,6 +1328,8 @@ cmGlobalXCodeGenerator::AddCommandsToBuildPhase(cmXCodeObject* buildphase,
cmSystemTools::ReplaceString(makecmd, "\\ ", "\\\\ ");
buildphase->AddAttribute("shellScript",
this->CreateString(makecmd.c_str()));
+ buildphase->AddAttribute("showEnvVarsInLog",
+ this->CreateString("0"));
}
//----------------------------------------------------------------------------
@@ -1480,7 +1526,8 @@ void cmGlobalXCodeGenerator::CreateBuildSettings(cmTarget& target,
BuildObjectListOrString ppDefs(this, this->XcodeVersion >= 30);
if(this->XcodeVersion > 15)
{
- this->AppendDefines(ppDefs, "CMAKE_INTDIR=\"$(CONFIGURATION)\"");
+ this->AppendDefines(ppDefs,
+ "CMAKE_INTDIR=\"$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME)\"");
}
if(const char* exportMacro = target.GetExportMacro())
{
@@ -1597,9 +1644,12 @@ void cmGlobalXCodeGenerator::CreateBuildSettings(cmTarget& target,
{
if(this->XcodeVersion >= 21)
{
- std::string pncdir = target.GetDirectory(configName);
- buildSettings->AddAttribute("CONFIGURATION_BUILD_DIR",
- this->CreateString(pncdir.c_str()));
+ if(!target.UsesDefaultOutputDir(configName, false))
+ {
+ std::string pncdir = target.GetDirectory(configName);
+ buildSettings->AddAttribute("CONFIGURATION_BUILD_DIR",
+ this->CreateString(pncdir.c_str()));
+ }
}
else
{
@@ -1753,7 +1803,7 @@ void cmGlobalXCodeGenerator::CreateBuildSettings(cmTarget& target,
default:
break;
}
- if(this->XcodeVersion >= 22)
+ if(this->XcodeVersion >= 22 && this->XcodeVersion < 40)
{
buildSettings->AddAttribute("PREBINDING",
this->CreateString("NO"));
@@ -1843,7 +1893,17 @@ void cmGlobalXCodeGenerator::CreateBuildSettings(cmTarget& target,
flags += gflag;
}
const char* debugStr = "YES";
- if(gflagc.size() ==0 && gflag.size() == 0)
+ // We can't set the Xcode flag differently depending on the language,
+ // so put them back in this case.
+ if( (lang && strcmp(lang, "CXX") == 0) && gflag != gflagc )
+ {
+ cflags += " ";
+ cflags += gflagc;
+ flags += " ";
+ flags += gflag;
+ debugStr = "NO";
+ }
+ if( gflag == "-g0" || gflag.size() == 0 )
{
debugStr = "NO";
}
@@ -1876,6 +1936,21 @@ void cmGlobalXCodeGenerator::CreateBuildSettings(cmTarget& target,
this->CreateString(flags.c_str()));
}
+ // Add Fortran source format attribute if property is set.
+ const char* format = 0;
+ const char* tgtfmt = target.GetProperty("Fortran_FORMAT");
+ switch(this->CurrentLocalGenerator->GetFortranFormat(tgtfmt))
+ {
+ case cmLocalGenerator::FortranFormatFixed: format = "fixed"; break;
+ case cmLocalGenerator::FortranFormatFree: format = "free"; break;
+ default: break;
+ }
+ if(format)
+ {
+ buildSettings->AddAttribute("IFORT_LANG_SRCFMT",
+ this->CreateString(format));
+ }
+
// Create the INSTALL_PATH attribute.
std::string install_name_dir;
if(target.GetType() == cmTarget::SHARED_LIBRARY)
@@ -1992,6 +2067,9 @@ cmGlobalXCodeGenerator::CreateUtilityTarget(cmTarget& cmtarget)
shellBuildPhase->AddAttribute("shellScript",
this->CreateString(
"# shell script goes here\nexit 0"));
+ shellBuildPhase->AddAttribute("showEnvVarsInLog",
+ this->CreateString("0"));
+
cmXCodeObject* target =
this->CreateObject(cmXCodeObject::PBXAggregateTarget);
target->SetComment(cmtarget.GetName());
@@ -2035,6 +2113,9 @@ cmGlobalXCodeGenerator::CreateUtilityTarget(cmTarget& cmtarget)
}
}
+ target->SetId(this->GetOrCreateId(
+ cmtarget.GetName(), target->GetId()).c_str());
+
return target;
}
@@ -2183,6 +2264,8 @@ cmGlobalXCodeGenerator::CreateXCodeTarget(cmTarget& cmtarget,
target->AddAttribute("productType", this->CreateString(productType));
}
target->SetTarget(&cmtarget);
+ target->SetId(this->GetOrCreateId(
+ cmtarget.GetName(), target->GetId()).c_str());
return target;
}
@@ -2206,6 +2289,26 @@ cmXCodeObject* cmGlobalXCodeGenerator::FindXCodeTarget(cmTarget* t)
}
//----------------------------------------------------------------------------
+std::string cmGlobalXCodeGenerator::GetOrCreateId(const char* name,
+ const char* id)
+{
+ std::string guidStoreName = name;
+ guidStoreName += "_GUID_CMAKE";
+ const char* storedGUID =
+ this->CMakeInstance->GetCacheDefinition(guidStoreName.c_str());
+
+ if(storedGUID)
+ {
+ return storedGUID;
+ }
+
+ this->CMakeInstance->AddCacheEntry(guidStoreName.c_str(),
+ id, "Stored Xcode object GUID", cmCacheManager::INTERNAL);
+
+ return id;
+}
+
+//----------------------------------------------------------------------------
void cmGlobalXCodeGenerator::AddDependTarget(cmXCodeObject* target,
cmXCodeObject* dependTarget)
{
@@ -2399,10 +2502,11 @@ void cmGlobalXCodeGenerator
{
if(this->XcodeVersion > 15)
{
- // now add the same one but append $(CONFIGURATION) to it:
+ // Now add the same one but append
+ // $(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME) to it:
linkDirs += " ";
linkDirs += this->XCodeEscapePath(
- (*libDir + "/$(CONFIGURATION)").c_str());
+ (*libDir + "/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME)").c_str());
}
linkDirs += " ";
linkDirs += this->XCodeEscapePath(libDir->c_str());
@@ -2733,6 +2837,12 @@ void cmGlobalXCodeGenerator
this->RootObject = this->CreateObject(cmXCodeObject::PBXProject);
this->RootObject->SetComment("Project object");
+
+ std::string project_id = "PROJECT_";
+ project_id += root->GetMakefile()->GetProjectName();
+ this->RootObject->SetId(this->GetOrCreateId(
+ project_id.c_str(), this->RootObject->GetId()).c_str());
+
group = this->CreateObject(cmXCodeObject::ATTRIBUTE_GROUP);
this->RootObject->AddAttribute("mainGroup",
this->CreateObjectReference(mainGroup));
@@ -3131,6 +3241,11 @@ cmGlobalXCodeGenerator::OutputXCodeProject(cmLocalGenerator* root,
}
this->WriteXCodePBXProj(fout, root, generators);
this->ClearXCodeObjects();
+
+ // Since this call may have created new cache entries, save the cache:
+ //
+ root->GetMakefile()->GetCacheManager()->SaveCache(
+ root->GetMakefile()->GetHomeOutputDirectory());
}
//----------------------------------------------------------------------------
@@ -3173,7 +3288,8 @@ cmGlobalXCodeGenerator::WriteXCodePBXProj(std::ostream& fout,
//----------------------------------------------------------------------------
const char* cmGlobalXCodeGenerator::GetCMakeCFGInitDirectory()
{
- return this->XcodeVersion >= 21? "$(CONFIGURATION)" : ".";
+ return this->XcodeVersion >= 21 ?
+ "$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME)" : ".";
}
//----------------------------------------------------------------------------
@@ -3402,7 +3518,14 @@ void cmGlobalXCodeGenerator::AppendFlag(std::string& flags,
{
if(*c == '\'')
{
- flags += "\\\\'";
+ if (this->XcodeVersion >= 40)
+ {
+ flags += "'\\\\''";
+ }
+ else
+ {
+ flags += "\\\\'";
+ }
}
else if(*c == '\\')
{
diff --git a/Source/cmGlobalXCodeGenerator.h b/Source/cmGlobalXCodeGenerator.h
index 39a5fd7..ed54be3 100644
--- a/Source/cmGlobalXCodeGenerator.h
+++ b/Source/cmGlobalXCodeGenerator.h
@@ -123,6 +123,8 @@ private:
);
cmXCodeObject* FindXCodeTarget(cmTarget*);
+ std::string GetOrCreateId(const char* name, const char* id);
+
// create cmXCodeObject from these functions so that memory can be managed
// correctly. All objects created are stored in this->XCodeObjects.
cmXCodeObject* CreateObject(cmXCodeObject::PBXType ptype);
@@ -192,14 +194,16 @@ private:
void AppendFlag(std::string& flags, std::string const& flag);
protected:
- virtual const char* GetInstallTargetName() { return "install"; }
- virtual const char* GetPackageTargetName() { return "package"; }
+ virtual const char* GetInstallTargetName() const { return "install"; }
+ virtual const char* GetPackageTargetName() const { return "package"; }
unsigned int XcodeVersion;
std::string VersionString;
+ std::set<cmStdString> XCodeObjectIDs;
std::vector<cmXCodeObject*> XCodeObjects;
cmXCodeObject* RootObject;
private:
+ void addObject(cmXCodeObject *obj);
std::string PostBuildMakeTarget(std::string const& tName,
std::string const& configName);
cmXCodeObject* MainGroupChildren;
diff --git a/Source/cmLinkDirectoriesCommand.h b/Source/cmLinkDirectoriesCommand.h
index e5ff4f0..aa13589 100644
--- a/Source/cmLinkDirectoriesCommand.h
+++ b/Source/cmLinkDirectoriesCommand.h
@@ -65,7 +65,12 @@ public:
"For historical reasons, relative paths given to this command are "
"passed to the linker unchanged "
"(unlike many CMake commands which interpret them relative to the "
- "current source directory)."
+ "current source directory).\n"
+ "Note that this command is rarely necessary. Library locations "
+ "returned by find_package() and find_library() are absolute paths. "
+ "Pass these absolute library file paths directly to the "
+ "target_link_libraries() command. CMake will ensure the linker finds "
+ "them."
;
}
diff --git a/Source/cmLocalGenerator.cxx b/Source/cmLocalGenerator.cxx
index 7da35eb..65d6fa6 100644
--- a/Source/cmLocalGenerator.cxx
+++ b/Source/cmLocalGenerator.cxx
@@ -996,7 +996,7 @@ cmLocalGenerator::ExpandRuleVariable(std::string const& variable,
}
if(variable == "TARGET_TYPE")
{
- return cmTarget::TargetTypeNames[replaceValues.CMTarget->GetType()];
+ return cmTarget::GetTargetTypeName(replaceValues.CMTarget->GetType());
}
}
if(replaceValues.Output)
@@ -1185,6 +1185,13 @@ cmLocalGenerator::ConvertToOutputForExisting(RelativeRoot remote,
}
//----------------------------------------------------------------------------
+std::string
+cmLocalGenerator::ConvertToIncludeReference(std::string const& path)
+{
+ return this->ConvertToOutputForExisting(path.c_str());
+}
+
+//----------------------------------------------------------------------------
const char* cmLocalGenerator::GetIncludeFlags(const char* lang,
bool forResponseFile)
{
@@ -1285,7 +1292,7 @@ const char* cmLocalGenerator::GetIncludeFlags(const char* lang,
}
else
{
- includePath = this->ConvertToOutputForExisting(i->c_str());
+ includePath = this->ConvertToIncludeReference(*i);
}
if(quotePaths && includePath.size() && includePath[0] != '\"')
{
@@ -1456,6 +1463,17 @@ void cmLocalGenerator::GetTargetFlags(std::string& linkLibs,
linkFlags += targetLinkFlags;
linkFlags += " ";
}
+ if(!buildType.empty())
+ {
+ std::string build = "STATIC_LIBRARY_FLAGS_";
+ build += buildType;
+ targetLinkFlags = target.GetProperty(build.c_str());
+ if(targetLinkFlags)
+ {
+ linkFlags += targetLinkFlags;
+ linkFlags += " ";
+ }
+ }
}
break;
case cmTarget::MODULE_LIBRARY:
@@ -1464,7 +1482,7 @@ void cmLocalGenerator::GetTargetFlags(std::string& linkLibs,
{
linkFlags = this->Makefile->GetSafeDefinition(libraryLinkVariable);
linkFlags += " ";
- if(buildType.size())
+ if(!buildType.empty())
{
std::string build = libraryLinkVariable;
build += "_";
@@ -1495,7 +1513,10 @@ void cmLocalGenerator::GetTargetFlags(std::string& linkLibs,
{
linkFlags += targetLinkFlags;
linkFlags += " ";
- std::string configLinkFlags = targetLinkFlags;
+ }
+ if(!buildType.empty())
+ {
+ std::string configLinkFlags = "LINK_FLAGS_";
configLinkFlags += buildType;
targetLinkFlags = target.GetProperty(configLinkFlags.c_str());
if(targetLinkFlags)
@@ -1514,7 +1535,7 @@ void cmLocalGenerator::GetTargetFlags(std::string& linkLibs,
linkFlags +=
this->Makefile->GetSafeDefinition("CMAKE_EXE_LINKER_FLAGS");
linkFlags += " ";
- if(buildType.size())
+ if(!buildType.empty())
{
std::string build = "CMAKE_EXE_LINKER_FLAGS_";
build += buildType;
@@ -1566,8 +1587,11 @@ void cmLocalGenerator::GetTargetFlags(std::string& linkLibs,
if(targetLinkFlags)
{
linkFlags += targetLinkFlags;
- linkFlags += " ";
- std::string configLinkFlags = targetLinkFlags;
+ linkFlags += " ";
+ }
+ if(!buildType.empty())
+ {
+ std::string configLinkFlags = "LINK_FLAGS_";
configLinkFlags += buildType;
targetLinkFlags = target.GetProperty(configLinkFlags.c_str());
if(targetLinkFlags)
@@ -2917,6 +2941,31 @@ std::string cmLocalGenerator::EscapeForCMake(const char* str)
}
//----------------------------------------------------------------------------
+cmLocalGenerator::FortranFormat
+cmLocalGenerator::GetFortranFormat(const char* value)
+{
+ FortranFormat format = FortranFormatNone;
+ if(value && *value)
+ {
+ std::vector<std::string> fmt;
+ cmSystemTools::ExpandListArgument(value, fmt);
+ for(std::vector<std::string>::iterator fi = fmt.begin();
+ fi != fmt.end(); ++fi)
+ {
+ if(*fi == "FIXED")
+ {
+ format = FortranFormatFixed;
+ }
+ if(*fi == "FREE")
+ {
+ format = FortranFormatFree;
+ }
+ }
+ }
+ return format;
+}
+
+//----------------------------------------------------------------------------
std::string
cmLocalGenerator::GetTargetDirectory(cmTarget const&) const
{
diff --git a/Source/cmLocalGenerator.h b/Source/cmLocalGenerator.h
index aebf9f3..0c5b9d0 100644
--- a/Source/cmLocalGenerator.h
+++ b/Source/cmLocalGenerator.h
@@ -25,7 +25,7 @@ class cmCustomCommand;
* \brief Create required build files for a directory.
*
* Subclasses of this abstract class generate makefiles, DSP, etc for various
- * platforms. This class should never be constructued directly. A
+ * platforms. This class should never be constructed directly. A
* GlobalGenerator will create it and invoke the appropriate commands on it.
*/
class cmLocalGenerator
@@ -33,19 +33,19 @@ class cmLocalGenerator
public:
cmLocalGenerator();
virtual ~cmLocalGenerator();
-
+
/**
- * Generate the makefile for this directory.
+ * Generate the makefile for this directory.
*/
virtual void Generate() {}
/**
* Process the CMakeLists files for this directory to fill in the
- * Makefile ivar
+ * Makefile ivar
*/
virtual void Configure();
- /**
+ /**
* Calls TraceVSDependencies() on all targets of this generator.
*/
virtual void TraceDependencies();
@@ -75,22 +75,24 @@ public:
///! Get the makefile for this generator
cmMakefile *GetMakefile() {
return this->Makefile; };
-
+
///! Get the makefile for this generator, const version
const cmMakefile *GetMakefile() const {
return this->Makefile; };
-
+
///! Get the GlobalGenerator this is associated with
cmGlobalGenerator *GetGlobalGenerator() {
return this->GlobalGenerator; };
+ const cmGlobalGenerator *GetGlobalGenerator() const {
+ return this->GlobalGenerator; };
///! Set the Global Generator, done on creation by the GlobalGenerator
void SetGlobalGenerator(cmGlobalGenerator *gg);
- /**
- * Convert something to something else. This is a centralized coversion
+ /**
+ * Convert something to something else. This is a centralized conversion
* routine used by the generators to handle relative paths and the like.
- * The flags determine what is actually done.
+ * The flags determine what is actually done.
*
* relative: treat the argument as a directory and convert it to make it
* relative or full or unchanged. If relative (HOME, START etc) then that
@@ -115,7 +117,7 @@ public:
* Get path for the specified relative root.
*/
const char* GetRelativeRootPath(RelativeRoot relroot);
-
+
/**
* Convert the given path to an output path that is optionally
* relative based on the cache option CMAKE_USE_RELATIVE_PATHS. The
@@ -124,14 +126,14 @@ public:
*/
std::string ConvertToOptionallyRelativeOutputPath(const char* remote);
- ///! set/get the parent generator
+ ///! set/get the parent generator
cmLocalGenerator* GetParent(){return this->Parent;}
void SetParent(cmLocalGenerator* g) { this->Parent = g; g->AddChild(this); }
///! set/get the children
void AddChild(cmLocalGenerator* g) { this->Children.push_back(g); }
std::vector<cmLocalGenerator*>& GetChildren() { return this->Children; };
-
+
void AddArchitectureFlags(std::string& flags, cmTarget* target,
const char *lang, const char* config);
@@ -141,6 +143,7 @@ public:
void AddSharedFlags(std::string& flags, const char* lang, bool shared);
void AddConfigVariableFlags(std::string& flags, const char* var,
const char* config);
+ ///! Append flags to a string.
virtual void AppendFlags(std::string& flags, const char* newFlags);
///! Get the include flags for the current makefile and language
const char* GetIncludeFlags(const char* lang,
@@ -177,11 +180,13 @@ public:
path and short path if spaces. */
std::string ConvertToOutputForExisting(RelativeRoot remote,
const char* local = 0);
-
+
+ virtual std::string ConvertToIncludeReference(std::string const& path);
+
/** Called from command-line hook to clear dependencies. */
- virtual void ClearDependencies(cmMakefile* /* mf */,
+ virtual void ClearDependencies(cmMakefile* /* mf */,
bool /* verbose */) {}
-
+
/** Called from command-line hook to update dependencies. */
virtual bool UpdateDependencies(const char* /* tgtInfo */,
bool /*verbose*/,
@@ -244,14 +249,22 @@ public:
/** Escape the given string as an argument in a CMake script. */
std::string EscapeForCMake(const char* str);
+ enum FortranFormat
+ {
+ FortranFormatNone,
+ FortranFormatFixed,
+ FortranFormatFree
+ };
+ FortranFormat GetFortranFormat(const char* value);
+
/** Return the directories into which object files will be put.
* There maybe more than one for fat binary systems like OSX.
*/
- virtual void
+ virtual void
GetTargetObjectFileDirectories(cmTarget* target,
- std::vector<std::string>&
+ std::vector<std::string>&
dirs);
-
+
/**
* Convert the given remote path to a relative path with respect to
* the given local path. The local path must be given in component
@@ -307,17 +320,17 @@ public:
std::string const& dir_max,
bool* hasSourceExtension = 0);
-protected:
/** Fill out these strings for the given target. Libraries to link,
* flags, and linkflags. */
- void GetTargetFlags(std::string& linkLibs,
+ void GetTargetFlags(std::string& linkLibs,
std::string& flags,
std::string& linkFlags,
cmTarget&target);
-
+
+protected:
///! put all the libraries for a target on into the given stream
virtual void OutputLinkLibraries(std::ostream&, cmTarget&, bool relink);
-
+
// Expand rule variables in CMake of the type found in language rules
void ExpandRuleVariables(std::string& string,
const RuleVariables& replaceValues);
@@ -329,13 +342,13 @@ protected:
void InsertRuleLauncher(std::string& s, cmTarget* target,
const char* prop);
-
- /** Convert a target to a utility target for unsupported
+
+ /** Convert a target to a utility target for unsupported
* languages of a generator */
void AddBuildTargetRule(const char* llang, cmTarget& target);
- ///! add a custom command to build a .o file that is part of a target
- void AddCustomCommandToCreateObject(const char* ofname,
- const char* lang,
+ ///! add a custom command to build a .o file that is part of a target
+ void AddCustomCommandToCreateObject(const char* ofname,
+ const char* lang,
cmSourceFile& source,
cmTarget& target);
// Create Custom Targets and commands for unsupported languages
@@ -359,7 +372,7 @@ protected:
std::string FindRelativePathTopBinary();
void SetupPathConversions();
- std::string ConvertToLinkReference(std::string const& lib);
+ virtual std::string ConvertToLinkReference(std::string const& lib);
/** Check whether the native build system supports the given
definition. Issues a warning. */
diff --git a/Source/cmLocalUnixMakefileGenerator3.cxx b/Source/cmLocalUnixMakefileGenerator3.cxx
index 5c2cda1..4e4f1d9 100644
--- a/Source/cmLocalUnixMakefileGenerator3.cxx
+++ b/Source/cmLocalUnixMakefileGenerator3.cxx
@@ -68,8 +68,6 @@ cmLocalUnixMakefileGenerator3::cmLocalUnixMakefileGenerator3()
this->ColorMakefile = false;
this->SkipPreprocessedSourceRules = false;
this->SkipAssemblySourceRules = false;
- this->NativeEchoCommand = "@echo ";
- this->NativeEchoWindows = true;
this->MakeCommandEscapeTargetTwice = false;
this->IsMakefileGenerator = true;
this->BorlandMakeCurlyHack = false;
@@ -610,6 +608,27 @@ cmLocalUnixMakefileGenerator3
}
//----------------------------------------------------------------------------
+std::string
+cmLocalUnixMakefileGenerator3
+::ConvertShellCommand(std::string const& cmd, RelativeRoot root)
+{
+ if(this->WatcomWMake &&
+ cmSystemTools::FileIsFullPath(cmd.c_str()) &&
+ cmd.find_first_of("( )") != cmd.npos)
+ {
+ // On Watcom WMake use the windows short path for the command
+ // name. This is needed to avoid funny quoting problems on
+ // lines with shell redirection operators.
+ std::string scmd;
+ if(cmSystemTools::GetShortPath(cmd.c_str(), scmd))
+ {
+ return this->Convert(scmd.c_str(), NONE, SHELL);
+ }
+ }
+ return this->Convert(cmd.c_str(), root, SHELL);
+}
+
+//----------------------------------------------------------------------------
void
cmLocalUnixMakefileGenerator3
::WriteMakeVariables(std::ostream& makefileStream)
@@ -648,13 +667,13 @@ cmLocalUnixMakefileGenerator3
makefileStream
<< "# The CMake executable.\n"
<< "CMAKE_COMMAND = "
- << this->Convert(cmakecommand.c_str(), FULL, SHELL).c_str()
+ << this->ConvertShellCommand(cmakecommand, FULL)
<< "\n"
<< "\n";
makefileStream
<< "# The command to remove a file.\n"
<< "RM = "
- << this->Convert(cmakecommand.c_str(),FULL,SHELL).c_str()
+ << this->ConvertShellCommand(cmakecommand, FULL)
<< " -E remove -f\n"
<< "\n";
@@ -664,7 +683,7 @@ cmLocalUnixMakefileGenerator3
makefileStream
<< "# The program to use to edit the cache.\n"
<< "CMAKE_EDIT_COMMAND = "
- << this->Convert(edit_cmd,FULL,SHELL) << "\n"
+ << this->ConvertShellCommand(edit_cmd, FULL) << "\n"
<< "\n";
}
@@ -699,7 +718,7 @@ cmLocalUnixMakefileGenerator3
// This should be the first target except for the default_target in
// the interface Makefile.
this->WriteMakeRule(
- makefileStream, "Disable implicit rules so canoncical targets will work.",
+ makefileStream, "Disable implicit rules so canonical targets will work.",
".SUFFIXES", no_depends, no_commands, false);
if(!this->NMake && !this->WatcomWMake && !this->BorlandMakeCurlyHack)
@@ -1021,22 +1040,9 @@ cmLocalUnixMakefileGenerator3
// without the current directory being in the search path.
cmd = "./" + cmd;
}
- if(this->WatcomWMake &&
- cmSystemTools::FileIsFullPath(cmd.c_str()) &&
- cmd.find(" ") != cmd.npos)
- {
- // On Watcom WMake use the windows short path for the command
- // name. This is needed to avoid funny quoting problems on
- // lines with shell redirection operators.
- std::string scmd;
- if(cmSystemTools::GetShortPath(cmd.c_str(), scmd))
- {
- cmd = scmd;
- }
- }
std::string launcher =
this->MakeLauncher(cc, target, workingDir? NONE : START_OUTPUT);
- cmd = launcher + this->Convert(cmd.c_str(),NONE,SHELL);
+ cmd = launcher + this->ConvertShellCommand(cmd, NONE);
ccg.AppendArguments(c, cmd);
if(content)
@@ -1235,9 +1241,8 @@ cmLocalUnixMakefileGenerator3::AppendEcho(std::vector<std::string>& commands,
if(color_name.empty())
{
// Use the native echo command.
- cmd = this->NativeEchoCommand;
- cmd += this->EscapeForShell(line.c_str(), false,
- this->NativeEchoWindows);
+ cmd = "@echo ";
+ cmd += this->EscapeForShell(line.c_str(), false, true);
}
else
{
@@ -1279,6 +1284,7 @@ cmLocalUnixMakefileGenerator3
// and there are no "." charactors in the string, then return the
// unmodified combination.
if((!this->MakefileVariableSize && unmodified.find('.') == s.npos)
+ && (!this->MakefileVariableSize && unmodified.find('+') == s.npos)
&& (!this->MakefileVariableSize && unmodified.find('-') == s.npos))
{
return unmodified;
@@ -1300,6 +1306,7 @@ cmLocalUnixMakefileGenerator3
{
cmSystemTools::ReplaceString(ret, ".", "_");
cmSystemTools::ReplaceString(ret, "-", "__");
+ cmSystemTools::ReplaceString(ret, "+", "___");
int ni = 0;
char buffer[5];
// make sure the _ version is not already used, if
@@ -1560,7 +1567,7 @@ cmLocalUnixMakefileGenerator3
// Create the scanner for this language
cmDepends *scanner = 0;
- if(lang == "C" || lang == "CXX" || lang == "RC")
+ if(lang == "C" || lang == "CXX" || lang == "RC" || lang == "ASM")
{
// TODO: Handle RC (resource files) dependencies correctly.
scanner = new cmDependsC(this, targetDir, lang.c_str(), &validDeps);
diff --git a/Source/cmLocalUnixMakefileGenerator3.h b/Source/cmLocalUnixMakefileGenerator3.h
index 9ff6e5e..45ac21d 100644
--- a/Source/cmLocalUnixMakefileGenerator3.h
+++ b/Source/cmLocalUnixMakefileGenerator3.h
@@ -38,21 +38,21 @@ public:
/**
* Process the CMakeLists files for this directory to fill in the
- * Makefile ivar
+ * Makefile ivar
*/
virtual void Configure();
/**
- * Generate the makefile for this directory.
+ * Generate the makefile for this directory.
*/
virtual void Generate();
-
+
// this returns the relative path between the HomeOutputDirectory and this
// local generators StartOutputDirectory
const std::string &GetHomeRelativeOutputPath();
- // Write out a make rule
+ // Write out a make rule
void WriteMakeRule(std::ostream& os,
const char* comment,
const char* target,
@@ -60,7 +60,7 @@ public:
const std::vector<std::string>& commands,
bool symbolic,
bool in_help = false);
-
+
// write the main variables used by the makefiles
void WriteMakeVariables(std::ostream& makefileStream);
@@ -71,7 +71,7 @@ public:
*/
void SetPassMakeflags(bool s){this->PassMakeflags = s;}
bool GetPassMakeflags() { return this->PassMakeflags; }
-
+
/**
* Set the flag used to keep the make program silent.
*/
@@ -115,7 +115,7 @@ public:
void SetDefineWindowsNULL(bool v) {this->DefineWindowsNULL = v;}
/**
- * If set to true, cd dir && command is used to
+ * If set to true, cd dir && command is used to
* run commands in a different directory.
*/
void SetUnixCD(bool v) {this->UnixCD = v;}
@@ -127,14 +127,6 @@ public:
void SetSilentNoColon(bool v) {this->SilentNoColon = v;}
/**
- * Set the command to use for native make shell echo. The value
- * should include all parts of the command up to the beginning of
- * the message (including a whitespace separator).
- */
- void SetNativeEchoCommand(const char* cmd, bool isWindows)
- { this->NativeEchoCommand = cmd; this->NativeEchoWindows = isWindows; }
-
- /**
* Set the string used to include one makefile into another default
* is include.
*/
@@ -169,15 +161,15 @@ public:
// used in writing out Cmake files such as WriteDirectoryInformation
static void WriteCMakeArgument(std::ostream& os, const char* s);
- /** creates the common disclainer text at the top of each makefile */
+ /** creates the common disclaimer text at the top of each makefile */
void WriteDisclaimer(std::ostream& os);
// write a comment line #====... in the stream
void WriteDivider(std::ostream& os);
/** used to create a recursive make call */
- std::string GetRecursiveMakeCall(const char *makefile, const char* tgt);
-
+ std::string GetRecursiveMakeCall(const char *makefile, const char* tgt);
+
// append flags to a string
virtual void AppendFlags(std::string& flags, const char* newFlags);
@@ -193,7 +185,7 @@ public:
virtual std::string GetTargetDirectory(cmTarget const& target) const;
// create a command that cds to the start dir then runs the commands
- void CreateCDCommand(std::vector<std::string>& commands,
+ void CreateCDCommand(std::vector<std::string>& commands,
const char *targetDir,
cmLocalGenerator::RelativeRoot returnDir);
@@ -208,7 +200,7 @@ public:
/** Called from command-line hook to clear dependencies. */
virtual void ClearDependencies(cmMakefile* mf, bool verbose);
-
+
/** write some extra rules such as make test etc */
void WriteSpecialTargetsTop(std::ostream& makefileStream);
void WriteSpecialTargetsBottom(std::ostream& makefileStream);
@@ -232,7 +224,7 @@ public:
// write the target rules for the local Makefile into the stream
void WriteLocalAllRules(std::ostream& ruleFileStream);
-
+
struct LocalObjectEntry
{
cmTarget* Target;
@@ -246,7 +238,7 @@ public:
bool HasSourceExtension;
bool HasPreprocessRule;
bool HasAssembleRule;
- LocalObjectInfo():HasSourceExtension(false), HasPreprocessRule(false),
+ LocalObjectInfo():HasSourceExtension(false), HasPreprocessRule(false),
HasAssembleRule(false) {}
};
std::map<cmStdString, LocalObjectInfo> const& GetLocalObjectFiles()
@@ -269,15 +261,15 @@ public:
void GetTargetObjectFileDirectories(cmTarget* target,
std::vector<std::string>& dirs);
- // Fill the vector with the target names for the object files,
- // preprocessed files and assembly files. Currently only used by the
+ // Fill the vector with the target names for the object files,
+ // preprocessed files and assembly files. Currently only used by the
// Eclipse generator.
void GetIndividualFileTargets(std::vector<std::string>& targets);
-
+
protected:
void WriteLocalMakefile();
-
-
+
+
// write the target rules for the local Makefile into the stream
void WriteLocalMakefileTargets(std::ostream& ruleFileStream,
std::set<cmStdString> &emitted);
@@ -286,17 +278,17 @@ protected:
void WriteDirectoryInformationFile();
- // write the depend info
+ // write the depend info
void WriteDependLanguageInfo(std::ostream& cmakefileStream, cmTarget &tgt);
-
+
// write the local help rule
void WriteHelpRule(std::ostream& ruleFileStream);
-
+
// this converts a file name that is relative to the StartOuputDirectory
// into a full path
std::string ConvertToFullPath(const std::string& localPath);
-
+
void WriteConvenienceRule(std::ostream& ruleFileStream,
const char* realTarget,
const char* helpTarget);
@@ -312,7 +304,7 @@ protected:
void WriteObjectConvenienceRule(std::ostream& ruleFileStream,
const char* comment, const char* output,
LocalObjectInfo const& info);
-
+
std::string GetObjectFileName(cmTarget& target,
const cmSourceFile& source,
std::string* nameWithoutTargetDir = 0,
@@ -348,6 +340,7 @@ protected:
void CheckMultipleOutputs(bool verbose);
private:
+ std::string ConvertShellCommand(std::string const& cmd, RelativeRoot root);
std::string MakeLauncher(const cmCustomCommand& cc, cmTarget* target,
RelativeRoot relative);
@@ -365,8 +358,6 @@ private:
std::string IncludeDirective;
std::string MakeSilentFlag;
std::string ConfigurationName;
- std::string NativeEchoCommand;
- bool NativeEchoWindows;
bool DefineWindowsNULL;
bool UnixCD;
bool PassMakeflags;
diff --git a/Source/cmLocalVisualStudio10Generator.cxx b/Source/cmLocalVisualStudio10Generator.cxx
index 1850c16..ef378f9 100644
--- a/Source/cmLocalVisualStudio10Generator.cxx
+++ b/Source/cmLocalVisualStudio10Generator.cxx
@@ -93,10 +93,18 @@ void cmLocalVisualStudio10Generator::Generate()
for(cmTargets::iterator l = tgts.begin(); l != tgts.end(); ++l)
{
- cmVisualStudio10TargetGenerator tg(
- &l->second, static_cast<cmGlobalVisualStudio10Generator*>(
- this->GetGlobalGenerator()));
- tg.Generate();
+ if(static_cast<cmGlobalVisualStudioGenerator*>(this->GlobalGenerator)
+ ->TargetIsFortranOnly(l->second))
+ {
+ this->CreateSingleVCProj(l->first.c_str(),l->second);
+ }
+ else
+ {
+ cmVisualStudio10TargetGenerator tg(
+ &l->second, static_cast<cmGlobalVisualStudio10Generator*>(
+ this->GetGlobalGenerator()));
+ tg.Generate();
+ }
}
this->WriteStampFiles();
}
diff --git a/Source/cmLocalVisualStudio7Generator.cxx b/Source/cmLocalVisualStudio7Generator.cxx
index 7a62b9c..ae70759 100644
--- a/Source/cmLocalVisualStudio7Generator.cxx
+++ b/Source/cmLocalVisualStudio7Generator.cxx
@@ -68,6 +68,27 @@ void cmLocalVisualStudio7Generator::AddHelperCommands()
lang.insert("DEF");
lang.insert("Fortran");
this->CreateCustomTargetsAndCommands(lang);
+
+ // Now create GUIDs for targets
+ cmTargets &tgts = this->Makefile->GetTargets();
+
+ cmGlobalVisualStudio7Generator* gg =
+ static_cast<cmGlobalVisualStudio7Generator *>(this->GlobalGenerator);
+ for(cmTargets::iterator l = tgts.begin(); l != tgts.end(); l++)
+ {
+ const char* path = l->second.GetProperty("EXTERNAL_MSPROJECT");
+ if(path)
+ {
+ this->ReadAndStoreExternalGUID(
+ l->second.GetName(), path);
+ }
+ else
+ {
+ gg->CreateGUID(l->first.c_str());
+ }
+ }
+
+
this->FixGlobalTargets();
}
@@ -309,6 +330,8 @@ cmVS7FlagTable cmLocalVisualStudio7GeneratorFortranFlagTable[] =
{
{"Preprocess", "fpp", "Run Preprocessor on files", "preprocessYes", 0},
{"SuppressStartupBanner", "nologo", "SuppressStartupBanner", "true", 0},
+ {"SourceFileFormat", "fixed", "Use Fixed Format", "fileFormatFixed", 0},
+ {"SourceFileFormat", "free", "Use Free Format", "fileFormatFree", 0},
{"DebugInformationFormat", "Zi", "full debug", "debugEnabled", 0},
{"DebugInformationFormat", "debug:full", "full debug", "debugEnabled", 0},
{"DebugInformationFormat", "Z7", "c7 compat", "debugOldStyleInfo", 0},
@@ -666,6 +689,16 @@ void cmLocalVisualStudio7Generator::WriteConfiguration(std::ostream& fout,
}
}
+ if(this->FortranProject)
+ {
+ switch(this->GetFortranFormat(target.GetProperty("Fortran_FORMAT")))
+ {
+ case FortranFormatFixed: flags += " -fixed"; break;
+ case FortranFormatFree: flags += " -free"; break;
+ default: break;
+ }
+ }
+
// Add the target-specific flags.
if(const char* targetFlags = target.GetProperty("COMPILE_FLAGS"))
{
@@ -825,6 +858,13 @@ void cmLocalVisualStudio7Generator::WriteConfiguration(std::ostream& fout,
tool = "VFMIDLTool";
}
fout << "\t\t\t<Tool\n\t\t\t\tName=\"" << tool << "\"\n";
+ fout << "\t\t\t\tAdditionalIncludeDirectories=\"";
+ for(i = includes.begin(); i != includes.end(); ++i)
+ {
+ std::string ipath = this->ConvertToXMLOutputPath(i->c_str());
+ fout << ipath << ";";
+ }
+ fout << "\"\n";
fout << "\t\t\t\tMkTypLibCompatible=\"FALSE\"\n";
if( this->PlatformName == "x64" )
{
@@ -1279,7 +1319,7 @@ void cmLocalVisualStudio7Generator::WriteVCProjFile(std::ostream& fout,
fout << "\t</Files>\n";
// Write the VCProj file's footer.
- this->WriteVCProjFooter(fout);
+ this->WriteVCProjFooter(fout, target);
}
struct cmLVS7GFileConfig
@@ -1333,6 +1373,21 @@ cmLocalVisualStudio7GeneratorFCInfo
fc.CompileFlags = cflags;
needfc = true;
}
+ if(lg->FortranProject)
+ {
+ switch(lg->GetFortranFormat(sf.GetProperty("Fortran_FORMAT")))
+ {
+ case cmLocalGenerator::FortranFormatFixed:
+ fc.CompileFlags = "-fixed " + fc.CompileFlags;
+ needfc = true;
+ break;
+ case cmLocalGenerator::FortranFormatFree:
+ fc.CompileFlags = "-free " + fc.CompileFlags;
+ needfc = true;
+ break;
+ default: break;
+ }
+ }
if(const char* cdefs = sf.GetProperty("COMPILE_DEFINITIONS"))
{
fc.CompileDefs = cdefs;
@@ -1541,8 +1596,15 @@ void cmLocalVisualStudio7Generator
!fc.CompileDefs.empty() ||
!fc.CompileDefsConfig.empty())
{
- Options fileOptions(this, this->Version, Options::Compiler,
- cmLocalVisualStudio7GeneratorFlagTable,
+ Options::Tool tool = Options::Compiler;
+ cmVS7FlagTable const* table =
+ cmLocalVisualStudio7GeneratorFlagTable;
+ if(this->FortranProject)
+ {
+ tool = Options::FortranCompiler;
+ table = cmLocalVisualStudio7GeneratorFortranFlagTable;
+ }
+ Options fileOptions(this, this->Version, tool, table,
this->ExtraFlagTable);
fileOptions.Parse(fc.CompileFlags.c_str());
fileOptions.AddDefines(fc.CompileDefs.c_str());
@@ -1622,6 +1684,10 @@ WriteCustomRule(std::ostream& fout,
}
std::string script = this->ConstructScript(command, i->c_str());
+ if(this->FortranProject)
+ {
+ cmSystemTools::ReplaceString(script, "$(Configuration)", i->c_str());
+ }
fout << "\t\t\t\t\t<Tool\n"
<< "\t\t\t\t\tName=\"" << customTool << "\"\n"
<< "\t\t\t\t\tDescription=\""
@@ -1745,11 +1811,18 @@ void cmLocalVisualStudio7Generator::WriteProjectSCC(std::ostream& fout,
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";
+
+ const char* vsAuxPath = target.GetProperty("VS_SCC_AUXPATH");
+ if(vsAuxPath)
+ {
+ fout << "\tSccAuxPath=\"" << vsAuxPath << "\"\n";
+ }
}
}
@@ -1770,14 +1843,14 @@ cmLocalVisualStudio7Generator
vskey += "\\Packages\\" CM_INTEL_PLUGIN_GUID ";ProductVersion";
cmSystemTools::ReadRegistryValue(vskey.c_str(), intelVersion,
cmSystemTools::KeyWOW64_32);
- if (intelVersion == "12.0")
+ if (intelVersion.find("12") == 0 || (intelVersion.find("11") == 0))
{
- // Version 12 actually uses 11.0 in project files!
+ // Version 11.x and 12.x actually use 11.0 in project files!
intelVersion = "11.0" ;
}
- else if(intelVersion == "10.1")
+ else if(intelVersion.find("10") == 0)
{
- // Version 10.1 actually uses 9.10 in project files!
+ // Version 10.x actually uses 9.10 in project files!
intelVersion = "9.10";
}
@@ -1880,10 +1953,28 @@ cmLocalVisualStudio7Generator::WriteProjectStart(std::ostream& fout,
}
-void cmLocalVisualStudio7Generator::WriteVCProjFooter(std::ostream& fout)
+void cmLocalVisualStudio7Generator::WriteVCProjFooter(std::ostream& fout,
+ cmTarget &target)
{
- fout << "\t<Globals>\n"
- << "\t</Globals>\n"
+ fout << "\t<Globals>\n";
+
+ cmPropertyMap const& props = target.GetProperties();
+ for(cmPropertyMap::const_iterator i = props.begin(); i != props.end(); ++i)
+ {
+ if(i->first.find("VS_GLOBAL_") == 0)
+ {
+ std::string name = i->first.substr(10);
+ if(name != "")
+ {
+ fout << "\t\t<Global\n"
+ << "\t\t\tName=\"" << name << "\"\n"
+ << "\t\t\tValue=\"" << i->second.GetValue() << "\"\n"
+ << "\t\t/>\n";
+ }
+ }
+ }
+
+ fout << "\t</Globals>\n"
<< "</VisualStudioProject>\n";
}
@@ -2003,29 +2094,6 @@ void cmLocalVisualStudio7Generator::ReadAndStoreExternalGUID(
}
-void cmLocalVisualStudio7Generator::ConfigureFinalPass()
-{
- cmLocalGenerator::ConfigureFinalPass();
- cmTargets &tgts = this->Makefile->GetTargets();
-
- cmGlobalVisualStudio7Generator* gg =
- static_cast<cmGlobalVisualStudio7Generator *>(this->GlobalGenerator);
- for(cmTargets::iterator l = tgts.begin(); l != tgts.end(); l++)
- {
- const char* path = l->second.GetProperty("EXTERNAL_MSPROJECT");
- if(path)
- {
- this->ReadAndStoreExternalGUID(
- l->second.GetName(), path);
- }
- else
- {
- gg->CreateGUID(l->first.c_str());
- }
- }
-
-}
-
//----------------------------------------------------------------------------
std::string cmLocalVisualStudio7Generator
::GetTargetDirectory(cmTarget const& target) const
diff --git a/Source/cmLocalVisualStudio7Generator.h b/Source/cmLocalVisualStudio7Generator.h
index 160e2d4..cdd714e 100644
--- a/Source/cmLocalVisualStudio7Generator.h
+++ b/Source/cmLocalVisualStudio7Generator.h
@@ -57,7 +57,6 @@ public:
void SetVersion8() {this->Version = 8;}
void SetVersion9() {this->Version = 9;}
void SetPlatformName(const char* n) { this->PlatformName = n;}
- virtual void ConfigureFinalPass();
void GetTargetObjectFileDirectories(cmTarget* target,
std::vector<std::string>&
dirs);
@@ -75,6 +74,8 @@ public:
virtual void ReadAndStoreExternalGUID(const char* name,
const char* path);
+protected:
+ void CreateSingleVCProj(const char *lname, cmTarget &tgt);
private:
typedef cmVisualStudioGeneratorOptions Options;
typedef cmLocalVisualStudio7GeneratorFCInfo FCInfo;
@@ -84,8 +85,7 @@ private:
void WriteProjectFiles();
void WriteVCProjHeader(std::ostream& fout, const char *libName,
cmTarget &tgt, std::vector<cmSourceGroup> &sgs);
- void WriteVCProjFooter(std::ostream& fout);
- void CreateSingleVCProj(const char *lname, cmTarget &tgt);
+ void WriteVCProjFooter(std::ostream& fout, cmTarget &target);
void WriteVCProjFile(std::ostream& fout, const char *libName,
cmTarget &tgt);
void WriteConfigurations(std::ostream& fout,
diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx
index 63bf03b..573c430 100644
--- a/Source/cmMakefile.cxx
+++ b/Source/cmMakefile.cxx
@@ -384,7 +384,9 @@ bool cmMakefile::ExecuteCommand(const cmListFileFunction& lff,
// Decide whether to invoke the command.
if(pcmd->GetEnabled() && !cmSystemTools::GetFatalErrorOccured() &&
- (!this->GetCMakeInstance()->GetScriptMode() || pcmd->IsScriptable()))
+ (this->GetCMakeInstance()->GetWorkingMode() != cmake::SCRIPT_MODE
+ || pcmd->IsScriptable()))
+
{
// if trace is one, print out invoke information
if(this->GetCMakeInstance()->GetTrace())
@@ -411,7 +413,7 @@ bool cmMakefile::ExecuteCommand(const cmListFileFunction& lff,
this->IssueMessage(cmake::FATAL_ERROR, pcmd->GetError());
}
result = false;
- if ( this->GetCMakeInstance()->GetScriptMode() )
+ if ( this->GetCMakeInstance()->GetWorkingMode() != cmake::NORMAL_MODE)
{
cmSystemTools::SetFatalErrorOccured();
}
@@ -422,7 +424,7 @@ bool cmMakefile::ExecuteCommand(const cmListFileFunction& lff,
this->UsedCommands.push_back(pcmd.release());
}
}
- else if ( this->GetCMakeInstance()->GetScriptMode()
+ else if ( this->GetCMakeInstance()->GetWorkingMode() == cmake::SCRIPT_MODE
&& !pcmd->IsScriptable() )
{
std::string error = "Command ";
@@ -1377,7 +1379,7 @@ void cmMakefile::AddLinkLibraryForTarget(const char *target,
{
cmOStringStream e;
e << "Target \"" << lib << "\" of type "
- << cmTarget::TargetTypeNames[static_cast<int>(tgt->GetType())]
+ << cmTarget::GetTargetTypeName(tgt->GetType())
<< " may not be linked into another target. "
<< "One may link only to STATIC or SHARED libraries, or "
<< "to executables with the ENABLE_EXPORTS property set.";
@@ -1759,6 +1761,10 @@ void cmMakefile::AddDefinition(const char* name, bool value)
void cmMakefile::CheckForUnusedVariables() const
{
+ if (!this->WarnUnused)
+ {
+ return;
+ }
const cmDefinitions& defs = this->Internal->VarStack.top();
const std::set<cmStdString>& locals = defs.LocalKeys();
std::set<cmStdString>::const_iterator it = locals.begin();
@@ -1882,7 +1888,7 @@ void cmMakefile::AddGlobalLinkInformation(const char* name, cmTarget& target)
}
-void cmMakefile::AddLibrary(const char* lname, cmTarget::TargetType type,
+cmTarget* cmMakefile::AddLibrary(const char* lname, cmTarget::TargetType type,
const std::vector<std::string> &srcs,
bool excludeFromAll)
{
@@ -1905,6 +1911,7 @@ void cmMakefile::AddLibrary(const char* lname, cmTarget::TargetType type,
}
target->AddSources(srcs);
this->AddGlobalLinkInformation(lname, *target);
+ return target;
}
cmTarget* cmMakefile::AddExecutable(const char *exeName,
@@ -3020,8 +3027,15 @@ cmCacheManager *cmMakefile::GetCacheManager() const
void cmMakefile::DisplayStatus(const char* message, float s)
{
- this->GetLocalGenerator()->GetGlobalGenerator()
- ->GetCMakeInstance()->UpdateProgress(message, s);
+ cmake* cm = this->GetLocalGenerator()->GetGlobalGenerator()
+ ->GetCMakeInstance();
+ if (cm->GetWorkingMode() == cmake::FIND_PACKAGE_MODE)
+ {
+ // don't output any STATUS message in FIND_PACKAGE_MODE, since they will
+ // directly be fed to the compiler, which will be confused.
+ return;
+ }
+ cm->UpdateProgress(message, s);
}
std::string cmMakefile::GetModulesFile(const char* filename)
@@ -3332,7 +3346,8 @@ void cmMakefile::SetProperty(const char* prop, const char* value)
this->Properties.SetProperty(prop,value,cmProperty::DIRECTORY);
}
-void cmMakefile::AppendProperty(const char* prop, const char* value)
+void cmMakefile::AppendProperty(const char* prop, const char* value,
+ bool asString)
{
if (!prop)
{
@@ -3365,7 +3380,7 @@ void cmMakefile::AppendProperty(const char* prop, const char* value)
return;
}
- this->Properties.AppendProperty(prop,value,cmProperty::DIRECTORY);
+ this->Properties.AppendProperty(prop,value,cmProperty::DIRECTORY,asString);
}
const char *cmMakefile::GetPropertyOrDefinition(const char* prop)
diff --git a/Source/cmMakefile.h b/Source/cmMakefile.h
index 1c1aef3..7c3e4ee 100644
--- a/Source/cmMakefile.h
+++ b/Source/cmMakefile.h
@@ -72,7 +72,7 @@ public:
/** Return whether compatibility features needed for a version of
the cache or lower should be enabled. */
bool NeedCacheCompatibility(int major, int minor);
-
+
/**
* Construct an empty makefile.
*/
@@ -87,8 +87,8 @@ public:
/**
* Read and parse a CMakeLists.txt file.
*/
- bool ReadListFile(const char* listfile,
- const char* external= 0,
+ bool ReadListFile(const char* listfile,
+ const char* external= 0,
std::string* fullPath= 0,
bool noPolicyScope = true);
@@ -121,21 +121,21 @@ public:
* Try running cmake and building a file. This is used for dynalically
* loaded commands, not as part of the usual build process.
*/
- int TryCompile(const char *srcdir, const char *bindir,
+ int TryCompile(const char *srcdir, const char *bindir,
const char *projectName, const char *targetName,
bool fast,
const std::vector<std::string> *cmakeArgs,
std::string *output);
-
+
/**
* Specify the makefile generator. This is platform/compiler
* dependent, although the interface is through a generic
* superclass.
*/
void SetLocalGenerator(cmLocalGenerator*);
-
+
///! Get the current makefile generator.
- cmLocalGenerator* GetLocalGenerator()
+ cmLocalGenerator* GetLocalGenerator()
{ return this->LocalGenerator;}
/**
@@ -153,15 +153,15 @@ public:
/**
* Perform FinalPass, Library dependency analysis etc before output of the
- * makefile.
+ * makefile.
*/
void ConfigureFinalPass();
-
+
/**
* run the final pass on all commands.
*/
void FinalPass();
-
+
/**
* Print the object state to std::cout.
*/
@@ -205,11 +205,11 @@ public:
cmTarget* AddImportedTarget(const char* name, cmTarget::TargetType type);
cmTarget* AddNewTarget(cmTarget::TargetType type, const char* name);
-
+
/**
* Add an executable to the build.
*/
- cmTarget* AddExecutable(const char *exename,
+ cmTarget* AddExecutable(const char *exename,
const std::vector<std::string> &srcs,
bool excludeFromAll = false);
@@ -237,7 +237,7 @@ public:
*/
void AddLinkLibrary(const char*);
void AddLinkLibrary(const char*, cmTarget::LinkLibraryType type);
- void AddLinkLibraryForTarget(const char *tgt, const char*,
+ void AddLinkLibraryForTarget(const char *tgt, const char*,
cmTarget::LinkLibraryType type);
void AddLinkDirectoryForTarget(const char *tgt, const char* d);
@@ -265,9 +265,9 @@ public:
/**
* Add a subdirectory to the build.
*/
- void AddSubDirectory(const char*, bool excludeFromAll=false,
+ void AddSubDirectory(const char*, bool excludeFromAll=false,
bool preorder = false);
- void AddSubDirectory(const char* fullSrcDir,const char *fullBinDir,
+ void AddSubDirectory(const char* fullSrcDir,const char *fullBinDir,
bool excludeFromAll, bool preorder,
bool immediate);
@@ -275,7 +275,7 @@ public:
* Configure a subdirectory
*/
void ConfigureSubDirectory(cmLocalGenerator *);
-
+
/**
* Add an include directory to the build.
*/
@@ -287,13 +287,13 @@ public:
*/
void AddDefinition(const char* name, const char* value);
///! Add a definition to this makefile and the global cmake cache.
- void AddCacheDefinition(const char* name, const char* value,
+ void AddCacheDefinition(const char* name, const char* value,
const char* doc,
cmCacheManager::CacheEntryType type,
bool force = false);
/**
- * Add bool variable definition to the build.
+ * Add bool variable definition to the build.
*/
void AddDefinition(const char* name, bool);
@@ -304,7 +304,7 @@ public:
void RemoveDefinition(const char* name);
///! Remove a definition from the cache.
void RemoveCacheDefinition(const char* name);
-
+
/**
* Specify the name of the project for this build.
*/
@@ -325,7 +325,7 @@ public:
/**
* Set the name of the library.
*/
- void AddLibrary(const char *libname, cmTarget::TargetType type,
+ cmTarget* AddLibrary(const char *libname, cmTarget::TargetType type,
const std::vector<std::string> &srcs,
bool excludeFromAll = false);
@@ -339,14 +339,14 @@ public:
* Add a source group for consideration when adding a new source.
* name is tokenized.
*/
- void AddSourceGroup(const std::vector<std::string>& name,
+ void AddSourceGroup(const std::vector<std::string>& name,
const char* regex=0);
#endif
//@{
/**
- * Set, Push, Pop policy values for CMake.
+ * Set, Push, Pop policy values for CMake.
*/
bool SetPolicy(cmPolicies::PolicyID id, cmPolicies::PolicyStatus status);
bool SetPolicy(const char *id, cmPolicies::PolicyStatus status);
@@ -374,31 +374,31 @@ public:
* Get the Policies Instance
*/
cmPolicies *GetPolicies();
-
+
/**
* Add an auxiliary directory to the build.
*/
void AddExtraDirectory(const char* dir);
-
+
/**
* Add an auxiliary directory to the build.
*/
void MakeStartDirectoriesCurrent()
{
- this->AddDefinition("CMAKE_CURRENT_SOURCE_DIR",
+ this->AddDefinition("CMAKE_CURRENT_SOURCE_DIR",
this->cmStartDirectory.c_str());
- this->AddDefinition("CMAKE_CURRENT_BINARY_DIR",
+ this->AddDefinition("CMAKE_CURRENT_BINARY_DIR",
this->StartOutputDirectory.c_str());
}
-
+
//@{
/**
* Set/Get the home directory (or output directory) in the project. The
* home directory is the top directory of the project. It is where
* CMakeSetup or configure was run. Remember that CMake processes
* CMakeLists files by recursing up the tree starting at the StartDirectory
- * and going up until it reaches the HomeDirectory.
+ * and going up until it reaches the HomeDirectory.
*/
void SetHomeDirectory(const char* dir);
const char* GetHomeDirectory() const
@@ -428,15 +428,15 @@ public:
* is the directory of the CMakeLists.txt file that started the current
* round of processing. Remember that CMake processes CMakeLists files by
* recursing up the tree starting at the StartDirectory and going up until
- * it reaches the HomeDirectory.
+ * it reaches the HomeDirectory.
*/
- void SetStartDirectory(const char* dir)
+ void SetStartDirectory(const char* dir)
{
this->cmStartDirectory = dir;
cmSystemTools::ConvertToUnixSlashes(this->cmStartDirectory);
- this->cmStartDirectory =
+ this->cmStartDirectory =
cmSystemTools::CollapseFullPath(this->cmStartDirectory.c_str());
- this->AddDefinition("CMAKE_CURRENT_SOURCE_DIR",
+ this->AddDefinition("CMAKE_CURRENT_SOURCE_DIR",
this->cmStartDirectory.c_str());
}
const char* GetStartDirectory() const
@@ -447,10 +447,10 @@ public:
{
this->StartOutputDirectory = lib;
cmSystemTools::ConvertToUnixSlashes(this->StartOutputDirectory);
- this->StartOutputDirectory =
+ this->StartOutputDirectory =
cmSystemTools::CollapseFullPath(this->StartOutputDirectory.c_str());
cmSystemTools::MakeDirectory(this->StartOutputDirectory.c_str());
- this->AddDefinition("CMAKE_CURRENT_BINARY_DIR",
+ this->AddDefinition("CMAKE_CURRENT_BINARY_DIR",
this->StartOutputDirectory.c_str());
}
const char* GetStartOutputDirectory() const
@@ -459,7 +459,7 @@ public:
}
//@}
- const char* GetCurrentDirectory() const
+ const char* GetCurrentDirectory() const
{
return this->cmStartDirectory.c_str();
}
@@ -478,7 +478,7 @@ public:
//@}
- /**
+ /**
* Set a regular expression that include files must match
* in order to be considered as part of the depend information.
*/
@@ -487,11 +487,11 @@ public:
this->IncludeFileRegularExpression = regex;
}
const char* GetIncludeRegularExpression()
- {
+ {
return this->IncludeFileRegularExpression.c_str();
}
- /**
+ /**
* Set a regular expression that include files that are not found
* must match in order to be considered a problem.
*/
@@ -523,11 +523,11 @@ public:
* Get a list of include directories in the build.
*/
std::vector<std::string>& GetIncludeDirectories()
- {
+ {
return this->IncludeDirectories;
}
const std::vector<std::string>& GetIncludeDirectories() const
- {
+ {
return this->IncludeDirectories;
}
void SetIncludeDirectories(const std::vector<std::string>& vec)
@@ -542,7 +542,7 @@ public:
bool IsSystemIncludeDirectory(const char* dir);
/** Expand out any arguements in the vector that have ; separated
- * strings into multiple arguements. A new vector is created
+ * strings into multiple arguements. A new vector is created
* containing the expanded versions of all arguments in argsIn.
* This method differes from the one in cmSystemTools in that if
* the CmakeLists file is version 1.2 or earlier it will check for
@@ -558,7 +558,7 @@ public:
cmSourceFile* GetSource(const char* sourceName);
/** Get a cmSourceFile pointer for a given source name, if the name is
- * not found, then create the source file and return it. generated
+ * not found, then create the source file and return it. generated
* indicates if it is a generated file, this is used in determining
* how to create the source file instance e.g. name
*/
@@ -597,8 +597,8 @@ public:
* variables will be listed.
*/
std::vector<std::string> GetDefinitions(int cacheonly=0) const;
-
- /** Test a boolean cache entry to see if it is true or false,
+
+ /** Test a boolean cache entry to see if it is true or false,
* returns false if no entry defined.
*/
bool IsOn(const char* name) const;
@@ -617,13 +617,13 @@ public:
* Make sure CMake can write this file
*/
bool CanIWriteThisFile(const char* fileName);
-
+
/**
* Get the vector of used command instances.
*/
const std::vector<cmCommand*>& GetUsedCommands() const
{return this->UsedCommands;}
-
+
#if defined(CMAKE_BUILD_WITH_CMAKE)
/**
* Get the vector source groups.
@@ -663,12 +663,12 @@ public:
{ return this->OutputFiles; }
void AddCMakeOutputFile(const char* file)
{ this->OutputFiles.push_back(file);}
-
+
/**
- * Expand all defined variables in the string.
+ * Expand all defined variables in the string.
* Defined variables come from the this->Definitions map.
* They are expanded with ${var} where var is the
- * entry in the this->Definitions map. Also @var@ is
+ * entry in the this->Definitions map. Also \@var\@ is
* expanded to match autoconf style expansions.
*/
const char *ExpandVariablesInString(std::string& source);
@@ -682,15 +682,15 @@ public:
/**
* Remove any remaining variables in the string. Anything with ${var} or
- * @var@ will be removed.
+ * \@var\@ will be removed.
*/
- void RemoveVariablesInString(std::string& source,
+ void RemoveVariablesInString(std::string& source,
bool atOnly = false) const;
/**
* Expand variables in the makefiles ivars such as link directories etc
*/
- void ExpandVariables();
+ void ExpandVariables();
/**
* Replace variables and #cmakedefine lines in the given string.
@@ -702,7 +702,7 @@ public:
/**
* Copy file but change lines acording to ConfigureString
*/
- int ConfigureFile(const char* infile, const char* outfile,
+ int ConfigureFile(const char* infile, const char* outfile,
bool copyonly, bool atOnly, bool escapeQuotes);
#if defined(CMAKE_BUILD_WITH_CMAKE)
@@ -717,12 +717,12 @@ public:
* Execute a single CMake command. Returns true if the command
* succeeded or false if it failed.
*/
- bool ExecuteCommand(const cmListFileFunction& lff,
+ bool ExecuteCommand(const cmListFileFunction& lff,
cmExecutionStatus &status);
/** Check if a command exists. */
bool CommandExists(const char* name) const;
-
+
/**
* Add a command to this cmake instance
*/
@@ -748,7 +748,7 @@ public:
///! Display progress or status message.
void DisplayStatus(const char*, float);
-
+
/**
* Expand the given list file arguments into the full set after
* variable replacement and list expansion.
@@ -757,13 +757,13 @@ public:
std::vector<std::string>& outArgs);
/**
* Get the instance
- */
+ */
cmake *GetCMakeInstance() const;
/**
* Get all the source files this makefile knows about
*/
- const std::vector<cmSourceFile*> &GetSourceFiles() const
+ const std::vector<cmSourceFile*> &GetSourceFiles() const
{return this->SourceFiles;}
std::vector<cmSourceFile*> &GetSourceFiles() {return this->SourceFiles;}
@@ -775,7 +775,7 @@ public:
/**
* Add a macro to the list of macros. The arguments should be name of the
- * macro and a documentation signature of it
+ * macro and a documentation signature of it
*/
void AddMacro(const char* name, const char* signature);
@@ -797,9 +797,9 @@ public:
*/
std::string GetModulesFile(const char* name);
- ///! Set/Get a property of this directory
+ ///! Set/Get a property of this directory
void SetProperty(const char *prop, const char *value);
- void AppendProperty(const char *prop, const char *value);
+ void AppendProperty(const char *prop, const char *value,bool asString=false);
const char *GetProperty(const char *prop);
const char *GetPropertyOrDefinition(const char *prop);
const char *GetProperty(const char *prop, cmProperty::ScopeType scope);
@@ -812,7 +812,7 @@ public:
///! Initialize a makefile from its parent
void InitializeFromParent();
-
+
///! Set/Get the preorder flag
void SetPreOrder(bool p) { this->PreOrder = p; }
bool GetPreOrder() const { return this->PreOrder; }
@@ -859,11 +859,11 @@ protected:
void CheckForUnused(const char* reason, const char* name) const;
std::string Prefix;
- std::vector<std::string> AuxSourceDirectories; //
+ std::vector<std::string> AuxSourceDirectories; //
- std::string cmStartDirectory;
- std::string StartOutputDirectory;
- std::string cmHomeDirectory;
+ std::string cmStartDirectory;
+ std::string StartOutputDirectory;
+ std::string cmHomeDirectory;
std::string HomeOutputDirectory;
std::string cmCurrentListFile;
@@ -875,7 +875,7 @@ protected:
// Tests
std::map<cmStdString, cmTest*> Tests;
-
+
// The include and link-library paths. These may have order
// dependency, so they must be vectors (not set).
std::vector<std::string> IncludeDirectories;
@@ -887,8 +887,8 @@ protected:
std::vector<std::string> ListFiles; // list of command files loaded
std::vector<std::string> OutputFiles; // list of command files loaded
-
-
+
+
cmTarget::LinkLibraryVectorType LinkLibraries;
std::vector<cmInstallGenerator*> InstallGenerators;
@@ -911,9 +911,9 @@ protected:
std::vector<cmCommand*> UsedCommands;
cmLocalGenerator* LocalGenerator;
- bool IsFunctionBlocked(const cmListFileFunction& lff,
+ bool IsFunctionBlocked(const cmListFileFunction& lff,
cmExecutionStatus &status);
-
+
private:
void Initialize();
@@ -923,10 +923,10 @@ private:
void ReadSources(std::ifstream& fin, bool t);
friend class cmMakeDepend; // make depend needs direct access
- // to the Sources array
- void PrintStringVector(const char* s, const
+ // to the Sources array
+ void PrintStringVector(const char* s, const
std::vector<std::pair<cmStdString, bool> >& v) const;
- void PrintStringVector(const char* s,
+ void PrintStringVector(const char* s,
const std::vector<std::string>& v) const;
void AddDefaultDefinitions();
@@ -954,7 +954,7 @@ private:
bool WarnUnused;
bool CheckSystemVars;
- // stack of list files being read
+ // stack of list files being read
std::deque<cmStdString> ListFileStack;
// stack of commands being invoked.
diff --git a/Source/cmMakefileTargetGenerator.cxx b/Source/cmMakefileTargetGenerator.cxx
index d0df8f0..8b91194 100644
--- a/Source/cmMakefileTargetGenerator.cxx
+++ b/Source/cmMakefileTargetGenerator.cxx
@@ -504,6 +504,35 @@ void cmMakefileTargetGenerator::WriteObjectRuleFiles(cmSourceFile& source)
//----------------------------------------------------------------------------
void
cmMakefileTargetGenerator
+::AppendFortranFormatFlags(std::string& flags, cmSourceFile& source)
+{
+ const char* srcfmt = source.GetProperty("Fortran_FORMAT");
+ cmLocalGenerator::FortranFormat format =
+ this->LocalGenerator->GetFortranFormat(srcfmt);
+ if(format == cmLocalGenerator::FortranFormatNone)
+ {
+ const char* tgtfmt = this->Target->GetProperty("Fortran_FORMAT");
+ format = this->LocalGenerator->GetFortranFormat(tgtfmt);
+ }
+ const char* var = 0;
+ switch (format)
+ {
+ case cmLocalGenerator::FortranFormatFixed:
+ var = "CMAKE_Fortran_FORMAT_FIXED_FLAG"; break;
+ case cmLocalGenerator::FortranFormatFree:
+ var = "CMAKE_Fortran_FORMAT_FREE_FLAG"; break;
+ default: break;
+ }
+ if(var)
+ {
+ this->LocalGenerator->AppendFlags(
+ flags, this->Makefile->GetDefinition(var));
+ }
+}
+
+//----------------------------------------------------------------------------
+void
+cmMakefileTargetGenerator
::WriteObjectBuildFile(std::string &obj,
const char *lang,
cmSourceFile& source,
@@ -562,6 +591,12 @@ cmMakefileTargetGenerator
}
}
+ // Add Fortran format flags.
+ if(strcmp(lang, "Fortran") == 0)
+ {
+ this->AppendFortranFormatFlags(flags, source);
+ }
+
// Add flags from source file properties.
if (source.GetProperty("COMPILE_FLAGS"))
{
diff --git a/Source/cmMakefileTargetGenerator.h b/Source/cmMakefileTargetGenerator.h
index b68f8bf..674cd13 100644
--- a/Source/cmMakefileTargetGenerator.h
+++ b/Source/cmMakefileTargetGenerator.h
@@ -112,6 +112,8 @@ protected:
// Return the a string with -F flags on apple
std::string GetFrameworkFlags();
+ void AppendFortranFormatFlags(std::string& flags, cmSourceFile& source);
+
// append intertarget dependencies
void AppendTargetDepends(std::vector<std::string>& depends);
diff --git a/Source/cmMarkAsAdvancedCommand.h b/Source/cmMarkAsAdvancedCommand.h
index 0a5eb9e..26e0a07 100644
--- a/Source/cmMarkAsAdvancedCommand.h
+++ b/Source/cmMarkAsAdvancedCommand.h
@@ -15,9 +15,9 @@
#include "cmCommand.h"
/** \class cmMarkAsAdvancedCommand
- * \brief MarkAsAdvanced a CMAKE variable
+ * \brief mark_as_advanced command
*
- * cmMarkAsAdvancedCommand sets a variable to a value with expansion.
+ * cmMarkAsAdvancedCommand implements the mark_as_advanced CMake command
*/
class cmMarkAsAdvancedCommand : public cmCommand
{
diff --git a/Source/cmProperty.cxx b/Source/cmProperty.cxx
index 166bd00..3b37cf3 100644
--- a/Source/cmProperty.cxx
+++ b/Source/cmProperty.cxx
@@ -19,10 +19,10 @@ void cmProperty::Set(const char *name, const char *value)
this->ValueHasBeenSet = true;
}
-void cmProperty::Append(const char *name, const char *value)
+void cmProperty::Append(const char *name, const char *value, bool asString)
{
this->Name = name;
- if(!this->Value.empty() && *value)
+ if(!this->Value.empty() && *value && !asString)
{
this->Value += ";";
}
diff --git a/Source/cmProperty.h b/Source/cmProperty.h
index 71bd1e7..e0fcd63 100644
--- a/Source/cmProperty.h
+++ b/Source/cmProperty.h
@@ -24,7 +24,7 @@ public:
void Set(const char *name, const char *value);
// append to this property
- void Append(const char *name, const char *value);
+ void Append(const char *name, const char *value, bool asString = false);
// get the value
const char *GetValue() const;
diff --git a/Source/cmPropertyMap.cxx b/Source/cmPropertyMap.cxx
index 052b811..a4d0bf3 100644
--- a/Source/cmPropertyMap.cxx
+++ b/Source/cmPropertyMap.cxx
@@ -59,7 +59,7 @@ void cmPropertyMap::SetProperty(const char *name, const char *value,
}
void cmPropertyMap::AppendProperty(const char* name, const char* value,
- cmProperty::ScopeType scope)
+ cmProperty::ScopeType scope, bool asString)
{
// Skip if nothing to append.
if(!name || !value || !*value)
@@ -81,7 +81,7 @@ void cmPropertyMap::AppendProperty(const char* name, const char* value,
#endif
cmProperty *prop = this->GetOrCreateProperty(name);
- prop->Append(name,value);
+ prop->Append(name,value,asString);
}
const char *cmPropertyMap
diff --git a/Source/cmPropertyMap.h b/Source/cmPropertyMap.h
index 02fb060..94275e2 100644
--- a/Source/cmPropertyMap.h
+++ b/Source/cmPropertyMap.h
@@ -25,7 +25,7 @@ public:
cmProperty::ScopeType scope);
void AppendProperty(const char* name, const char* value,
- cmProperty::ScopeType scope);
+ cmProperty::ScopeType scope, bool asString=false);
const char *GetPropertyValue(const char *name,
cmProperty::ScopeType scope,
diff --git a/Source/cmQtAutomoc.cxx b/Source/cmQtAutomoc.cxx
new file mode 100644
index 0000000..7a80f28
--- /dev/null
+++ b/Source/cmQtAutomoc.cxx
@@ -0,0 +1,815 @@
+/*============================================================================
+ CMake - Cross Platform Makefile Generator
+ Copyright 2004-2011 Kitware, Inc.
+ Copyright 2011 Alexander Neundorf (neundorf@kde.org)
+
+ 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 "cmGlobalGenerator.h"
+#include "cmLocalGenerator.h"
+#include "cmMakefile.h"
+#include "cmSourceFile.h"
+#include "cmSystemTools.h"
+
+# include <cmsys/Terminal.h>
+
+#include "cmQtAutomoc.h"
+
+
+cmQtAutomoc::cmQtAutomoc()
+:Verbose(cmsys::SystemTools::GetEnv("VERBOSE") != 0)
+,ColorOutput(true)
+,RunMocFailed(false)
+,GenerateAll(false)
+{
+
+ std::string colorEnv = "";
+ cmsys::SystemTools::GetEnv("COLOR", colorEnv);
+ if(!colorEnv.empty())
+ {
+ if(cmSystemTools::IsOn(colorEnv.c_str()))
+ {
+ this->ColorOutput = true;
+ }
+ else
+ {
+ this->ColorOutput = false;
+ }
+ }
+}
+
+
+void cmQtAutomoc::SetupAutomocTarget(cmTarget* target)
+{
+ cmMakefile* makefile = target->GetMakefile();
+ const char* targetName = target->GetName();
+ // don't do anything if there is no Qt4 or Qt5SrcTools (which contains moc):
+ std::string qtMajorVersion = makefile->GetSafeDefinition("QT_VERSION_MAJOR");
+ if (qtMajorVersion == "")
+ {
+ qtMajorVersion = makefile->GetSafeDefinition("Qt5SrcTools_VERSION_MAJOR");
+ }
+ if (qtMajorVersion != "4" && qtMajorVersion != "5")
+ {
+ return;
+ }
+
+ // create a custom target for running automoc at buildtime:
+ std::string automocTargetName = targetName;
+ automocTargetName += "_automoc";
+
+ std::string targetDir = makefile->GetCurrentOutputDirectory();
+ targetDir += makefile->GetCMakeInstance()->GetCMakeFilesDirectory();
+ targetDir += "/";
+ targetDir += automocTargetName;
+ targetDir += ".dir/";
+
+ cmCustomCommandLine currentLine;
+ currentLine.push_back(makefile->GetSafeDefinition("CMAKE_COMMAND"));
+ currentLine.push_back("-E");
+ currentLine.push_back("cmake_automoc");
+ currentLine.push_back(targetDir);
+
+ cmCustomCommandLines commandLines;
+ commandLines.push_back(currentLine);
+
+ std::string workingDirectory = cmSystemTools::CollapseFullPath(
+ "", makefile->GetCurrentOutputDirectory());
+
+ std::vector<std::string> depends;
+ std::string automocComment = "Automoc for target ";
+ automocComment += targetName;
+
+ makefile->AddUtilityCommand(automocTargetName.c_str(), true,
+ workingDirectory.c_str(), depends,
+ commandLines, false, automocComment.c_str());
+ target->AddUtility(automocTargetName.c_str());
+
+ // configure a file to get all information to automoc at buildtime:
+ std::string _moc_files;
+ std::string _moc_headers;
+ const char* sepFiles = "";
+ const char* sepHeaders = "";
+
+ const std::vector<cmSourceFile*>& srcFiles = target->GetSourceFiles();
+
+ for(std::vector<cmSourceFile*>::const_iterator fileIt = srcFiles.begin();
+ fileIt != srcFiles.end();
+ ++fileIt)
+ {
+ cmSourceFile* sf = *fileIt;
+ std::string absFile = sf->GetFullPath();
+ bool skip = cmSystemTools::IsOn(sf->GetPropertyForUser("SKIP_AUTOMOC"));
+ bool generated = cmSystemTools::IsOn(sf->GetPropertyForUser("GENERATED"));
+
+ if ((skip==false) && (generated == false))
+ {
+ std::string ext = sf->GetExtension();
+ cmSystemTools::FileFormat fileType = cmSystemTools::GetFileFormat(
+ ext.c_str());
+ if (fileType == cmSystemTools::CXX_FILE_FORMAT)
+ {
+ _moc_files += sepFiles;
+ _moc_files += absFile;
+ sepFiles = ";";
+ }
+ else if (fileType == cmSystemTools::HEADER_FILE_FORMAT)
+ {
+ _moc_headers += sepHeaders;
+ _moc_headers += absFile;
+ sepHeaders = ";";
+ }
+ }
+ }
+
+ const char* tmp = makefile->GetProperty("INCLUDE_DIRECTORIES");
+ std::string _moc_incs = (tmp!=0 ? tmp : "");
+ tmp = makefile->GetProperty("DEFINITIONS");
+ std::string _moc_defs = (tmp!=0 ? tmp : "");
+ tmp = makefile->GetProperty("COMPILE_DEFINITIONS");
+ std::string _moc_compile_defs = (tmp!=0 ? tmp : "");
+ tmp = target->GetProperty("AUTOMOC_MOC_OPTIONS");
+ std::string _moc_options = (tmp!=0 ? tmp : "");
+
+ // forget the variables added here afterwards again:
+ cmMakefile::ScopePushPop varScope(makefile);
+ static_cast<void>(varScope);
+
+ makefile->AddDefinition("_moc_target_name", automocTargetName.c_str());
+ makefile->AddDefinition("_moc_incs", _moc_incs.c_str());
+ makefile->AddDefinition("_moc_defs", _moc_defs.c_str());
+ makefile->AddDefinition("_moc_compile_defs", _moc_compile_defs.c_str());
+ makefile->AddDefinition("_moc_options", _moc_options.c_str());
+ makefile->AddDefinition("_moc_files", _moc_files.c_str());
+ makefile->AddDefinition("_moc_headers", _moc_headers.c_str());
+
+ const char* cmakeRoot = makefile->GetSafeDefinition("CMAKE_ROOT");
+ std::string inputFile = cmakeRoot;
+ inputFile += "/Modules/AutomocInfo.cmake.in";
+ std::string outputFile = targetDir;
+ outputFile += "/AutomocInfo.cmake";
+ makefile->ConfigureFile(inputFile.c_str(), outputFile.c_str(),
+ false, true, false);
+
+ std::string mocCppFile = makefile->GetCurrentOutputDirectory();
+ mocCppFile += "/";
+ mocCppFile += automocTargetName;
+ mocCppFile += ".cpp";
+ cmSourceFile* mocCppSource = makefile->GetOrCreateSource(mocCppFile.c_str(),
+ true);
+ target->AddSourceFile(mocCppSource);
+
+ makefile->AppendProperty("ADDITIONAL_MAKE_CLEAN_FILES",
+ mocCppFile.c_str(), false);
+}
+
+
+bool cmQtAutomoc::Run(const char* targetDirectory)
+{
+ cmake cm;
+ cmGlobalGenerator* gg = this->CreateGlobalGenerator(&cm, targetDirectory);
+ cmMakefile* makefile = gg->GetCurrentLocalGenerator()->GetMakefile();
+
+ this->ReadAutomocInfoFile(makefile, targetDirectory);
+ this->ReadOldMocDefinitionsFile(makefile, targetDirectory);
+
+ this->Init();
+
+ if (this->QtMajorVersion == "4" || this->QtMajorVersion == "5")
+ {
+ this->RunAutomoc();
+ }
+
+ this->WriteOldMocDefinitionsFile(targetDirectory);
+
+ delete gg;
+ gg = NULL;
+ makefile = NULL;
+ return true;
+}
+
+
+cmGlobalGenerator* cmQtAutomoc::CreateGlobalGenerator(cmake* cm,
+ const char* targetDirectory)
+{
+ cmGlobalGenerator* gg = new cmGlobalGenerator();
+ gg->SetCMakeInstance(cm);
+
+ cmLocalGenerator* lg = gg->CreateLocalGenerator();
+ lg->GetMakefile()->SetHomeOutputDirectory(targetDirectory);
+ lg->GetMakefile()->SetStartOutputDirectory(targetDirectory);
+ lg->GetMakefile()->SetHomeDirectory(targetDirectory);
+ lg->GetMakefile()->SetStartDirectory(targetDirectory);
+ gg->SetCurrentLocalGenerator(lg);
+
+ return gg;
+}
+
+
+bool cmQtAutomoc::ReadAutomocInfoFile(cmMakefile* makefile,
+ const char* targetDirectory)
+{
+ std::string filename(cmSystemTools::CollapseFullPath(targetDirectory));
+ cmSystemTools::ConvertToUnixSlashes(filename);
+ filename += "/AutomocInfo.cmake";
+
+ if (!makefile->ReadListFile(0, filename.c_str()))
+ {
+ cmSystemTools::Error("Error processing file:", filename.c_str());
+ return false;
+ }
+
+ this->QtMajorVersion = makefile->GetSafeDefinition("AM_QT_VERSION_MAJOR");
+ if (this->QtMajorVersion == "")
+ {
+ this->QtMajorVersion = makefile->GetSafeDefinition(
+ "AM_Qt5SrcTools_VERSION_MAJOR");
+ }
+ this->Sources = makefile->GetSafeDefinition("AM_SOURCES");
+ this->Headers = makefile->GetSafeDefinition("AM_HEADERS");
+ this->IncludeProjectDirsBefore = makefile->IsOn(
+ "AM_CMAKE_INCLUDE_DIRECTORIES_PROJECT_BEFORE");
+ this->Srcdir = makefile->GetSafeDefinition("AM_CMAKE_CURRENT_SOURCE_DIR");
+ this->Builddir = makefile->GetSafeDefinition("AM_CMAKE_CURRENT_BINARY_DIR");
+ this->MocExecutable = makefile->GetSafeDefinition("AM_QT_MOC_EXECUTABLE");
+ this->MocCompileDefinitionsStr = makefile->GetSafeDefinition(
+ "AM_MOC_COMPILE_DEFINITIONS");
+ this->MocDefinitionsStr = makefile->GetSafeDefinition("AM_MOC_DEFINITIONS");
+ this->MocIncludesStr = makefile->GetSafeDefinition("AM_MOC_INCLUDES");
+ this->MocOptionsStr = makefile->GetSafeDefinition("AM_MOC_OPTIONS");
+ this->ProjectBinaryDir = makefile->GetSafeDefinition("AM_CMAKE_BINARY_DIR");
+ this->ProjectSourceDir = makefile->GetSafeDefinition("AM_CMAKE_SOURCE_DIR");
+ this->TargetName = makefile->GetSafeDefinition("AM_TARGET_NAME");
+
+ return true;
+}
+
+
+bool cmQtAutomoc::ReadOldMocDefinitionsFile(cmMakefile* makefile,
+ const char* targetDirectory)
+{
+ std::string filename(cmSystemTools::CollapseFullPath(targetDirectory));
+ cmSystemTools::ConvertToUnixSlashes(filename);
+ filename += "/AutomocOldMocDefinitions.cmake";
+
+ if (makefile->ReadListFile(0, filename.c_str()))
+ {
+ this->OldMocDefinitionsStr =
+ makefile->GetSafeDefinition("AM_OLD_MOC_DEFINITIONS");
+ }
+ return true;
+}
+
+
+void cmQtAutomoc::WriteOldMocDefinitionsFile(const char* targetDirectory)
+{
+ std::string filename(cmSystemTools::CollapseFullPath(targetDirectory));
+ cmSystemTools::ConvertToUnixSlashes(filename);
+ filename += "/AutomocOldMocDefinitions.cmake";
+
+ std::fstream outfile;
+ outfile.open(filename.c_str(),
+ std::ios::out | std::ios::trunc);
+ outfile << "set(AM_OLD_MOC_DEFINITIONS \""
+ << this->Join(this->MocDefinitions, ' ') << "\")\n";
+
+ outfile.close();
+}
+
+
+void cmQtAutomoc::Init()
+{
+ this->OutMocCppFilename = this->Builddir;
+ this->OutMocCppFilename += this->TargetName;
+ this->OutMocCppFilename += ".cpp";
+
+ std::vector<std::string> cdefList;
+ cmSystemTools::ExpandListArgument(this->MocCompileDefinitionsStr, cdefList);
+ if (!cdefList.empty())
+ {
+ for(std::vector<std::string>::const_iterator it = cdefList.begin();
+ it != cdefList.end();
+ ++it)
+ {
+ this->MocDefinitions.push_back("-D" + (*it));
+ }
+ }
+ else
+ {
+ std::string tmpMocDefs = this->MocDefinitionsStr;
+ cmSystemTools::ReplaceString(tmpMocDefs, " ", ";");
+
+ std::vector<std::string> defList;
+ cmSystemTools::ExpandListArgument(tmpMocDefs, defList);
+
+ for(std::vector<std::string>::const_iterator it = defList.begin();
+ it != defList.end();
+ ++it)
+ {
+ if (this->StartsWith(*it, "-D"))
+ {
+ this->MocDefinitions.push_back(*it);
+ }
+ }
+ }
+
+ cmSystemTools::ExpandListArgument(this->MocOptionsStr, this->MocOptions);
+
+ std::vector<std::string> incPaths;
+ cmSystemTools::ExpandListArgument(this->MocIncludesStr, incPaths);
+
+ std::set<std::string> frameworkPaths;
+ for(std::vector<std::string>::const_iterator it = incPaths.begin();
+ it != incPaths.end();
+ ++it)
+ {
+ const std::string &path = *it;
+ this->MocIncludes.push_back("-I" + path);
+ if (this->EndsWith(path, ".framework/Headers"))
+ {
+ // Go up twice to get to the framework root
+ std::vector<std::string> pathComponents;
+ cmsys::SystemTools::SplitPath(path.c_str(), pathComponents);
+ std::string frameworkPath =cmsys::SystemTools::JoinPath(
+ pathComponents.begin(), pathComponents.end() - 2);
+ frameworkPaths.insert(frameworkPath);
+ }
+ }
+
+ for (std::set<std::string>::const_iterator it = frameworkPaths.begin();
+ it != frameworkPaths.end(); ++it)
+ {
+ this->MocIncludes.push_back("-F");
+ this->MocIncludes.push_back(*it);
+ }
+
+
+ if (this->IncludeProjectDirsBefore)
+ {
+ const std::string &binDir = "-I" + this->ProjectBinaryDir;
+
+ const std::string srcDir = "-I" + this->ProjectSourceDir;
+
+ std::list<std::string> sortedMocIncludes;
+ std::list<std::string>::iterator it = this->MocIncludes.begin();
+ while (it != this->MocIncludes.end())
+ {
+ if (this->StartsWith(*it, binDir))
+ {
+ sortedMocIncludes.push_back(*it);
+ it = this->MocIncludes.erase(it);
+ }
+ else
+ {
+ ++it;
+ }
+ }
+ it = this->MocIncludes.begin();
+ while (it != this->MocIncludes.end())
+ {
+ if (this->StartsWith(*it, srcDir))
+ {
+ sortedMocIncludes.push_back(*it);
+ it = this->MocIncludes.erase(it);
+ }
+ else
+ {
+ ++it;
+ }
+ }
+ sortedMocIncludes.insert(sortedMocIncludes.end(),
+ this->MocIncludes.begin(), this->MocIncludes.end());
+ this->MocIncludes = sortedMocIncludes;
+ }
+
+}
+
+
+bool cmQtAutomoc::RunAutomoc()
+{
+ if (!cmsys::SystemTools::FileExists(this->OutMocCppFilename.c_str())
+ || (this->OldMocDefinitionsStr != this->Join(this->MocDefinitions, ' ')))
+ {
+ this->GenerateAll = true;
+ }
+
+ // the program goes through all .cpp files to see which moc files are
+ // included. It is not really interesting how the moc file is named, but
+ // what file the moc is created from. Once a moc is included the same moc
+ // may not be included in the _automoc.cpp file anymore. OTOH if there's a
+ // header containing Q_OBJECT where no corresponding moc file is included
+ // anywhere a moc_<filename>.cpp file is created and included in
+ // the _automoc.cpp file.
+
+ // key = moc source filepath, value = moc output filepath
+ std::map<std::string, std::string> includedMocs;
+ // collect all headers which may need to be mocced
+ std::set<std::string> headerFiles;
+
+ std::vector<std::string> sourceFiles;
+ cmSystemTools::ExpandListArgument(this->Sources, sourceFiles);
+
+ for (std::vector<std::string>::const_iterator it = sourceFiles.begin();
+ it != sourceFiles.end();
+ ++it)
+ {
+ const std::string &absFilename = *it;
+ if (this->Verbose)
+ {
+ std::cout << "AUTOMOC: Checking " << absFilename << std::endl;
+ }
+ this->ParseCppFile(absFilename, includedMocs, headerFiles);
+ }
+
+ std::vector<std::string> headerFilesVec;
+ cmSystemTools::ExpandListArgument(this->Headers, headerFilesVec);
+ for (std::vector<std::string>::const_iterator it = headerFilesVec.begin();
+ it != headerFilesVec.end();
+ ++it)
+ {
+ headerFiles.insert(*it);
+ }
+
+ // key = moc source filepath, value = moc output filename
+ std::map<std::string, std::string> notIncludedMocs;
+ this->ParseHeaders(headerFiles, includedMocs, notIncludedMocs);
+
+ // run moc on all the moc's that are #included in source files
+ for(std::map<std::string, std::string>::const_iterator
+ it = includedMocs.begin();
+ it != includedMocs.end();
+ ++it)
+ {
+ this->GenerateMoc(it->first, it->second);
+ }
+
+ std::stringstream outStream(std::stringstream::out);
+ outStream << "/* This file is autogenerated, do not edit*/\n";
+
+ bool automocCppChanged = false;
+ if (notIncludedMocs.empty())
+ {
+ outStream << "enum some_compilers { need_more_than_nothing };\n";
+ }
+ else
+ {
+ // run moc on the remaining headers and include them in
+ // the _automoc.cpp file
+ for(std::map<std::string, std::string>::const_iterator
+ it = notIncludedMocs.begin();
+ it != notIncludedMocs.end();
+ ++it)
+ {
+ bool mocSuccess = this->GenerateMoc(it->first, it->second);
+ if (mocSuccess)
+ {
+ automocCppChanged = true;
+ }
+ outStream << "#include \"" << it->second << "\"\n";
+ }
+ }
+
+ if (this->RunMocFailed)
+ {
+ std::cerr << "returning failed.."<< std::endl;
+ return false;
+ }
+ outStream.flush();
+ std::string automocSource = outStream.str();
+ if (!automocCppChanged)
+ {
+ // compare contents of the _automoc.cpp file
+ const std::string oldContents = this->ReadAll(this->OutMocCppFilename);
+ if (oldContents == automocSource)
+ {
+ // nothing changed: don't touch the _automoc.cpp file
+ return true;
+ }
+ }
+
+ // source file that includes all remaining moc files (_automoc.cpp file)
+ std::fstream outfile;
+ outfile.open(this->OutMocCppFilename.c_str(),
+ std::ios::out | std::ios::trunc);
+ outfile << automocSource;
+ outfile.close();
+
+ return true;
+}
+
+
+void cmQtAutomoc::ParseCppFile(const std::string& absFilename,
+ std::map<std::string, std::string>& includedMocs,
+ std::set<std::string>& absHeaders)
+{
+ cmsys::RegularExpression mocIncludeRegExp(
+ "[\n][ \t]*#[ \t]*include[ \t]+"
+ "[\"<](([^ \">]+/)?moc_[^ \">/]+\\.cpp|[^ \">]+\\.moc)[\">]");
+ std::list<std::string> headerExtensions;
+ headerExtensions.push_back(".h");
+ headerExtensions.push_back(".hpp");
+ headerExtensions.push_back(".hxx");
+#if defined(_WIN32)
+ // not case sensitive, don't add ".H"
+#elif defined(__APPLE__)
+ // detect case-sensitive filesystem
+ long caseSensitive = pathconf(this->Srcdir.c_str(), _PC_CASE_SENSITIVE);
+ if (caseSensitive == 1)
+ {
+ headerExtensions.push_back(".H");
+ }
+#else
+ headerExtensions.push_back(".H");
+#endif
+
+ const std::string contentsString = this->ReadAll(absFilename);
+ if (contentsString.empty())
+ {
+ std::cerr << "AUTOMOC: empty source file: " << absFilename << std::endl;
+ return;
+ }
+ const std::string absPath = cmsys::SystemTools::GetFilenamePath(
+ cmsys::SystemTools::GetRealPath(absFilename.c_str())) + '/';
+
+ std::string::size_type matchOffset = 0;
+ if (mocIncludeRegExp.find(contentsString.c_str()))
+ {
+ // for every moc include in the file
+ do
+ {
+ const std::string currentMoc = mocIncludeRegExp.match(1);
+ //std::cout << "found moc include: " << currentMoc << std::endl;
+
+ std::string basename = cmsys::SystemTools::
+ GetFilenameWithoutLastExtension(currentMoc);
+ const bool moc_style = this->StartsWith(basename, "moc_");
+
+ // If the moc include is of the moc_foo.cpp style we expect
+ // the Q_OBJECT class declaration in a header file.
+ // If the moc include is of the foo.moc style we need to look for
+ // a Q_OBJECT macro in the current source file, if it contains the
+ // macro we generate the moc file from the source file.
+ // Q_OBJECT
+ if (moc_style)
+ {
+ // basename should be the part of the moc filename used for
+ // finding the correct header, so we need to remove the moc_ part
+ basename = basename.substr(4);
+
+ bool headerFound = false;
+ for(std::list<std::string>::const_iterator ext =
+ headerExtensions.begin();
+ ext != headerExtensions.end();
+ ++ext)
+ {
+ const std::string &sourceFilePath = absPath + basename + (*ext);
+ if (cmsys::SystemTools::FileExists(sourceFilePath.c_str()))
+ {
+ headerFound = true;
+ includedMocs[sourceFilePath] = currentMoc;
+ break;
+ }
+ }
+ if (!headerFound)
+ {
+ // the moc file is in a subdir => look for the header in the
+ // same subdir
+ if (currentMoc.find_first_of('/') != std::string::npos)
+ {
+ const std::string &filepath = absPath
+ + cmsys::SystemTools::GetFilenamePath(currentMoc)
+ + '/' + basename;
+
+ for(std::list<std::string>::const_iterator ext =
+ headerExtensions.begin();
+ ext != headerExtensions.end();
+ ++ext)
+ {
+ const std::string &sourceFilePath = filepath + (*ext);
+ if (cmsys::SystemTools::FileExists(sourceFilePath.c_str()))
+ {
+ headerFound = true;
+ includedMocs[sourceFilePath] = currentMoc;
+ break;
+ }
+ }
+ if (!headerFound)
+ {
+ std::cerr << "AUTOMOC: The file \"" << absFilename
+ << "\" includes the moc file \"" << currentMoc
+ << "\", but neither \"" << absPath << basename
+ << '{' << this->Join(headerExtensions, ',')
+ << "}\" nor \"" << filepath << '{'
+ << this->Join(headerExtensions, ',') << '}'
+ << "\" exist." << std::endl;
+ ::exit(EXIT_FAILURE);
+ }
+ }
+ else
+ {
+ std::cerr << "AUTOMOC: The file \"" << absFilename
+ << "\" includes the moc file \"" << currentMoc
+ << "\", but \"" << absPath << basename << '{'
+ << this->Join(headerExtensions, ',') << '}'
+ << "\" does not exist." << std::endl;
+ ::exit(EXIT_FAILURE);
+ }
+ }
+ }
+ else
+ {
+ includedMocs[absFilename] = currentMoc;
+ }
+ matchOffset += mocIncludeRegExp.end();
+ } while(mocIncludeRegExp.find(contentsString.c_str() + matchOffset));
+ }
+
+ // search for header files and private header files we may need to moc:
+ const std::string basename =
+ cmsys::SystemTools::GetFilenameWithoutLastExtension(absFilename);
+ for(std::list<std::string>::const_iterator ext = headerExtensions.begin();
+ ext != headerExtensions.end();
+ ++ext)
+ {
+ const std::string headerName = absPath + basename + (*ext);
+ if (cmsys::SystemTools::FileExists(headerName.c_str()))
+ {
+ absHeaders.insert(headerName);
+ break;
+ }
+ }
+ for(std::list<std::string>::const_iterator ext = headerExtensions.begin();
+ ext != headerExtensions.end();
+ ++ext)
+ {
+ const std::string privateHeaderName = absPath+basename+"_p"+(*ext);
+ if (cmsys::SystemTools::FileExists(privateHeaderName.c_str()))
+ {
+ absHeaders.insert(privateHeaderName);
+ break;
+ }
+ }
+
+}
+
+
+void cmQtAutomoc::ParseHeaders(const std::set<std::string>& absHeaders,
+ const std::map<std::string, std::string>& includedMocs,
+ std::map<std::string, std::string>& notIncludedMocs)
+{
+ cmsys::RegularExpression qObjectRegExp("[\n][ \t]*Q_OBJECT[^a-zA-Z0-9_]");
+ for(std::set<std::string>::const_iterator hIt=absHeaders.begin();
+ hIt!=absHeaders.end();
+ ++hIt)
+ {
+ const std::string& headerName = *hIt;
+
+ if (includedMocs.find(headerName) == includedMocs.end())
+ {
+ if (this->Verbose)
+ {
+ std::cout << "AUTOMOC: Checking " << headerName << std::endl;
+ }
+
+ const std::string basename = cmsys::SystemTools::
+ GetFilenameWithoutLastExtension(headerName);
+
+ const std::string currentMoc = "moc_" + basename + ".cpp";
+ const std::string contents = this->ReadAll(headerName);
+ if (qObjectRegExp.find(contents))
+ {
+ //std::cout << "header contains Q_OBJECT macro";
+ notIncludedMocs[headerName] = currentMoc;
+ }
+ }
+ }
+
+}
+
+
+bool cmQtAutomoc::GenerateMoc(const std::string& sourceFile,
+ const std::string& mocFileName)
+{
+ const std::string mocFilePath = this->Builddir + mocFileName;
+ int sourceNewerThanMoc = 0;
+ bool success = cmsys::SystemTools::FileTimeCompare(sourceFile.c_str(),
+ mocFilePath.c_str(),
+ &sourceNewerThanMoc);
+ if (this->GenerateAll || !success || sourceNewerThanMoc >= 0)
+ {
+ // make sure the directory for the resulting moc file exists
+ std::string mocDir = mocFilePath.substr(0, mocFilePath.rfind('/'));
+ if (!cmsys::SystemTools::FileExists(mocDir.c_str(), false))
+ {
+ cmsys::SystemTools::MakeDirectory(mocDir.c_str());
+ }
+
+ std::string msg = "Generating ";
+ msg += mocFileName;
+ cmSystemTools::MakefileColorEcho(cmsysTerminal_Color_ForegroundBlue
+ |cmsysTerminal_Color_ForegroundBold,
+ msg.c_str(), true, this->ColorOutput);
+
+ std::vector<cmStdString> command;
+ command.push_back(this->MocExecutable);
+ for (std::list<std::string>::const_iterator it = this->MocIncludes.begin();
+ it != this->MocIncludes.end();
+ ++it)
+ {
+ command.push_back(*it);
+ }
+ for(std::list<std::string>::const_iterator it=this->MocDefinitions.begin();
+ it != this->MocDefinitions.end();
+ ++it)
+ {
+ command.push_back(*it);
+ }
+ for(std::vector<std::string>::const_iterator it=this->MocOptions.begin();
+ it != this->MocOptions.end();
+ ++it)
+ {
+ command.push_back(*it);
+ }
+#ifdef _WIN32
+ command.push_back("-DWIN32");
+#endif
+ command.push_back("-o");
+ command.push_back(mocFilePath);
+ command.push_back(sourceFile);
+
+ if (this->Verbose)
+ {
+ for(std::vector<cmStdString>::const_iterator cmdIt = command.begin();
+ cmdIt != command.end();
+ ++cmdIt)
+ {
+ std::cout << *cmdIt << " ";
+ }
+ std::cout << std::endl;
+ }
+
+ std::string output;
+ int retVal = 0;
+ bool result = cmSystemTools::RunSingleCommand(command, &output, &retVal);
+ if (!result || retVal)
+ {
+ std::cerr << "AUTOMOC: process for " << mocFilePath << " failed:\n"
+ << output << std::endl;
+ this->RunMocFailed = true;
+ cmSystemTools::RemoveFile(mocFilePath.c_str());
+ }
+ return true;
+ }
+ return false;
+}
+
+
+std::string cmQtAutomoc::Join(const std::list<std::string>& lst,char separator)
+{
+ if (lst.empty())
+ {
+ return "";
+ }
+
+ std::string result;
+ for (std::list<std::string>::const_iterator it = lst.begin();
+ it != lst.end();
+ ++it)
+ {
+ result += (*it) + separator;
+ }
+ result.erase(result.end() - 1);
+ return result;
+}
+
+
+bool cmQtAutomoc::StartsWith(const std::string& str, const std::string& with)
+{
+ return (str.substr(0, with.length()) == with);
+}
+
+
+bool cmQtAutomoc::EndsWith(const std::string& str, const std::string& with)
+{
+ if (with.length() > (str.length()))
+ {
+ return false;
+ }
+ return (str.substr(str.length() - with.length(), with.length()) == with);
+}
+
+
+std::string cmQtAutomoc::ReadAll(const std::string& filename)
+{
+ std::ifstream file(filename.c_str());
+ std::stringstream stream;
+ stream << file.rdbuf();
+ file.close();
+ return stream.str();
+}
diff --git a/Source/cmQtAutomoc.h b/Source/cmQtAutomoc.h
new file mode 100644
index 0000000..f6355de
--- /dev/null
+++ b/Source/cmQtAutomoc.h
@@ -0,0 +1,84 @@
+/*============================================================================
+ CMake - Cross Platform Makefile Generator
+ Copyright 2004-2011 Kitware, Inc.
+ Copyright 2011 Alexander Neundorf (neundorf@kde.org)
+
+ 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 cmQtAutomoc_h
+#define cmQtAutomoc_h
+
+class cmGlobalGenerator;
+class cmMakefile;
+
+class cmQtAutomoc
+{
+public:
+ cmQtAutomoc();
+ bool Run(const char* targetDirectory);
+
+ void SetupAutomocTarget(cmTarget* target);
+
+private:
+ cmGlobalGenerator* CreateGlobalGenerator(cmake* cm,
+ const char* targetDirectory);
+
+ bool ReadAutomocInfoFile(cmMakefile* makefile,
+ const char* targetDirectory);
+ bool ReadOldMocDefinitionsFile(cmMakefile* makefile,
+ const char* targetDirectory);
+ void WriteOldMocDefinitionsFile(const char* targetDirectory);
+
+ bool RunAutomoc();
+ bool GenerateMoc(const std::string& sourceFile,
+ const std::string& mocFileName);
+ void ParseCppFile(const std::string& absFilename,
+ std::map<std::string, std::string>& includedMocs,
+ std::set<std::string>& absHeaders);
+ void ParseHeaders(const std::set<std::string>& absHeaders,
+ const std::map<std::string, std::string>& includedMocs,
+ std::map<std::string, std::string>& notIncludedMocs);
+
+ void Init();
+
+ std::string Join(const std::list<std::string>& lst, char separator);
+ bool EndsWith(const std::string& str, const std::string& with);
+ bool StartsWith(const std::string& str, const std::string& with);
+ std::string ReadAll(const std::string& filename);
+
+ std::string QtMajorVersion;
+ std::string Sources;
+ std::string Headers;
+ bool IncludeProjectDirsBefore;
+ std::string Srcdir;
+ std::string Builddir;
+ std::string MocExecutable;
+ std::string MocCompileDefinitionsStr;
+ std::string MocDefinitionsStr;
+ std::string MocIncludesStr;
+ std::string MocOptionsStr;
+ std::string ProjectBinaryDir;
+ std::string ProjectSourceDir;
+ std::string TargetName;
+
+ std::string OldMocDefinitionsStr;
+
+ std::string OutMocCppFilename;
+ std::list<std::string> MocIncludes;
+ std::list<std::string> MocDefinitions;
+ std::vector<std::string> MocOptions;
+
+ bool Verbose;
+ bool ColorOutput;
+ bool RunMocFailed;
+ bool GenerateAll;
+
+};
+
+#endif
diff --git a/Source/cmRemoveCommand.h b/Source/cmRemoveCommand.h
index 87c416f..bae2ee1 100644
--- a/Source/cmRemoveCommand.h
+++ b/Source/cmRemoveCommand.h
@@ -15,9 +15,9 @@
#include "cmCommand.h"
/** \class cmRemoveCommand
- * \brief Set a CMAKE variable
+ * \brief remove command
*
- * cmRemoveCommand sets a variable to a value with expansion.
+ * cmRemoveCommand implements the remove CMake command
*/
class cmRemoveCommand : public cmCommand
{
diff --git a/Source/cmSeparateArgumentsCommand.h b/Source/cmSeparateArgumentsCommand.h
index 10b3c40..736f066 100644
--- a/Source/cmSeparateArgumentsCommand.h
+++ b/Source/cmSeparateArgumentsCommand.h
@@ -15,9 +15,9 @@
#include "cmCommand.h"
/** \class cmSeparateArgumentsCommand
- * \brief SeparateArguments a CMAKE variable
+ * \brief separate_arguments command
*
- * cmSeparateArgumentsCommand sets a variable to a value with expansion.
+ * cmSeparateArgumentsCommand implements the separate_arguments CMake command
*/
class cmSeparateArgumentsCommand : public cmCommand
{
diff --git a/Source/cmSetPropertyCommand.cxx b/Source/cmSetPropertyCommand.cxx
index 3a4773c..cc10840 100644
--- a/Source/cmSetPropertyCommand.cxx
+++ b/Source/cmSetPropertyCommand.cxx
@@ -20,6 +20,7 @@
cmSetPropertyCommand::cmSetPropertyCommand()
{
this->AppendMode = false;
+ this->AppendAsString = false;
this->Remove = true;
}
@@ -83,6 +84,13 @@ bool cmSetPropertyCommand
{
doing = DoingNone;
this->AppendMode = true;
+ this->AppendAsString = false;
+ }
+ else if(*arg == "APPEND_STRING")
+ {
+ doing = DoingNone;
+ this->AppendMode = true;
+ this->AppendAsString = true;
}
else if(doing == DoingNames)
{
@@ -152,7 +160,7 @@ bool cmSetPropertyCommand::HandleGlobalMode()
}
if(this->AppendMode)
{
- cm->AppendProperty(name, value);
+ cm->AppendProperty(name, value, this->AppendAsString);
}
else
{
@@ -218,7 +226,7 @@ bool cmSetPropertyCommand::HandleDirectoryMode()
}
if(this->AppendMode)
{
- mf->AppendProperty(name, value);
+ mf->AppendProperty(name, value, this->AppendAsString);
}
else
{
@@ -266,7 +274,7 @@ bool cmSetPropertyCommand::HandleTarget(cmTarget* target)
}
if(this->AppendMode)
{
- target->AppendProperty(name, value);
+ target->AppendProperty(name, value, this->AppendAsString);
}
else
{
@@ -317,7 +325,7 @@ bool cmSetPropertyCommand::HandleSource(cmSourceFile* sf)
if(this->AppendMode)
{
- sf->AppendProperty(name, value);
+ sf->AppendProperty(name, value, this->AppendAsString);
}
else
{
@@ -377,7 +385,7 @@ bool cmSetPropertyCommand::HandleTest(cmTest* test)
}
if(this->AppendMode)
{
- test->AppendProperty(name, value);
+ test->AppendProperty(name, value, this->AppendAsString);
}
else
{
@@ -464,7 +472,7 @@ bool cmSetPropertyCommand::HandleCacheEntry(cmCacheManager::CacheIterator& it)
}
if(this->AppendMode)
{
- it.AppendProperty(name, value);
+ it.AppendProperty(name, value, this->AppendAsString);
}
else
{
diff --git a/Source/cmSetPropertyCommand.h b/Source/cmSetPropertyCommand.h
index c477bb7..3a0169e 100644
--- a/Source/cmSetPropertyCommand.h
+++ b/Source/cmSetPropertyCommand.h
@@ -56,7 +56,7 @@ public:
" SOURCE [src1 [src2 ...]] |\n"
" TEST [test1 [test2 ...]] |\n"
" CACHE [entry1 [entry2 ...]]>\n"
- " [APPEND]\n"
+ " [APPEND] [APPEND_STRING]\n"
" PROPERTY <name> [value1 [value2 ...]])\n"
"Set one property on zero or more objects of a scope. "
"The first argument determines the scope in which the property "
@@ -77,6 +77,9 @@ public:
"list. "
"If the APPEND option is given the list is appended to any "
"existing property value."
+ "If the APPEND_STRING option is given the string is append to any "
+ "existing property value as string, i.e. it results in a longer "
+ "string and not a list of strings."
;
}
@@ -93,6 +96,7 @@ private:
std::string PropertyValue;
bool Remove;
bool AppendMode;
+ bool AppendAsString;
// Implementation of each property type.
bool HandleGlobalMode();
diff --git a/Source/cmSetTargetPropertiesCommand.h b/Source/cmSetTargetPropertiesCommand.h
index 9e39401..f001a11 100644
--- a/Source/cmSetTargetPropertiesCommand.h
+++ b/Source/cmSetTargetPropertiesCommand.h
@@ -92,7 +92,7 @@ public:
"If not set here then it is set to target_EXPORTS by default "
"(with some substitutions if the target is not a valid C "
"identifier). This is useful for headers to know whether they are "
- "being included from inside their library our outside to properly "
+ "being included from inside their library or outside to properly "
"setup dllexport/dllimport decorations. "
"The COMPILE_FLAGS property sets additional compiler flags used "
"to build sources within the target. It may also be used to pass "
@@ -140,9 +140,14 @@ public:
"the target in an IDE like visual studio. VS_KEYWORD can be set "
"to change the visual studio keyword, for example QT integration "
"works better if this is set to Qt4VSv1.0.\n"
- "VS_SCC_PROJECTNAME, VS_SCC_LOCALPATH, VS_SCC_PROVIDER can be set "
+ "VS_SCC_PROJECTNAME, VS_SCC_LOCALPATH, VS_SCC_PROVIDER and "
+ "VS_SCC_AUXPATH can be set "
"to add support for source control bindings in a Visual Studio "
"project file.\n"
+ "VS_GLOBAL_<variable> can be set to add a Visual Studio "
+ "project-specific global variable. "
+ "Qt integration works better if VS_GLOBAL_QtVersion is set to "
+ "the Qt version FindQt4.cmake found. For example, \"4.7.3\"\n"
"The PRE_INSTALL_SCRIPT and POST_INSTALL_SCRIPT properties are the "
"old way to specify CMake scripts to run before and after "
"installing a target. They are used only when the old "
diff --git a/Source/cmSiteNameCommand.cxx b/Source/cmSiteNameCommand.cxx
index 7b80c5c..04e357c 100644
--- a/Source/cmSiteNameCommand.cxx
+++ b/Source/cmSiteNameCommand.cxx
@@ -63,7 +63,7 @@ bool cmSiteNameCommand
{
std::string host;
cmSystemTools::RunSingleCommand(hostname_cmd.c_str(),
- &host, 0, 0, false);
+ &host, 0, 0, cmSystemTools::OUTPUT_NONE);
// got the hostname
if (host.length())
diff --git a/Source/cmSiteNameCommand.h b/Source/cmSiteNameCommand.h
index 6357569..ac7f426 100644
--- a/Source/cmSiteNameCommand.h
+++ b/Source/cmSiteNameCommand.h
@@ -15,9 +15,9 @@
#include "cmCommand.h"
/** \class cmSiteNameCommand
- * \brief SiteName a CMAKE variable
+ * \brief site_name command
*
- * cmSiteNameCommand sets a variable to a value with expansion.
+ * cmSiteNameCommand implements the site_name CMake command
*/
class cmSiteNameCommand : public cmCommand
{
diff --git a/Source/cmSourceFile.cxx b/Source/cmSourceFile.cxx
index 42d3f06..cd94753 100644
--- a/Source/cmSourceFile.cxx
+++ b/Source/cmSourceFile.cxx
@@ -291,13 +291,15 @@ void cmSourceFile::SetProperty(const char* prop, const char* value)
}
//----------------------------------------------------------------------------
-void cmSourceFile::AppendProperty(const char* prop, const char* value)
+void cmSourceFile::AppendProperty(const char* prop, const char* value,
+ bool asString)
{
if (!prop)
{
return;
}
- this->Properties.AppendProperty(prop, value, cmProperty::SOURCE_FILE);
+ this->Properties.AppendProperty(prop, value, cmProperty::SOURCE_FILE,
+ asString);
}
//----------------------------------------------------------------------------
@@ -435,6 +437,15 @@ void cmSourceFile::DefineProperties(cmake *cm)
"It will still be linked into the target though.");
cm->DefineProperty
+ ("Fortran_FORMAT", cmProperty::SOURCE_FILE,
+ "Set to FIXED or FREE to indicate the Fortran source layout.",
+ "This property tells CMake whether a given Fortran source file "
+ "uses fixed-format or free-format. "
+ "CMake will pass the corresponding format flag to the compiler. "
+ "Consider using the target-wide Fortran_FORMAT property if all "
+ "source files in a target share the same format.");
+
+ cm->DefineProperty
("GENERATED", cmProperty::SOURCE_FILE,
"Is this source file generated as part of the build process.",
"If a source file is generated by the build process CMake will "
diff --git a/Source/cmSourceFile.h b/Source/cmSourceFile.h
index 2dc8488..55147e1 100644
--- a/Source/cmSourceFile.h
+++ b/Source/cmSourceFile.h
@@ -44,7 +44,7 @@ public:
///! Set/Get a property of this source file
void SetProperty(const char *prop, const char *value);
- void AppendProperty(const char* prop, const char* value);
+ void AppendProperty(const char* prop, const char* value,bool asString=false);
const char *GetProperty(const char *prop) const;
bool GetPropertyAsBool(const char *prop) const;
diff --git a/Source/cmSystemTools.cxx b/Source/cmSystemTools.cxx
index dbb2226..03364bd 100644
--- a/Source/cmSystemTools.cxx
+++ b/Source/cmSystemTools.cxx
@@ -12,7 +12,7 @@
#if defined(_MSC_VER) && _MSC_VER < 1300
# define _WIN32_WINNT 0x0400 /* for wincrypt.h */
#endif
-#include "cmSystemTools.h"
+#include "cmSystemTools.h"
#include <ctype.h>
#include <errno.h>
#include <time.h>
@@ -126,7 +126,7 @@ const char* cmSystemTools::GetWindows9xComspecSubstitute()
return cmSystemTools::s_Windows9xComspecSubstitute.c_str();
}
-void (*cmSystemTools::s_ErrorCallback)(const char*, const char*,
+void (*cmSystemTools::s_ErrorCallback)(const char*, const char*,
bool&, void*);
void (*cmSystemTools::s_StdoutCallback)(const char*, int len, void*);
void* cmSystemTools::s_ErrorCallbackClientData = 0;
@@ -144,7 +144,7 @@ void cmSystemTools::ExpandRegistryValues(std::string& source, KeyWOW64 view)
// a close square-bracket. The ']' character must be the first in the
// list of characters inside the [^...] block of the expression.
cmsys::RegularExpression regEntry("\\[(HKEY[^]]*)\\]");
-
+
// check for black line or comment
while (regEntry.find(source))
{
@@ -237,7 +237,7 @@ void cmSystemTools::Stdout(const char* s)
{
if(s_StdoutCallback)
{
- (*s_StdoutCallback)(s, static_cast<int>(strlen(s)),
+ (*s_StdoutCallback)(s, static_cast<int>(strlen(s)),
s_StdoutCallbackClientData);
}
else
@@ -247,6 +247,12 @@ void cmSystemTools::Stdout(const char* s)
}
}
+void cmSystemTools::Stderr(const char* s, int length)
+{
+ std::cerr.write(s, length);
+ std::cerr.flush();
+}
+
void cmSystemTools::Stdout(const char* s, int length)
{
if(s_StdoutCallback)
@@ -268,7 +274,7 @@ void cmSystemTools::Message(const char* m1, const char *title)
}
if(s_ErrorCallback)
{
- (*s_ErrorCallback)(m1, title, s_DisableMessages,
+ (*s_ErrorCallback)(m1, title, s_DisableMessages,
s_ErrorCallbackClientData);
return;
}
@@ -276,7 +282,7 @@ void cmSystemTools::Message(const char* m1, const char *title)
{
std::cerr << m1 << std::endl << std::flush;
}
-
+
}
@@ -311,7 +317,7 @@ bool cmSystemTools::IsOn(const char* val)
return false;
}
std::basic_string<char> v = val;
-
+
for(std::basic_string<char>::iterator c = v.begin();
c != v.end(); c++)
{
@@ -344,13 +350,13 @@ bool cmSystemTools::IsOff(const char* val)
return true;
}
std::basic_string<char> v = val;
-
+
for(std::basic_string<char>::iterator c = v.begin();
c != v.end(); c++)
{
*c = static_cast<char>(toupper(*c));
}
- return (v == "OFF" || v == "0" || v == "NO" || v == "FALSE" ||
+ return (v == "OFF" || v == "0" || v == "NO" || v == "FALSE" ||
v == "N" || cmSystemTools::IsNOTFOUND(v.c_str()) || v == "IGNORE");
}
@@ -569,15 +575,15 @@ std::vector<cmStdString> cmSystemTools::ParseArguments(const char* command)
args.push_back(arg);
}
}
-
+
return args;
}
bool cmSystemTools::RunSingleCommand(std::vector<cmStdString>const& command,
std::string* output ,
- int* retVal , const char* dir ,
- bool verbose ,
+ int* retVal , const char* dir ,
+ OutputOption outputflag ,
double timeout )
{
std::vector<const char*> argv;
@@ -599,46 +605,62 @@ bool cmSystemTools::RunSingleCommand(std::vector<cmStdString>const& command,
{
cmsysProcess_SetOption(cp, cmsysProcess_Option_HideWindow, 1);
}
+
cmsysProcess_SetTimeout(cp, timeout);
cmsysProcess_Execute(cp);
-
+
std::vector<char> tempOutput;
char* data;
int length;
- if ( output || verbose )
- {
- while(cmsysProcess_WaitForData(cp, &data, &length, 0))
+ int pipe;
+ if ( output || outputflag != OUTPUT_NONE )
{
- if(output || verbose)
+ while((pipe = cmsysProcess_WaitForData(cp, &data, &length, 0)) > 0)
{
- // Translate NULL characters in the output into valid text.
- // Visual Studio 7 puts these characters in the output of its
- // build process.
- for(int i=0; i < length; ++i)
+ if(output || outputflag != OUTPUT_NONE)
{
- if(data[i] == '\0')
+ // Translate NULL characters in the output into valid text.
+ // Visual Studio 7 puts these characters in the output of its
+ // build process.
+ for(int i=0; i < length; ++i)
{
- data[i] = ' ';
+ if(data[i] == '\0')
+ {
+ data[i] = ' ';
+ }
+ }
+ }
+ if ( output )
+ {
+ tempOutput.insert(tempOutput.end(), data, data+length);
+ }
+ if(outputflag != OUTPUT_NONE)
+ {
+ if(outputflag == OUTPUT_MERGE)
+ {
+ cmSystemTools::Stdout(data, length);
+ }
+ else
+ {
+ if(pipe == cmsysProcess_Pipe_STDERR)
+ {
+ cmSystemTools::Stderr(data, length);
+ }
+ else if(pipe == cmsysProcess_Pipe_STDOUT)
+ {
+ cmSystemTools::Stdout(data, length);
+ }
}
}
- }
- if ( output )
- {
- tempOutput.insert(tempOutput.end(), data, data+length);
- }
- if(verbose)
- {
- cmSystemTools::Stdout(data, length);
}
}
- }
-
+
cmsysProcess_WaitForExit(cp, 0);
if ( output && tempOutput.begin() != tempOutput.end())
{
output->append(&*tempOutput.begin(), tempOutput.size());
}
-
+
bool result = true;
if(cmsysProcess_GetState(cp) == cmsysProcess_State_Exited)
{
@@ -657,7 +679,7 @@ bool cmSystemTools::RunSingleCommand(std::vector<cmStdString>const& command,
else if(cmsysProcess_GetState(cp) == cmsysProcess_State_Exception)
{
const char* exception_str = cmsysProcess_GetExceptionString(cp);
- if ( verbose )
+ if ( outputflag != OUTPUT_NONE )
{
std::cerr << exception_str << std::endl;
}
@@ -670,7 +692,7 @@ bool cmSystemTools::RunSingleCommand(std::vector<cmStdString>const& command,
else if(cmsysProcess_GetState(cp) == cmsysProcess_State_Error)
{
const char* error_str = cmsysProcess_GetErrorString(cp);
- if ( verbose )
+ if ( outputflag != OUTPUT_NONE )
{
std::cerr << error_str << std::endl;
}
@@ -683,7 +705,7 @@ bool cmSystemTools::RunSingleCommand(std::vector<cmStdString>const& command,
else if(cmsysProcess_GetState(cp) == cmsysProcess_State_Expired)
{
const char* error_str = "Process terminated due to timeout\n";
- if ( verbose )
+ if ( outputflag != OUTPUT_NONE )
{
std::cerr << error_str << std::endl;
}
@@ -693,22 +715,22 @@ bool cmSystemTools::RunSingleCommand(std::vector<cmStdString>const& command,
}
result = false;
}
-
+
cmsysProcess_Delete(cp);
return result;
}
bool cmSystemTools::RunSingleCommand(
- const char* command,
+ const char* command,
std::string* output,
- int *retVal,
+ int *retVal,
const char* dir,
- bool verbose,
+ OutputOption outputflag,
double timeout)
{
if(s_DisableRunCommandOutput)
{
- verbose = false;
+ outputflag = OUTPUT_NONE;
}
std::vector<cmStdString> args = cmSystemTools::ParseArguments(command);
@@ -717,17 +739,17 @@ bool cmSystemTools::RunSingleCommand(
{
return false;
}
- return cmSystemTools::RunSingleCommand(args, output,retVal,
- dir, verbose, timeout);
+ return cmSystemTools::RunSingleCommand(args, output,retVal,
+ dir, outputflag, timeout);
}
-bool cmSystemTools::RunCommand(const char* command,
+bool cmSystemTools::RunCommand(const char* command,
std::string& output,
const char* dir,
bool verbose,
int timeout)
{
int dummy;
- return cmSystemTools::RunCommand(command, output, dummy,
+ return cmSystemTools::RunCommand(command, output, dummy,
dir, verbose, timeout);
}
@@ -742,11 +764,11 @@ bool RunCommandViaWin32(const char* command,
int timeout)
{
#if defined(__BORLANDC__)
- return
+ return
cmWin32ProcessExecution::
- BorlandRunCommand(command, dir, output,
- retVal,
- verbose, timeout,
+ BorlandRunCommand(command, dir, output,
+ retVal,
+ verbose, timeout,
cmSystemTools::GetRunCommandHideConsole());
#else // Visual studio
::SetLastError(ERROR_SUCCESS);
@@ -760,7 +782,7 @@ bool RunCommandViaWin32(const char* command,
{
resProc.SetHideWindows(true);
}
-
+
if ( cmSystemTools::GetWindows9xComspecSubstitute() )
{
resProc.SetConsoleSpawn(cmSystemTools::GetWindows9xComspecSubstitute() );
@@ -787,7 +809,7 @@ bool RunCommandViaSystem(const char* command,
std::string& output,
int& retVal,
bool verbose)
-{
+{
std::cout << "@@ " << command << std::endl;
std::string commandInDir;
@@ -987,9 +1009,9 @@ bool RunCommandViaPopen(const char* command,
// run a command unix uses popen (easy)
// windows uses system and ShortPath
-bool cmSystemTools::RunCommand(const char* command,
+bool cmSystemTools::RunCommand(const char* command,
std::string& output,
- int &retVal,
+ int &retVal,
const char* dir,
bool verbose,
int timeout)
@@ -998,7 +1020,7 @@ bool cmSystemTools::RunCommand(const char* command,
{
verbose = false;
}
-
+
#if defined(WIN32) && !defined(__CYGWIN__)
// if the command does not start with a quote, then
// try to find the program, and if the program can not be
@@ -1017,9 +1039,9 @@ bool cmSystemTools::RunCommand(const char* command,
{
break;
}
- }
+ }
}
- // if there are more than two double quotes use
+ // if there are more than two double quotes use
// GetShortPathName, the cmd.exe program in windows which
// is used by system fails to execute if there are more than
// one set of quotes in the arguments
@@ -1043,16 +1065,16 @@ bool cmSystemTools::RunCommand(const char* command,
shortCmd += " ";
shortCmd += args;
- //return RunCommandViaSystem(shortCmd.c_str(), dir,
+ //return RunCommandViaSystem(shortCmd.c_str(), dir,
// output, retVal, verbose);
- //return WindowsRunCommand(shortCmd.c_str(), dir,
+ //return WindowsRunCommand(shortCmd.c_str(), dir,
//output, retVal, verbose);
- return RunCommandViaWin32(shortCmd.c_str(), dir,
+ return RunCommandViaWin32(shortCmd.c_str(), dir,
output, retVal, verbose, timeout);
}
else
{
- cmSystemTools::Error("Could not parse command line with quotes ",
+ cmSystemTools::Error("Could not parse command line with quotes ",
command);
}
}
@@ -1116,7 +1138,7 @@ bool cmSystemTools::cmCopyFile(const char* source, const char* destination)
return Superclass::CopyFileAlways(source, destination);
}
-bool cmSystemTools::CopyFileIfDifferent(const char* source,
+bool cmSystemTools::CopyFileIfDifferent(const char* source,
const char* destination)
{
return Superclass::CopyFileIfDifferent(source, destination);
@@ -1247,7 +1269,7 @@ void cmSystemTools::Glob(const char *directory, const char *regexp,
{
cmsys::Directory d;
cmsys::RegularExpression reg(regexp);
-
+
if (d.Load(directory))
{
size_t numf;
@@ -1300,7 +1322,7 @@ void cmSystemTools::GlobDirs(const char *fullPath,
}
-void cmSystemTools::ExpandList(std::vector<std::string> const& arguments,
+void cmSystemTools::ExpandList(std::vector<std::string> const& arguments,
std::vector<std::string>& newargs)
{
std::vector<std::string>::const_iterator i;
@@ -1399,8 +1421,8 @@ void cmSystemTools::ExpandListArgument(const std::string& arg,
}
}
-bool cmSystemTools::SimpleGlob(const cmStdString& glob,
- std::vector<cmStdString>& files,
+bool cmSystemTools::SimpleGlob(const cmStdString& glob,
+ std::vector<cmStdString>& files,
int type /* = 0 */)
{
files.clear();
@@ -1440,8 +1462,8 @@ bool cmSystemTools::SimpleGlob(const cmStdString& glob,
{
continue;
}
- if ( sfname.size() >= ppath.size() &&
- sfname.substr(0, ppath.size()) ==
+ if ( sfname.size() >= ppath.size() &&
+ sfname.substr(0, ppath.size()) ==
ppath )
{
files.push_back(fname);
@@ -1461,10 +1483,10 @@ cmSystemTools::FileFormat cmSystemTools::GetFileFormat(const char* cext)
}
//std::string ext = cmSystemTools::LowerCase(cext);
std::string ext = cext;
- if ( ext == "c" || ext == ".c" ||
- ext == "m" || ext == ".m"
+ if ( ext == "c" || ext == ".c" ||
+ ext == "m" || ext == ".m"
) { return cmSystemTools::C_FILE_FORMAT; }
- if (
+ if (
ext == "C" || ext == ".C" ||
ext == "M" || ext == ".M" ||
ext == "c++" || ext == ".c++" ||
@@ -1473,22 +1495,22 @@ cmSystemTools::FileFormat cmSystemTools::GetFileFormat(const char* cext)
ext == "cxx" || ext == ".cxx" ||
ext == "mm" || ext == ".mm"
) { return cmSystemTools::CXX_FILE_FORMAT; }
- if (
+ if (
ext == "f" || ext == ".f" ||
ext == "F" || ext == ".F" ||
ext == "f77" || ext == ".f77" ||
ext == "f90" || ext == ".f90" ||
ext == "for" || ext == ".for" ||
- ext == "f95" || ext == ".f95"
+ ext == "f95" || ext == ".f95"
) { return cmSystemTools::FORTRAN_FILE_FORMAT; }
if ( ext == "java" || ext == ".java" )
{ return cmSystemTools::JAVA_FILE_FORMAT; }
- if (
- ext == "H" || ext == ".H" ||
- ext == "h" || ext == ".h" ||
+ if (
+ ext == "H" || ext == ".H" ||
+ ext == "h" || ext == ".h" ||
ext == "h++" || ext == ".h++" ||
- ext == "hm" || ext == ".hm" ||
- ext == "hpp" || ext == ".hpp" ||
+ ext == "hm" || ext == ".hm" ||
+ ext == "hpp" || ext == ".hpp" ||
ext == "hxx" || ext == ".hxx" ||
ext == "in" || ext == ".in" ||
ext == "txx" || ext == ".txx"
@@ -1501,18 +1523,18 @@ cmSystemTools::FileFormat cmSystemTools::GetFileFormat(const char* cext)
ext == "a" || ext == ".a")
{ return cmSystemTools::STATIC_LIBRARY_FILE_FORMAT; }
if ( ext == "o" || ext == ".o" ||
- ext == "obj" || ext == ".obj")
+ ext == "obj" || ext == ".obj")
{ return cmSystemTools::OBJECT_FILE_FORMAT; }
#ifdef __APPLE__
- if ( ext == "dylib" || ext == ".dylib" )
+ if ( ext == "dylib" || ext == ".dylib" )
{ return cmSystemTools::SHARED_LIBRARY_FILE_FORMAT; }
- if ( ext == "so" || ext == ".so" ||
- ext == "bundle" || ext == ".bundle" )
- { return cmSystemTools::MODULE_FILE_FORMAT; }
+ if ( ext == "so" || ext == ".so" ||
+ ext == "bundle" || ext == ".bundle" )
+ { return cmSystemTools::MODULE_FILE_FORMAT; }
#else // __APPLE__
- if ( ext == "so" || ext == ".so" ||
- ext == "sl" || ext == ".sl" ||
- ext == "dll" || ext == ".dll" )
+ if ( ext == "so" || ext == ".so" ||
+ ext == "sl" || ext == ".sl" ||
+ ext == "dll" || ext == ".dll" )
{ return cmSystemTools::SHARED_LIBRARY_FILE_FORMAT; }
#endif // __APPLE__
return cmSystemTools::UNKNOWN_FILE_FORMAT;
@@ -1708,7 +1730,7 @@ bool cmSystemTools::IsPathToFramework(const char* path)
return false;
}
-bool cmSystemTools::CreateTar(const char* outFileName,
+bool cmSystemTools::CreateTar(const char* outFileName,
const std::vector<cmStdString>& files,
bool gzip, bool bzip2, bool verbose)
{
@@ -1773,7 +1795,7 @@ namespace{
static time_t now;
size_t u_width = 6;
size_t gs_width = 13;
-
+
/*
* We avoid collecting the entire list in memory at once by
* listing things as we see them. However, that also means we can't
@@ -1788,7 +1810,7 @@ namespace{
fprintf(out, "%s %d ",
archive_entry_strmode(entry),
archive_entry_nlink(entry));
-
+
/* Use uname if it's present, else uid. */
p = archive_entry_uname(entry);
if ((p == NULL) || (*p == '\0'))
@@ -1809,7 +1831,7 @@ namespace{
{
fprintf(out, "%s", p);
w = strlen(p);
- }
+ }
else
{
sprintf(tmp, "%lu",
@@ -1817,20 +1839,20 @@ namespace{
w = strlen(tmp);
fprintf(out, "%s", tmp);
}
-
+
/*
* Print device number or file size, right-aligned so as to make
* total width of group and devnum/filesize fields be gs_width.
* If gs_width is too small, grow it.
*/
if (archive_entry_filetype(entry) == AE_IFCHR
- || archive_entry_filetype(entry) == AE_IFBLK)
+ || archive_entry_filetype(entry) == AE_IFBLK)
{
sprintf(tmp, "%lu,%lu",
(unsigned long)archive_entry_rdevmajor(entry),
(unsigned long)archive_entry_rdevminor(entry));
}
- else
+ else
{
/*
* Note the use of platform-dependent macros to format
@@ -1851,7 +1873,7 @@ namespace{
#define HALF_YEAR (time_t)365 * 86400 / 2
#if defined(_WIN32) && !defined(__CYGWIN__)
/* Windows' strftime function does not support %e format. */
-#define DAY_FMT "%d"
+#define DAY_FMT "%d"
#else
#define DAY_FMT "%e" /* Day number without leading zeros */
#endif
@@ -1881,15 +1903,15 @@ namespace{
#ifdef __BORLANDC__
# pragma warn -8066 /* unreachable code */
#endif
-
+
long copy_data(struct archive *ar, struct archive *aw)
{
long r;
const void *buff;
size_t size;
off_t offset;
-
- for (;;)
+
+ for (;;)
{
r = archive_read_data_block(ar, &buff, &size, &offset);
if (r == ARCHIVE_EOF)
@@ -1901,7 +1923,7 @@ long copy_data(struct archive *ar, struct archive *aw)
return (r);
}
r = archive_write_data_block(aw, buff, size, offset);
- if (r != ARCHIVE_OK)
+ if (r != ARCHIVE_OK)
{
cmSystemTools::Message("archive_write_data_block()",
archive_error_string(aw));
@@ -1911,7 +1933,7 @@ long copy_data(struct archive *ar, struct archive *aw)
return r;
}
-bool extract_tar(const char* outFileName, bool verbose,
+bool extract_tar(const char* outFileName, bool verbose,
bool extract)
{
struct archive* a = archive_read_new();
@@ -1921,12 +1943,12 @@ bool extract_tar(const char* outFileName, bool verbose,
struct archive_entry *entry;
int r = archive_read_open_file(a, outFileName, 10240);
if(r)
- {
+ {
cmSystemTools::Error("Problem with archive_read_open_file(): ",
archive_error_string(a));
return false;
}
- for (;;)
+ for (;;)
{
r = archive_read_next_header(a, &entry);
if (r == ARCHIVE_EOF)
@@ -1969,7 +1991,7 @@ bool extract_tar(const char* outFileName, bool verbose,
cmSystemTools::Error("Current file:",
archive_entry_pathname(entry));
}
- else
+ else
{
copy_data(a, ext);
r = archive_write_finish_entry(ext);
@@ -1991,9 +2013,9 @@ bool extract_tar(const char* outFileName, bool verbose,
}
}
-#endif
+#endif
-bool cmSystemTools::ExtractTar(const char* outFileName,
+bool cmSystemTools::ExtractTar(const char* outFileName,
bool , bool verbose)
{
#if defined(CMAKE_BUILD_WITH_CMAKE)
@@ -2005,7 +2027,7 @@ bool cmSystemTools::ExtractTar(const char* outFileName,
#endif
}
-bool cmSystemTools::ListTar(const char* outFileName,
+bool cmSystemTools::ListTar(const char* outFileName,
bool ,
bool verbose)
{
@@ -2121,8 +2143,8 @@ int cmSystemTools::WaitForLine(cmsysProcess* process, std::string& line,
}
void cmSystemTools::DoNotInheritStdPipes()
-{
-#ifdef _WIN32
+{
+#ifdef _WIN32
// Check to see if we are attached to a console
// if so, then do not stop the inherited pipes
// or stdout and stderr will not show up in dos
diff --git a/Source/cmSystemTools.h b/Source/cmSystemTools.h
index ce49959..641c89f 100644
--- a/Source/cmSystemTools.h
+++ b/Source/cmSystemTools.h
@@ -29,9 +29,9 @@ class cmSystemTools: public cmsys::SystemTools
{
public:
typedef cmsys::SystemTools Superclass;
-
+
/** Expand out any arguements in the vector that have ; separated
- * strings into multiple arguements. A new vector is created
+ * strings into multiple arguements. A new vector is created
* containing the expanded versions of all arguments in argsIn.
*/
static void ExpandList(std::vector<std::string> const& argsIn,
@@ -52,7 +52,7 @@ public:
typedef void (*ErrorCallback)(const char*, const char*, bool&, void*);
/**
* Set the function used by GUI's to display error messages
- * Function gets passed: message as a const char*,
+ * Function gets passed: message as a const char*,
* title as a const char*, and a reference to bool that when
* set to false, will disable furthur messages (cancel).
*/
@@ -75,10 +75,13 @@ public:
typedef void (*StdoutCallback)(const char*, int length, void*);
static void SetStdoutCallback(StdoutCallback, void* clientData=0);
+ ///! Send a string to stderr. Stdout callbacks will not be invoced.
+ static void Stderr(const char* s, int length);
+
///! Return true if there was an error at any point.
- static bool GetErrorOccuredFlag()
+ static bool GetErrorOccuredFlag()
{
- return cmSystemTools::s_ErrorOccured ||
+ return cmSystemTools::s_ErrorOccured ||
cmSystemTools::s_FatalErrorOccured;
}
///! If this is set to true, cmake stops processing commands.
@@ -91,7 +94,7 @@ public:
cmSystemTools::s_ErrorOccured = true;
}
///! Return true if there was an error at any point.
- static bool GetFatalErrorOccured()
+ static bool GetFatalErrorOccured()
{
return cmSystemTools::s_FatalErrorOccured;
}
@@ -102,25 +105,25 @@ public:
cmSystemTools::s_FatalErrorOccured = false;
cmSystemTools::s_ErrorOccured = false;
}
-
+
/**
* Does a string indicates that CMake/CPack/CTest internally
* forced this value. This is not the same as On, but this
* may be considered as "internally switched on".
*/
static bool IsInternallyOn(const char* val);
- /**
+ /**
* does a string indicate a true or on value ? This is not the same
- * as ifdef.
- */
+ * as ifdef.
+ */
static bool IsOn(const char* val);
-
- /**
+
+ /**
* does a string indicate a false or off value ? Note that this is
* not the same as !IsOn(...) because there are a number of
* ambiguous values such as "/usr/local/bin" a path will result in
* IsON and IsOff both returning false. Note that the special path
- * NOTFOUND, *-NOTFOUND or IGNORE will cause IsOff to return true.
+ * NOTFOUND, *-NOTFOUND or IGNORE will cause IsOff to return true.
*/
static bool IsOff(const char* val);
@@ -128,7 +131,7 @@ public:
static bool IsNOTFOUND(const char* value);
///! Return true if the path is a framework
static bool IsPathToFramework(const char* value);
-
+
static bool DoesFileExistWithExtensions(
const char *name,
const std::vector<std::string>& sourceExts);
@@ -154,13 +157,13 @@ public:
* want to find. 0 means all files, -1 means directories, 1 means
* files only. This method returns true if search was succesfull.
*/
- static bool SimpleGlob(const cmStdString& glob,
- std::vector<cmStdString>& files,
+ static bool SimpleGlob(const cmStdString& glob,
+ std::vector<cmStdString>& files,
int type = 0);
-
+
///! Copy a file.
static bool cmCopyFile(const char* source, const char* destination);
- static bool CopyFileIfDifferent(const char* source,
+ static bool CopyFileIfDifferent(const char* source,
const char* destination);
/** Rename a file or directory within a single disk volume (atomic
@@ -184,45 +187,53 @@ public:
* If timeout is specified, the command will be terminated after
* timeout expires.
*/
- static bool RunCommand(const char* command, std::string& output,
+ static bool RunCommand(const char* command, std::string& output,
const char* directory = 0,
bool verbose = true, int timeout = 0);
static bool RunCommand(const char* command, std::string& output,
- int &retVal, const char* directory = 0,
- bool verbose = true, int timeout = 0);
+ int &retVal, const char* directory = 0,
+ bool verbose = true, int timeout = 0);
/**
- * Run a single executable command and put the stdout and stderr
- * in output.
+ * Run a single executable command
*
- * If verbose is false, no user-viewable output from the program
- * being run will be generated.
+ * Output is controlled with outputflag. If outputflag is OUTPUT_NONE, no
+ * user-viewable output from the program being run will be generated.
+ * OUTPUT_MERGE is the legacy behaviour where stdout and stderr are merged
+ * into stdout. OUTPUT_NORMAL passes through the output to stdout/stderr as
+ * it was received.
*
* If timeout is specified, the command will be terminated after
* timeout expires. Timeout is specified in seconds.
*
* Argument retVal should be a pointer to the location where the
- * exit code will be stored. If the retVal is not specified and
- * the program exits with a code other than 0, then the this
+ * exit code will be stored. If the retVal is not specified and
+ * the program exits with a code other than 0, then the this
* function will return false.
*
* If the command has spaces in the path the caller MUST call
* cmSystemTools::ConvertToRunCommandPath on the command before passing
* it into this function or it will not work. The command must be correctly
- * escaped for this to with spaces.
+ * escaped for this to with spaces.
*/
+ enum OutputOption
+ {
+ OUTPUT_NONE = 0,
+ OUTPUT_MERGE,
+ OUTPUT_NORMAL
+ };
static bool RunSingleCommand(const char* command, std::string* output = 0,
- int* retVal = 0, const char* dir = 0,
- bool verbose = true,
+ int* retVal = 0, const char* dir = 0,
+ OutputOption outputflag = OUTPUT_MERGE,
double timeout = 0.0);
- /**
+ /**
* In this version of RunSingleCommand, command[0] should be
* the command to run, and each argument to the command should
* be in comand[1]...command[command.size()]
*/
static bool RunSingleCommand(std::vector<cmStdString> const& command,
std::string* output = 0,
- int* retVal = 0, const char* dir = 0,
- bool verbose = true,
+ int* retVal = 0, const char* dir = 0,
+ OutputOption outputflag = OUTPUT_MERGE,
double timeout = 0.0);
/**
@@ -295,7 +306,7 @@ public:
static const char* GetWindows9xComspecSubstitute();
/** Windows if this is true, the CreateProcess in RunCommand will
- * not show new consol windows when running programs.
+ * not show new consol windows when running programs.
*/
static void SetRunCommandHideConsole(bool v){s_RunCommandHideConsole = v;}
static bool GetRunCommandHideConsole(){ return s_RunCommandHideConsole;}
@@ -303,16 +314,16 @@ public:
* result of strerror(errno)
*/
static void ReportLastSystemError(const char* m);
-
+
/** a general output handler for cmsysProcess */
static int WaitForLine(cmsysProcess* process, std::string& line,
double timeout,
std::vector<char>& out,
std::vector<char>& err);
-
+
/** Split a string on its newlines into multiple lines. Returns
false only if the last line stored had no newline. */
- static bool Split(const char* s, std::vector<cmStdString>& l);
+ static bool Split(const char* s, std::vector<cmStdString>& l);
static void SetForceUnixPaths(bool v)
{
s_ForceUnixPaths = v;
@@ -327,14 +338,14 @@ public:
static void ConvertToOutputSlashes(std::string& path);
// ConvertToRunCommandPath does not use s_ForceUnixPaths and should
- // be used when RunCommand is called from cmake, because the
+ // be used when RunCommand is called from cmake, because the
// running cmake needs paths to be in its format
static std::string ConvertToRunCommandPath(const char* path);
//! Check if the first string ends with the second one.
static bool StringEndsWith(const char* str1, const char* str2);
-
- /** compute the relative path from local to remote. local must
- be a directory. remote can be a file or a directory.
+
+ /** compute the relative path from local to remote. local must
+ be a directory. remote can be a file or a directory.
Both remote and local must be full paths. Basically, if
you are in directory local and you want to access the file in remote
what is the relative path to do that. For example:
@@ -385,7 +396,7 @@ public:
static bool CreateTar(const char* outFileName,
const std::vector<cmStdString>& files, bool gzip,
bool bzip2, bool verbose);
- static bool ExtractTar(const char* inFileName, bool gzip,
+ static bool ExtractTar(const char* inFileName, bool gzip,
bool verbose);
// This should be called first thing in main
// it will keep child processes from inheriting the
diff --git a/Source/cmTarget.cxx b/Source/cmTarget.cxx
index 52b9072..dad0353 100644
--- a/Source/cmTarget.cxx
+++ b/Source/cmTarget.cxx
@@ -25,12 +25,35 @@
#include <queue>
#include <stdlib.h> // required for atof
#include <assert.h>
-const char* cmTarget::TargetTypeNames[] = {
- "EXECUTABLE", "STATIC_LIBRARY",
- "SHARED_LIBRARY", "MODULE_LIBRARY", "UTILITY", "GLOBAL_TARGET",
- "INSTALL_FILES", "INSTALL_PROGRAMS", "INSTALL_DIRECTORY",
- "UNKNOWN_LIBRARY"
-};
+
+const char* cmTarget::GetTargetTypeName(TargetType targetType)
+{
+ switch( targetType )
+ {
+ case cmTarget::STATIC_LIBRARY:
+ return "STATIC_LIBRARY";
+ case cmTarget::MODULE_LIBRARY:
+ return "MODULE_LIBRARY";
+ case cmTarget::SHARED_LIBRARY:
+ return "SHARED_LIBRARY";
+ case cmTarget::EXECUTABLE:
+ return "EXECUTABLE";
+ case cmTarget::UTILITY:
+ return "UTILITY";
+ case cmTarget::GLOBAL_TARGET:
+ return "GLOBAL_TARGET";
+ case cmTarget::INSTALL_FILES:
+ return "INSTALL_FILES";
+ case cmTarget::INSTALL_PROGRAMS:
+ return "INSTALL_PROGRAMS";
+ case cmTarget::INSTALL_DIRECTORY:
+ return "INSTALL_DIRECTORY";
+ case cmTarget::UNKNOWN_LIBRARY:
+ return "UNKNOWN_LIBRARY";
+ }
+ assert(0 && "Unexpected target type");
+ return 0;
+}
//----------------------------------------------------------------------------
struct cmTarget::OutputInfo
@@ -115,6 +138,41 @@ cmTarget::cmTarget()
void cmTarget::DefineProperties(cmake *cm)
{
cm->DefineProperty
+ ("AUTOMOC", cmProperty::TARGET,
+ "Should the target be processed with automoc (for Qt projects).",
+ "AUTOMOC is a boolean specifying whether CMake will handle "
+ "the Qt moc preprocessor automatically, i.e. without having to use "
+ "the QT4_WRAP_CPP() macro. Currently Qt4 is supported. "
+ "When this property is set to TRUE, CMake will scan the source files "
+ "at build time and invoke moc accordingly. "
+ "If an #include statement like #include \"moc_foo.cpp\" is found, "
+ "the Q_OBJECT class declaration is expected in the header, and moc is "
+ "run on the header file. "
+ "If an #include statement like #include \"foo.moc\" is found, "
+ "then a Q_OBJECT is expected in the current source file and moc "
+ "is run on the file itself. "
+ "Additionally, all header files are parsed for Q_OBJECT macros, "
+ "and if found, moc is also executed on those files. The resulting "
+ "moc files, which are not included as shown above in any of the source "
+ "files are included in a generated <targetname>_automoc.cpp file, "
+ "which is compiled as part of the target."
+ "This property is initialized by the value of the variable "
+ "CMAKE_AUTOMOC if it is set when a target is created.\n"
+ "Additional command line options for moc can be set via the "
+ "AUTOMOC_MOC_OPTIONS property."
+ );
+
+ cm->DefineProperty
+ ("AUTOMOC_MOC_OPTIONS", cmProperty::TARGET,
+ "Additional options for moc when using automoc (see the AUTOMOC property)",
+ "This property is only used if the AUTOMOC property is set to TRUE for "
+ "this target. In this case, it holds additional command line options "
+ "which will be used when moc is executed during the build, i.e. it is "
+ "equivalent to the optional OPTIONS argument of the qt4_wrap_cpp() "
+ "macro.\n"
+ "By default it is empty.");
+
+ cm->DefineProperty
("BUILD_WITH_INSTALL_RPATH", cmProperty::TARGET,
"Should build tree targets have install tree rpaths.",
"BUILD_WITH_INSTALL_RPATH is a boolean specifying whether to link "
@@ -597,6 +655,9 @@ void cmTarget::DefineProperties(cmake *cm)
"If the list is empty then no transitive link dependencies will be "
"incorporated when this target is linked into another target even if "
"the default set is non-empty. "
+ "This property is initialized by the value of the variable "
+ "CMAKE_LINK_INTERFACE_LIBRARIES if it is set when a target is "
+ "created. "
"This property is ignored for STATIC libraries.");
cm->DefineProperty
@@ -897,6 +958,17 @@ void cmTarget::DefineProperties(cmake *cm)
);
cm->DefineProperty
+ ("Fortran_FORMAT", cmProperty::TARGET,
+ "Set to FIXED or FREE to indicate the Fortran source layout.",
+ "This property tells CMake whether the Fortran source files "
+ "in a target use fixed-format or free-format. "
+ "CMake will pass the corresponding format flag to the compiler. "
+ "Use the source-specific Fortran_FORMAT property to change the "
+ "format of a specific source file. "
+ "If the variable CMAKE_Fortran_FORMAT is set when a target "
+ "is created its value is used to initialize this property.");
+
+ cm->DefineProperty
("Fortran_MODULE_DIRECTORY", cmProperty::TARGET,
"Specify output directory for Fortran modules provided by the target.",
"If the target contains Fortran source files that provide modules "
@@ -952,7 +1024,7 @@ void cmTarget::DefineProperties(cmake *cm)
"provider property.");
cm->DefineProperty
("VS_SCC_LOCALPATH", cmProperty::TARGET,
- "Visual Studio Source Code Control Provider.",
+ "Visual Studio Source Code Control Local Path.",
"Can be set to change the visual studio source code control "
"local path property.");
cm->DefineProperty
@@ -960,6 +1032,19 @@ void cmTarget::DefineProperties(cmake *cm)
"Visual Studio Source Code Control Project.",
"Can be set to change the visual studio source code control "
"project name property.");
+ cm->DefineProperty
+ ("VS_SCC_AUXPATH", cmProperty::TARGET,
+ "Visual Studio Source Code Control Aux Path.",
+ "Can be set to change the visual studio source code control "
+ "auxpath property.");
+ cm->DefineProperty
+ ("VS_GLOBAL_<variable>", cmProperty::TARGET,
+ "Visual Studio project-specific global variable.",
+ "Tell the Visual Studio generator to set the global variable "
+ "'<variable>' to a given value in the generated Visual Studio "
+ "project. Ignored on other generators. Qt integration works "
+ "better if VS_GLOBAL_QtVersion is set to the version "
+ "FindQt4.cmake found. For example, \"4.7.3\"");
#if 0
cm->DefineProperty
@@ -1108,8 +1193,12 @@ void cmTarget::SetMakefile(cmMakefile* mf)
this->SetPropertyDefault("ARCHIVE_OUTPUT_DIRECTORY", 0);
this->SetPropertyDefault("LIBRARY_OUTPUT_DIRECTORY", 0);
this->SetPropertyDefault("RUNTIME_OUTPUT_DIRECTORY", 0);
+ this->SetPropertyDefault("Fortran_FORMAT", 0);
this->SetPropertyDefault("Fortran_MODULE_DIRECTORY", 0);
this->SetPropertyDefault("OSX_ARCHITECTURES", 0);
+ this->SetPropertyDefault("AUTOMOC", 0);
+ this->SetPropertyDefault("AUTOMOC_MOC_OPTIONS", 0);
+ this->SetPropertyDefault("LINK_INTERFACE_LIBRARIES", 0);
// Collect the set of configuration types.
std::vector<std::string> configNames;
@@ -1412,7 +1501,7 @@ bool cmTargetTraceDependencies::IsUtility(std::string const& dep)
// the fact that the name matched a target was just a coincidence.
if(cmSystemTools::FileIsFullPath(dep.c_str()))
{
- if(t->GetType() >= cmTarget::EXECUTABLE &&
+ if(t->GetType() >= cmTarget::EXECUTABLE &&
t->GetType() <= cmTarget::MODULE_LIBRARY)
{
// This is really only for compatibility so we do not need to
@@ -2191,13 +2280,14 @@ void cmTarget::SetProperty(const char* prop, const char* value)
}
//----------------------------------------------------------------------------
-void cmTarget::AppendProperty(const char* prop, const char* value)
+void cmTarget::AppendProperty(const char* prop, const char* value,
+ bool asString)
{
if (!prop)
{
return;
}
- this->Properties.AppendProperty(prop, value, cmProperty::TARGET);
+ this->Properties.AppendProperty(prop, value, cmProperty::TARGET, asString);
this->MaybeInvalidatePropertyCache(prop);
}
@@ -2302,7 +2392,7 @@ cmTarget::OutputInfo const* cmTarget::GetOutputInfo(const char* config)
std::string msg = "cmTarget::GetOutputInfo called for ";
msg += this->GetName();
msg += " which has type ";
- msg += cmTarget::TargetTypeNames[this->GetType()];
+ msg += cmTarget::GetTargetTypeName(this->GetType());
this->GetMakefile()->IssueMessage(cmake::INTERNAL_ERROR, msg);
abort();
return 0;
@@ -2601,40 +2691,7 @@ const char *cmTarget::GetProperty(const char* prop,
// the type property returns what type the target is
if (!strcmp(prop,"TYPE"))
{
- switch( this->GetType() )
- {
- case cmTarget::STATIC_LIBRARY:
- return "STATIC_LIBRARY";
- // break; /* unreachable */
- case cmTarget::MODULE_LIBRARY:
- return "MODULE_LIBRARY";
- // break; /* unreachable */
- case cmTarget::SHARED_LIBRARY:
- return "SHARED_LIBRARY";
- // break; /* unreachable */
- case cmTarget::EXECUTABLE:
- return "EXECUTABLE";
- // break; /* unreachable */
- case cmTarget::UTILITY:
- return "UTILITY";
- // break; /* unreachable */
- case cmTarget::GLOBAL_TARGET:
- return "GLOBAL_TARGET";
- // break; /* unreachable */
- case cmTarget::INSTALL_FILES:
- return "INSTALL_FILES";
- // break; /* unreachable */
- case cmTarget::INSTALL_PROGRAMS:
- return "INSTALL_PROGRAMS";
- // break; /* unreachable */
- case cmTarget::INSTALL_DIRECTORY:
- return "INSTALL_DIRECTORY";
- // break; /* unreachable */
- case cmTarget::UNKNOWN_LIBRARY:
- return "UNKNOWN_LIBRARY";
- // break; /* unreachable */
- }
- return 0;
+ return cmTarget::GetTargetTypeName(this->GetType());
}
bool chain = false;
const char *retVal =
@@ -3688,9 +3745,11 @@ const char* cmTarget::GetOutputTargetType(bool implib)
}
//----------------------------------------------------------------------------
-void cmTarget::ComputeOutputDir(const char* config,
+bool cmTarget::ComputeOutputDir(const char* config,
bool implib, std::string& out)
{
+ bool usesDefaultOutputDir = false;
+
// Look for a target property defining the target output directory
// based on the target type.
std::string targetTypeName = this->GetOutputTargetType(implib);
@@ -3742,6 +3801,7 @@ void cmTarget::ComputeOutputDir(const char* config,
if(out.empty())
{
// Default to the current output directory.
+ usesDefaultOutputDir = true;
out = ".";
}
@@ -3754,9 +3814,22 @@ void cmTarget::ComputeOutputDir(const char* config,
// The generator may add the configuration's subdirectory.
if(config && *config)
{
+ const char *platforms = this->Makefile->GetDefinition(
+ "CMAKE_XCODE_EFFECTIVE_PLATFORMS");
+ std::string suffix =
+ usesDefaultOutputDir && platforms ? "$(EFFECTIVE_PLATFORM_NAME)" : "";
this->Makefile->GetLocalGenerator()->GetGlobalGenerator()->
- AppendDirectoryForConfig("/", config, "", out);
+ AppendDirectoryForConfig("/", config, suffix.c_str(), out);
}
+
+ return usesDefaultOutputDir;
+}
+
+//----------------------------------------------------------------------------
+bool cmTarget::UsesDefaultOutputDir(const char* config, bool implib)
+{
+ std::string dir;
+ return this->ComputeOutputDir(config, implib, dir);
}
//----------------------------------------------------------------------------
diff --git a/Source/cmTarget.h b/Source/cmTarget.h
index 3b1f016..0abdddb 100644
--- a/Source/cmTarget.h
+++ b/Source/cmTarget.h
@@ -62,7 +62,7 @@ public:
SHARED_LIBRARY, MODULE_LIBRARY, UTILITY, GLOBAL_TARGET,
INSTALL_FILES, INSTALL_PROGRAMS, INSTALL_DIRECTORY,
UNKNOWN_LIBRARY};
- static const char* TargetTypeNames[];
+ static const char* GetTargetTypeName(TargetType targetType);
enum CustomCommandType { PRE_BUILD, PRE_LINK, POST_BUILD };
/**
@@ -224,7 +224,7 @@ public:
///! Set/Get a property of this target file
void SetProperty(const char *prop, const char *value);
- void AppendProperty(const char* prop, const char* value);
+ void AppendProperty(const char* prop, const char* value,bool asString=false);
const char *GetProperty(const char *prop);
const char *GetProperty(const char *prop, cmProperty::ScopeType scope);
bool GetPropertyAsBool(const char *prop);
@@ -446,6 +446,10 @@ public:
/** Get a build-tree directory in which to place target support files. */
std::string GetSupportDirectory() const;
+ /** Return whether this target uses the default value for its output
+ directory. */
+ bool UsesDefaultOutputDir(const char* config, bool implib);
+
private:
/**
* A list of direct dependencies. Use in conjunction with DependencyMap.
@@ -558,7 +562,7 @@ private:
// Cache target output paths for each configuration.
struct OutputInfo;
OutputInfo const* GetOutputInfo(const char* config);
- void ComputeOutputDir(const char* config, bool implib, std::string& out);
+ bool ComputeOutputDir(const char* config, bool implib, std::string& out);
// Cache import information from properties for each configuration.
struct ImportInfo;
diff --git a/Source/cmTest.cxx b/Source/cmTest.cxx
index c25a8b6..502c174 100644
--- a/Source/cmTest.cxx
+++ b/Source/cmTest.cxx
@@ -84,13 +84,13 @@ void cmTest::SetProperty(const char* prop, const char* value)
}
//----------------------------------------------------------------------------
-void cmTest::AppendProperty(const char* prop, const char* value)
+void cmTest::AppendProperty(const char* prop, const char* value, bool asString)
{
if (!prop)
{
return;
}
- this->Properties.AppendProperty(prop, value, cmProperty::TEST);
+ this->Properties.AppendProperty(prop, value, cmProperty::TEST, asString);
}
//----------------------------------------------------------------------------
diff --git a/Source/cmTest.h b/Source/cmTest.h
index e27a24e..6223a01 100644
--- a/Source/cmTest.h
+++ b/Source/cmTest.h
@@ -47,7 +47,7 @@ public:
///! Set/Get a property of this source file
void SetProperty(const char *prop, const char *value);
- void AppendProperty(const char* prop, const char* value);
+ void AppendProperty(const char* prop, const char* value,bool asString=false);
const char *GetProperty(const char *prop) const;
bool GetPropertyAsBool(const char *prop) const;
cmPropertyMap &GetProperties() { return this->Properties; };
diff --git a/Source/cmTryCompileCommand.cxx b/Source/cmTryCompileCommand.cxx
index 4d39d54..12ce015 100644
--- a/Source/cmTryCompileCommand.cxx
+++ b/Source/cmTryCompileCommand.cxx
@@ -20,6 +20,14 @@ bool cmTryCompileCommand
return false;
}
+ if(this->Makefile->GetCMakeInstance()->GetWorkingMode() ==
+ cmake::FIND_PACKAGE_MODE)
+ {
+ this->Makefile->IssueMessage(cmake::FATAL_ERROR,
+ "The TRY_COMPILE() command is not supported in --find-package mode.");
+ return false;
+ }
+
this->TryCompileCode(argv);
// if They specified clean then we clean up what we can
@@ -32,4 +40,3 @@ bool cmTryCompileCommand
}
return true;
}
-
diff --git a/Source/cmTryCompileCommand.h b/Source/cmTryCompileCommand.h
index 9923d03..0d57633 100644
--- a/Source/cmTryCompileCommand.h
+++ b/Source/cmTryCompileCommand.h
@@ -25,7 +25,7 @@ public:
/**
* This is a virtual constructor for the command.
*/
- virtual cmCommand* Clone()
+ virtual cmCommand* Clone()
{
return new cmTryCompileCommand;
}
@@ -45,7 +45,7 @@ public:
/**
* Succinct documentation.
*/
- virtual const char* GetTerseDocumentation()
+ virtual const char* GetTerseDocumentation()
{
return "Try building some code.";
}
@@ -102,14 +102,15 @@ public:
"In both versions of the command, "
"if OUTPUT_VARIABLE is specified, then the "
"output from the build process is stored in the given variable. "
- "Return the success or failure in "
+ "The success or failure of the try_compile, i.e. TRUE or FALSE "
+ "respectively, is returned 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.cxx b/Source/cmTryRunCommand.cxx
index 4d31a14..4fc0b13 100644
--- a/Source/cmTryRunCommand.cxx
+++ b/Source/cmTryRunCommand.cxx
@@ -22,6 +22,14 @@ bool cmTryRunCommand
return false;
}
+ if(this->Makefile->GetCMakeInstance()->GetWorkingMode() ==
+ cmake::FIND_PACKAGE_MODE)
+ {
+ this->Makefile->IssueMessage(cmake::FATAL_ERROR,
+ "The TRY_RUN() command is not supported in --find-package mode.");
+ return false;
+ }
+
// build an arg list for TryCompile and extract the runArgs,
std::vector<std::string> tryCompile;
@@ -49,8 +57,8 @@ bool cmTryRunCommand
{
tryCompile.push_back(argv[i]);
}
- }
- else
+ }
+ else
{
if (argv[i] == "OUTPUT_VARIABLE")
{
@@ -94,8 +102,8 @@ bool cmTryRunCommand
// although they could be used together, don't allow it, because
// using OUTPUT_VARIABLE makes crosscompiling harder
- if (this->OutputVariable.size()
- && ((this->RunOutputVariable.size())
+ if (this->OutputVariable.size()
+ && ((this->RunOutputVariable.size())
|| (this->CompileOutputVariable.size())))
{
cmSystemTools::Error(
@@ -141,8 +149,8 @@ bool cmTryRunCommand
std::string runOutputContents;
if (this->Makefile->IsOn("CMAKE_CROSSCOMPILING"))
{
- this->DoNotRunExecutable(runArgs,
- argv[3],
+ this->DoNotRunExecutable(runArgs,
+ argv[3],
captureRunOutput ? &runOutputContents : 0);
}
else
@@ -153,7 +161,7 @@ bool cmTryRunCommand
// now put the output into the variables
if(this->RunOutputVariable.size())
{
- this->Makefile->AddDefinition(this->RunOutputVariable.c_str(),
+ this->Makefile->AddDefinition(this->RunOutputVariable.c_str(),
runOutputContents.c_str());
}
@@ -167,7 +175,7 @@ bool cmTryRunCommand
{
runOutputContents = std::string(compileOutput) + runOutputContents;
}
- this->Makefile->AddDefinition(this->OutputVariable.c_str(),
+ this->Makefile->AddDefinition(this->OutputVariable.c_str(),
runOutputContents.c_str());
}
}
@@ -194,7 +202,7 @@ void cmTryRunCommand::RunExecutable(const std::string& runArgs,
int timeout = 0;
bool worked = cmSystemTools::RunSingleCommand(finalCommand.c_str(),
out, &retVal,
- 0, false, timeout);
+ 0, cmSystemTools::OUTPUT_NONE, timeout);
// set the run var
char retChar[1000];
if (worked)
@@ -212,9 +220,9 @@ void cmTryRunCommand::RunExecutable(const std::string& runArgs,
/* This is only used when cross compiling. Instead of running the
executable, two cache variables are created which will hold the results
- the executable would have produced.
+ the executable would have produced.
*/
-void cmTryRunCommand::DoNotRunExecutable(const std::string& runArgs,
+void cmTryRunCommand::DoNotRunExecutable(const std::string& runArgs,
const std::string& srcFile,
std::string* out
)
@@ -249,7 +257,7 @@ void cmTryRunCommand::DoNotRunExecutable(const std::string& runArgs,
comment += "Run result of TRY_RUN(), indicates whether the executable "
"would have been able to run on its target platform.\n";
comment += detailsString;
- this->Makefile->AddCacheDefinition(this->RunResultVariable.c_str(),
+ this->Makefile->AddCacheDefinition(this->RunResultVariable.c_str(),
"PLEASE_FILL_OUT-FAILED_TO_RUN",
comment.c_str(),
cmCacheManager::STRING);
@@ -276,7 +284,7 @@ void cmTryRunCommand::DoNotRunExecutable(const std::string& runArgs,
"would have printed on stdout and stderr on its target platform.\n";
comment += detailsString;
- this->Makefile->AddCacheDefinition(internalRunOutputName.c_str(),
+ this->Makefile->AddCacheDefinition(internalRunOutputName.c_str(),
"PLEASE_FILL_OUT-NOTFOUND",
comment.c_str(),
cmCacheManager::STRING);
@@ -294,7 +302,7 @@ void cmTryRunCommand::DoNotRunExecutable(const std::string& runArgs,
if (error)
{
static bool firstTryRun = true;
- std::ofstream file(resultFileName.c_str(),
+ std::ofstream file(resultFileName.c_str(),
firstTryRun ? std::ios::out : std::ios::app);
if ( file )
{
diff --git a/Source/cmVisualStudio10TargetGenerator.cxx b/Source/cmVisualStudio10TargetGenerator.cxx
index d710405..d748c40 100644
--- a/Source/cmVisualStudio10TargetGenerator.cxx
+++ b/Source/cmVisualStudio10TargetGenerator.cxx
@@ -178,8 +178,31 @@ void cmVisualStudio10TargetGenerator::Generate()
this->WriteString("<ProjectGUID>", 2);
(*this->BuildFileStream) << "{" << this->GUID << "}</ProjectGUID>\n";
- this->WriteString("<SccProjectName />\n", 2);
- this->WriteString("<SccLocalPath />\n", 2);
+ const char* vsProjectName = this->Target->GetProperty("VS_SCC_PROJECTNAME");
+ const char* vsLocalPath = this->Target->GetProperty("VS_SCC_LOCALPATH");
+ const char* vsProvider = this->Target->GetProperty("VS_SCC_PROVIDER");
+
+ if( vsProjectName && vsLocalPath && vsProvider )
+ {
+ this->WriteString("<SccProjectName>", 2);
+ (*this->BuildFileStream) << cmVS10EscapeXML(vsProjectName) <<
+ "</SccProjectName>\n";
+ this->WriteString("<SccLocalPath>", 2);
+ (*this->BuildFileStream) << cmVS10EscapeXML(vsLocalPath) <<
+ "</SccLocalPath>\n";
+ this->WriteString("<SccProvider>", 2);
+ (*this->BuildFileStream) << cmVS10EscapeXML(vsProvider) <<
+ "</SccProvider>\n";
+
+ const char* vsAuxPath = this->Target->GetProperty("VS_SCC_AUXPATH");
+ if( vsAuxPath )
+ {
+ this->WriteString("<SccAuxPath>", 2);
+ (*this->BuildFileStream) << cmVS10EscapeXML(vsAuxPath) <<
+ "</SccAuxPath>\n";
+ }
+ }
+
this->WriteString("<Keyword>Win32Proj</Keyword>\n", 2);
this->WriteString("<Platform>", 2);
(*this->BuildFileStream) << this->Platform << "</Platform>\n";
@@ -275,16 +298,24 @@ void cmVisualStudio10TargetGenerator::WriteProjectConfigurationValues()
}
configType += "</ConfigurationType>\n";
this->WriteString(configType.c_str(), 2);
+
const char* mfcFlag =
this->Target->GetMakefile()->GetDefinition("CMAKE_MFC_FLAG");
- if(mfcFlag)
+ std::string mfcFlagValue = mfcFlag ? mfcFlag : "0";
+
+ std::string useOfMfcValue = "false";
+ if(mfcFlagValue == "1")
{
- this->WriteString("<UseOfMfc>true</UseOfMfc>\n", 2);
+ useOfMfcValue = "Static";
}
- else
+ else if(mfcFlagValue == "2")
{
- this->WriteString("<UseOfMfc>false</UseOfMfc>\n", 2);
+ useOfMfcValue = "Dynamic";
}
+ std::string mfcLine = "<UseOfMfc>";
+ mfcLine += useOfMfcValue + "</UseOfMfc>\n";
+ this->WriteString(mfcLine.c_str(), 2);
+
if(this->Target->GetType() <= cmTarget::MODULE_LIBRARY &&
this->ClOptions[*i]->UsingUnicode())
{
@@ -422,7 +453,7 @@ cmVisualStudio10TargetGenerator::WriteCustomRule(cmSourceFile* source,
(*this->BuildFileStream ) << sep << out;
sep = ";";
}
- (*this->BuildFileStream ) << ";%(Outputs)</Outputs>\n";
+ (*this->BuildFileStream ) << "</Outputs>\n";
}
this->WriteString("</CustomBuild>\n", 2);
}
@@ -1563,6 +1594,13 @@ void cmVisualStudio10TargetGenerator::WriteProjectReferences()
i != depends.end(); ++i)
{
cmTarget* dt = *i;
+ // skip fortran targets as they can not be processed by MSBuild
+ // the only reference will be in the .sln file
+ if(static_cast<cmGlobalVisualStudioGenerator*>(this->GlobalGenerator)
+ ->TargetIsFortranOnly(*dt))
+ {
+ continue;
+ }
this->WriteString("<ProjectReference Include=\"", 2);
cmMakefile* mf = dt->GetMakefile();
std::string name = dt->GetName();
diff --git a/Source/cmVisualStudioGeneratorOptions.cxx b/Source/cmVisualStudioGeneratorOptions.cxx
index ae496ad..4edeedc 100644
--- a/Source/cmVisualStudioGeneratorOptions.cxx
+++ b/Source/cmVisualStudioGeneratorOptions.cxx
@@ -86,14 +86,14 @@ void cmVisualStudioGeneratorOptions::SetVerboseMakefile(bool verbose)
// 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:
+ // On Visual Studio 10 (and later!), the value of this attribute should be
+ // an empty string, instead of "FALSE", in order to avoid a warning:
// "cl ... warning D9035: option 'nologo-' has been deprecated"
//
if(verbose &&
- this->Version != 10 &&
this->FlagMap.find("SuppressStartupBanner") == this->FlagMap.end())
{
- this->FlagMap["SuppressStartupBanner"] = "FALSE";
+ this->FlagMap["SuppressStartupBanner"] = this->Version < 10 ? "FALSE" : "";
}
}
diff --git a/Source/cmXCodeObject.cxx b/Source/cmXCodeObject.cxx
index 71c7c25..30ade96 100644
--- a/Source/cmXCodeObject.cxx
+++ b/Source/cmXCodeObject.cxx
@@ -12,6 +12,8 @@
#include "cmXCodeObject.h"
#include "cmSystemTools.h"
+#include <CoreFoundation/CoreFoundation.h> // CFUUIDCreate
+
//----------------------------------------------------------------------------
const char* cmXCodeObject::PBXTypeNames[] = {
"PBXGroup", "PBXBuildStyle", "PBXProject", "PBXHeadersBuildPhase",
@@ -39,35 +41,35 @@ cmXCodeObject::cmXCodeObject(PBXType ptype, Type type)
this->PBXTargetDependencyValue = 0;
this->Target = 0;
this->Object =0;
-
+
this->IsA = ptype;
+
if(type == OBJECT)
{
- cmOStringStream str;
- str << (void*)this;
- str << (void*)this;
- str << (void*)this;
- this->Id = str.str();
+ // Set the Id of an Xcode object to a unique string for each instance.
+ // However the Xcode user file references certain Ids: for those cases,
+ // override the generated Id using SetId().
+ //
+ char cUuid[40] = {0};
+ CFUUIDRef uuid = CFUUIDCreate(kCFAllocatorDefault);
+ CFStringRef s = CFUUIDCreateString(kCFAllocatorDefault, uuid);
+ CFStringGetCString(s, cUuid, sizeof(cUuid), kCFStringEncodingUTF8);
+ this->Id = cUuid;
+ CFRelease(s);
+ CFRelease(uuid);
}
else
{
- this->Id =
- "Temporary cmake object, should not be refered to in xcode file";
- }
- cmSystemTools::ReplaceString(this->Id, "0x", "");
- this->Id = cmSystemTools::UpperCase(this->Id);
- if(this->Id.size() < 24)
- {
- int diff = 24 - this->Id.size();
- for(int i =0; i < diff; ++i)
- {
- this->Id += "0";
- }
+ this->Id =
+ "Temporary cmake object, should not be referred to in Xcode file";
}
+
+ cmSystemTools::ReplaceString(this->Id, "-", "");
if(this->Id.size() > 24)
{
- this->Id = this->Id.substr(0,24);
+ this->Id = this->Id.substr(0, 24);
}
+
this->TypeValue = type;
if(this->TypeValue == OBJECT)
{
@@ -241,7 +243,7 @@ void cmXCodeObject::PrintString(std::ostream& os,cmStdString String)
// considered special by the Xcode project file parser.
bool needQuote =
(String.empty() ||
- String.find_first_of(" <>.+-=@$[]") != String.npos);
+ String.find_first_of(" <>.+-=@$[],") != String.npos);
const char* quote = needQuote? "\"" : "";
// Print the string, quoted and escaped as necessary.
diff --git a/Source/cmXCodeObject.h b/Source/cmXCodeObject.h
index 369fe66..2fb96f3 100644
--- a/Source/cmXCodeObject.h
+++ b/Source/cmXCodeObject.h
@@ -83,6 +83,10 @@ public:
{
return this->Id.c_str();
}
+ void SetId(const char* id)
+ {
+ this->Id = id;
+ }
cmTarget* GetTarget()
{
return this->Target;
diff --git a/Source/cmake.cxx b/Source/cmake.cxx
index 45927cb..d691f46 100644
--- a/Source/cmake.cxx
+++ b/Source/cmake.cxx
@@ -20,6 +20,7 @@
#include "cmCommand.h"
#include "cmFileTimeComparison.h"
#include "cmGeneratedFileStream.h"
+#include "cmQtAutomoc.h"
#include "cmSourceFile.h"
#include "cmVersion.h"
#include "cmTest.h"
@@ -62,9 +63,13 @@
# include "cmGlobalVisualStudio71Generator.h"
# include "cmGlobalVisualStudio8Generator.h"
# include "cmGlobalVisualStudio9Generator.h"
+# include "cmGlobalVisualStudio9IA64Generator.h"
# include "cmGlobalVisualStudio9Win64Generator.h"
# include "cmGlobalVisualStudio10Generator.h"
+# include "cmGlobalVisualStudio10IA64Generator.h"
# include "cmGlobalVisualStudio10Win64Generator.h"
+# include "cmGlobalVisualStudio11Generator.h"
+# include "cmGlobalVisualStudio11Win64Generator.h"
# include "cmGlobalVisualStudio8Win64Generator.h"
# include "cmGlobalBorlandMakefileGenerator.h"
# include "cmGlobalNMakeMakefileGenerator.h"
@@ -180,7 +185,7 @@ cmake::cmake()
this->GlobalGenerator = 0;
this->ProgressCallback = 0;
this->ProgressCallbackClientData = 0;
- this->ScriptMode = false;
+ this->CurrentWorkingMode = NORMAL_MODE;
#ifdef CMAKE_BUILD_WITH_CMAKE
this->VariableWatch = new cmVariableWatch;
@@ -353,6 +358,7 @@ void cmake::RemoveUnscriptableCommands()
// Parse the args
bool cmake::SetCacheArgs(const std::vector<std::string>& args)
{
+ bool findPackageMode = false;
for(unsigned int i=1; i < args.size(); ++i)
{
std::string arg = args[i];
@@ -480,7 +486,17 @@ bool cmake::SetCacheArgs(const std::vector<std::string>& args)
}
this->ReadListFile(args, path.c_str());
}
+ else if (arg.find("--find-package",0) == 0)
+ {
+ findPackageMode = true;
+ }
+ }
+
+ if (findPackageMode)
+ {
+ return this->FindPackage(args);
}
+
return true;
}
@@ -511,7 +527,7 @@ void cmake::ReadListFile(const std::vector<std::string>& args,
(cmSystemTools::GetCurrentWorkingDirectory().c_str());
lg->GetMakefile()->SetStartDirectory
(cmSystemTools::GetCurrentWorkingDirectory().c_str());
- if (this->GetScriptMode())
+ if (this->GetWorkingMode() != NORMAL_MODE)
{
std::string file(cmSystemTools::CollapseFullPath(path));
cmSystemTools::ConvertToUnixSlashes(file);
@@ -532,6 +548,111 @@ void cmake::ReadListFile(const std::vector<std::string>& args,
}
}
+
+bool cmake::FindPackage(const std::vector<std::string>& args)
+{
+ // if a generator was not yet created, temporarily create one
+ cmGlobalGenerator *gg = new cmGlobalGenerator;
+ gg->SetCMakeInstance(this);
+ this->SetGlobalGenerator(gg);
+
+ // read in the list file to fill the cache
+ std::auto_ptr<cmLocalGenerator> lg(gg->CreateLocalGenerator());
+ cmMakefile* mf = lg->GetMakefile();
+ mf->SetHomeOutputDirectory
+ (cmSystemTools::GetCurrentWorkingDirectory().c_str());
+ mf->SetStartOutputDirectory
+ (cmSystemTools::GetCurrentWorkingDirectory().c_str());
+ mf->SetHomeDirectory
+ (cmSystemTools::GetCurrentWorkingDirectory().c_str());
+ mf->SetStartDirectory
+ (cmSystemTools::GetCurrentWorkingDirectory().c_str());
+
+ mf->SetArgcArgv(args);
+
+ std::string systemFile = mf->GetModulesFile("CMakeFindPackageMode.cmake");
+ mf->ReadListFile(0, systemFile.c_str());
+
+ std::string language = mf->GetSafeDefinition("LANGUAGE");
+ std::string mode = mf->GetSafeDefinition("MODE");
+ std::string packageName = mf->GetSafeDefinition("NAME");
+ bool packageFound = mf->IsOn("PACKAGE_FOUND");
+ bool quiet = mf->IsOn("PACKAGE_QUIET");
+
+ if (!packageFound)
+ {
+ if (!quiet)
+ {
+ printf("%s not found.\n", packageName.c_str());
+ }
+ }
+ else if (mode == "EXIST")
+ {
+ if (!quiet)
+ {
+ printf("%s found.\n", packageName.c_str());
+ }
+ }
+ else if (mode == "COMPILE")
+ {
+ std::string includes = mf->GetSafeDefinition("PACKAGE_INCLUDE_DIRS");
+ std::vector<std::string> includeDirs;
+ cmSystemTools::ExpandListArgument(includes, includeDirs);
+ for(std::vector<std::string>::const_iterator dirIt=includeDirs.begin();
+ dirIt != includeDirs.end();
+ ++dirIt)
+ {
+ mf->AddIncludeDirectory(dirIt->c_str(), false);
+ }
+
+ std::string includeFlags = lg->GetIncludeFlags(language.c_str(), false);
+ std::string definitions = mf->GetSafeDefinition("PACKAGE_DEFINITIONS");
+ printf("%s %s\n", includeFlags.c_str(), definitions.c_str());
+ }
+ else if (mode == "LINK")
+ {
+ const char* targetName = "dummy";
+ std::vector<std::string> srcs;
+ cmTarget* tgt = mf->AddExecutable(targetName, srcs, true);
+ tgt->SetProperty("LINKER_LANGUAGE", language.c_str());
+
+ std::string libs = mf->GetSafeDefinition("PACKAGE_LIBRARIES");
+ std::vector<std::string> libList;
+ cmSystemTools::ExpandListArgument(libs, libList);
+ for(std::vector<std::string>::const_iterator libIt=libList.begin();
+ libIt != libList.end();
+ ++libIt)
+ {
+ mf->AddLinkLibraryForTarget(targetName, libIt->c_str(),
+ cmTarget::GENERAL);
+ }
+
+
+ std::string linkLibs;
+ std::string flags;
+ std::string linkFlags;
+ lg->GetTargetFlags(linkLibs, flags, linkFlags, *tgt);
+
+ printf("%s\n", linkLibs.c_str() );
+
+/* if ( use_win32 )
+ {
+ tgt->SetProperty("WIN32_EXECUTABLE", "ON");
+ }
+ if ( use_macbundle)
+ {
+ tgt->SetProperty("MACOSX_BUNDLE", "ON");
+ }*/
+ }
+
+ // free generic one if generated
+// this->SetGlobalGenerator(0); // setting 0-pointer is not possible
+// delete gg; // this crashes inside the cmake instance
+
+ return packageFound;
+}
+
+
// Parse the args
void cmake::SetArgs(const std::vector<std::string>& args,
bool directoriesSetBefore)
@@ -604,6 +725,11 @@ void cmake::SetArgs(const std::vector<std::string>& args,
// skip for now
i++;
}
+ else if(arg.find("--find-package",0) == 0)
+ {
+ // skip for now
+ i++;
+ }
else if(arg.find("-Wno-dev",0) == 0)
{
// skip for now
@@ -988,7 +1114,6 @@ void CMakeCommandUsage(const char* program)
errorStream
<< "Usage: " << program << " -E [command] [arguments ...]\n"
<< "Available commands: \n"
- << " build build_dir - build the project in build_dir.\n"
<< " chdir dir cmd [args]... - run command in a given directory\n"
<< " compare_files file1 file2 - check if file1 is same as file2\n"
<< " copy file destination - copy file to destination (either file "
@@ -1297,7 +1422,7 @@ int cmake::ExecuteCMakeCommand(std::vector<std::string>& args)
int retval = 0;
int timeout = 0;
if ( cmSystemTools::RunSingleCommand(command.c_str(), 0, &retval,
- directory.c_str(), true, timeout) )
+ directory.c_str(), cmSystemTools::OUTPUT_MERGE, timeout) )
{
return retval;
}
@@ -1570,6 +1695,12 @@ int cmake::ExecuteCMakeCommand(std::vector<std::string>& args)
{
return cmake::ExecuteEchoColor(args);
}
+ else if (args[1] == "cmake_automoc")
+ {
+ cmQtAutomoc automoc;
+ automoc.Run(args[2].c_str());
+ return 0;
+ }
#endif
// Tar files
@@ -2026,7 +2157,7 @@ int cmake::ActualConfigure()
this->CleanupCommandsAndMacros();
int res = 0;
- if ( !this->ScriptMode )
+ if ( this->GetWorkingMode() == NORMAL_MODE )
{
res = this->DoPreConfigureChecks();
}
@@ -2214,7 +2345,7 @@ int cmake::ActualConfigure()
this->CacheManager->RemoveCacheEntry("CMAKE_EXTRA_GENERATOR");
}
// only save the cache if there were no fatal errors
- if ( !this->ScriptMode )
+ if ( this->GetWorkingMode() == NORMAL_MODE )
{
this->CacheManager->SaveCache(this->GetHomeOutputDirectory());
}
@@ -2280,7 +2411,7 @@ int cmake::Run(const std::vector<std::string>& args, bool noconfigure)
// set the cmake command
this->CMakeCommand = args[0];
- if ( !this->ScriptMode )
+ if ( this->GetWorkingMode() == NORMAL_MODE )
{
// load the cache
if(this->LoadCache() < 0)
@@ -2301,7 +2432,7 @@ int cmake::Run(const std::vector<std::string>& args, bool noconfigure)
}
// In script mode we terminate after running the script.
- if(this->ScriptMode)
+ if(this->GetWorkingMode() != NORMAL_MODE)
{
if(cmSystemTools::GetErrorOccuredFlag())
{
@@ -2347,7 +2478,7 @@ int cmake::Run(const std::vector<std::string>& args, bool noconfigure)
this->SetStartDirectory(this->GetHomeDirectory());
this->SetStartOutputDirectory(this->GetHomeOutputDirectory());
int ret = this->Configure();
- if (ret || this->ScriptMode)
+ if (ret || this->GetWorkingMode() != NORMAL_MODE)
{
#if defined(CMAKE_HAVE_VS_GENERATORS)
if(!this->VSSolutionFile.empty() && this->GlobalGenerator)
@@ -2401,6 +2532,13 @@ int cmake::Generate()
this->ReportUndefinedPropertyAccesses
(this->GetProperty("REPORT_UNDEFINED_PROPERTIES"));
}
+ // Save the cache again after a successful Generate so that any internal
+ // variables created during Generate are saved. (Specifically target GUIDs
+ // for the Visual Studio and Xcode generators.)
+ if ( this->GetWorkingMode() == NORMAL_MODE )
+ {
+ this->CacheManager->SaveCache(this->GetHomeOutputDirectory());
+ }
return 0;
}
@@ -2440,14 +2578,22 @@ void cmake::AddDefaultGenerators()
&cmGlobalVisualStudio7Generator::New;
this->Generators[cmGlobalVisualStudio10Generator::GetActualName()] =
&cmGlobalVisualStudio10Generator::New;
+ this->Generators[cmGlobalVisualStudio10IA64Generator::GetActualName()] =
+ &cmGlobalVisualStudio10IA64Generator::New;
this->Generators[cmGlobalVisualStudio10Win64Generator::GetActualName()] =
&cmGlobalVisualStudio10Win64Generator::New;
+ this->Generators[cmGlobalVisualStudio11Generator::GetActualName()] =
+ &cmGlobalVisualStudio11Generator::New;
+ this->Generators[cmGlobalVisualStudio11Win64Generator::GetActualName()] =
+ &cmGlobalVisualStudio11Win64Generator::New;
this->Generators[cmGlobalVisualStudio71Generator::GetActualName()] =
&cmGlobalVisualStudio71Generator::New;
this->Generators[cmGlobalVisualStudio8Generator::GetActualName()] =
&cmGlobalVisualStudio8Generator::New;
this->Generators[cmGlobalVisualStudio9Generator::GetActualName()] =
&cmGlobalVisualStudio9Generator::New;
+ this->Generators[cmGlobalVisualStudio9IA64Generator::GetActualName()] =
+ &cmGlobalVisualStudio9IA64Generator::New;
this->Generators[cmGlobalVisualStudio9Win64Generator::GetActualName()] =
&cmGlobalVisualStudio9Win64Generator::New;
this->Generators[cmGlobalVisualStudio8Win64Generator::GetActualName()] =
@@ -2735,7 +2881,7 @@ int cmake::CheckBuildSystem()
return 1;
}
- // Find find the newest dependency.
+ // Find the newest dependency.
std::vector<std::string>::iterator dep = depends.begin();
std::string dep_newest = *dep++;
for(;dep != depends.end(); ++dep)
@@ -2761,7 +2907,7 @@ int cmake::CheckBuildSystem()
}
}
- // Find find the oldest output.
+ // Find the oldest output.
std::vector<std::string>::iterator out = outputs.begin();
std::string out_oldest = *out++;
for(;out != outputs.end(); ++out)
@@ -2913,6 +3059,13 @@ const char* cmake::GetCPackCommand()
return this->CPackCommand.c_str();
}
+
+const char* cmake::GetCMakeCommand()
+{
+ return this->CMakeCommand.c_str();
+}
+
+
void cmake::MarkCliAsUsed(const std::string& variable)
{
this->UsedCliVariables[variable] = true;
@@ -3536,7 +3689,7 @@ void cmake::SetProperty(const char* prop, const char* value)
this->Properties.SetProperty(prop, value, cmProperty::GLOBAL);
}
-void cmake::AppendProperty(const char* prop, const char* value)
+void cmake::AppendProperty(const char* prop, const char* value, bool asString)
{
if (!prop)
{
@@ -3549,7 +3702,7 @@ void cmake::AppendProperty(const char* prop, const char* value)
this->DebugConfigs.clear();
}
- this->Properties.AppendProperty(prop, value, cmProperty::GLOBAL);
+ this->Properties.AppendProperty(prop, value, cmProperty::GLOBAL, asString);
}
const char *cmake::GetProperty(const char* prop)
@@ -3978,7 +4131,7 @@ bool cmake::RunCommand(const char* comment,
// use rc command to create .res file
cmSystemTools::RunSingleCommand(command,
&output,
- &retCode, 0, false);
+ &retCode, 0, cmSystemTools::OUTPUT_NONE);
// always print the output of the command, unless
// it is the dumb rc command banner, but if the command
// returned an error code then print the output anyway as
@@ -4296,7 +4449,8 @@ int cmake::Build(const std::string& dir,
const std::string& target,
const std::string& config,
const std::vector<std::string>& nativeOptions,
- bool clean)
+ bool clean,
+ cmSystemTools::OutputOption outputflag)
{
if(!cmSystemTools::FileIsDirectory(dir.c_str()))
{
@@ -4338,7 +4492,7 @@ int cmake::Build(const std::string& dir,
projName.c_str(), target.c_str(),
&output,
makeProgram.c_str(),
- config.c_str(), clean, false, 0, true,
+ config.c_str(), clean, false, 0, outputflag,
0, nativeOptions);
}
diff --git a/Source/cmake.h b/Source/cmake.h
index fac86c1..ae56e85 100644
--- a/Source/cmake.h
+++ b/Source/cmake.h
@@ -64,6 +64,25 @@ class cmake
WARNING,
LOG
};
+
+
+ /** Describes the working modes of cmake.
+ * NORMAL_MODE: cmake runs to create project files
+ * SCRIPT_MODE: in script mode there is no generator and no cache. Also,
+ * language are not enabled, so add_executable and things do
+ * not do anything. Started by using -P
+ * FIND_PACKAGE_MODE: cmake runs in pkg-config like mode, i.e. it just
+ * searches for a package and prints the results to stdout.
+ * This is similar to SCRIPT_MODE, but commands like
+ * add_library() work too, since they may be used e.g. in
+ * exported target files. Started via --find-package
+ */
+ enum WorkingMode
+ {
+ NORMAL_MODE,
+ SCRIPT_MODE,
+ FIND_PACKAGE_MODE
+ };
typedef std::map<cmStdString, cmCommand*> RegisteredCommandsMap;
///! construct an instance of cmake
@@ -263,7 +282,7 @@ class cmake
///! Set/Get a property of this target file
void SetProperty(const char *prop, const char *value);
- void AppendProperty(const char *prop, const char *value);
+ void AppendProperty(const char *prop, const char *value,bool asString=false);
const char *GetProperty(const char *prop);
const char *GetProperty(const char *prop, cmProperty::ScopeType scope);
bool GetPropertyAsBool(const char *prop);
@@ -274,13 +293,8 @@ class cmake
///! Do all the checks before running configure
int DoPreConfigureChecks();
- /**
- * Set and get the script mode option. In script mode there is no
- * generator and no cache. Also, language are not enabled, so
- * add_executable and things do not do anything.
- */
- void SetScriptMode(bool mode) { this->ScriptMode = mode; }
- bool GetScriptMode() { return this->ScriptMode; }
+ void SetWorkingMode(WorkingMode mode) { this->CurrentWorkingMode = mode; }
+ WorkingMode GetWorkingMode() { return this->CurrentWorkingMode; }
///! Debug the try compile stuff by not delelting the files
bool GetDebugTryCompile(){return this->DebugTryCompile;}
@@ -301,6 +315,7 @@ class cmake
*/
const char* GetCTestCommand();
const char* GetCPackCommand();
+ const char* GetCMakeCommand();
// Do we want debug output during the cmake run.
bool GetDebugOutput() { return this->DebugOutput; }
@@ -364,7 +379,8 @@ class cmake
const std::string& target,
const std::string& config,
const std::vector<std::string>& nativeOptions,
- bool clean);
+ bool clean,
+ cmSystemTools::OutputOption outputflag);
void UnwatchUnusedCli(const char* var);
void WatchUnusedCli(const char* var);
@@ -407,6 +423,7 @@ protected:
///! read in a cmake list file to initialize the cache
void ReadListFile(const std::vector<std::string>& args, const char *path);
+ bool FindPackage(const std::vector<std::string>& args);
///! Check if CMAKE_CACHEFILE_DIR is set. If it is not, delete the log file.
/// If it is set, truncate it to 50kb
@@ -460,7 +477,7 @@ private:
void* ProgressCallbackClientData;
bool Verbose;
bool InTryCompile;
- bool ScriptMode;
+ WorkingMode CurrentWorkingMode;
bool DebugOutput;
bool Trace;
bool WarnUninitialized;
diff --git a/Source/cmakemain.cxx b/Source/cmakemain.cxx
index 663ce8f..436236d 100644
--- a/Source/cmakemain.cxx
+++ b/Source/cmakemain.cxx
@@ -62,6 +62,7 @@ static const char * cmDocumentationDescription[][3] =
" --config <cfg> = For multi-configuration tools, choose <cfg>.\n" \
" --clean-first = Build target 'clean' first, then build.\n" \
" (To clean only, use --target 'clean'.)\n" \
+ " --use-stderr = Don't merge stdout/stderr.\n" \
" -- = Pass remaining options to the native tool.\n"
//----------------------------------------------------------------------------
@@ -71,7 +72,7 @@ static const char * cmDocumentationOptions[][3] =
{"-E", "CMake command mode.",
"For true platform independence, CMake provides a list of commands "
"that can be used on all systems. Run with -E help for the usage "
- "information. Commands available are: build, chdir, compare_files, copy, "
+ "information. Commands available are: chdir, compare_files, copy, "
"copy_directory, copy_if_different, echo, echo_append, environment, "
"make_directory, md5sum, remove, remove_directory, rename, tar, time, "
"touch, touch_nocreate. In addition, some platform specific commands "
@@ -102,6 +103,11 @@ static const char * cmDocumentationOptions[][3] =
"No configure or generate step is performed and the cache is not"
" modified. If variables are defined using -D, this must be done "
"before the -P argument."},
+ {"--find-package", "Run in pkg-config like mode.",
+ "Search a package using find_package() and print the resulting flags "
+ "to stdout. This can be used to use cmake instead of pkg-config to find "
+ "installed libraries in plain Makefile-based projects or in "
+ "autoconf-based projects (via share/aclocal/cmake.m4)."},
{"--graphviz=[file]", "Generate graphviz of dependencies.",
"Generate a graphviz input file that will contain all the library and "
"executable dependencies in the project."},
@@ -433,7 +439,7 @@ int do_cmake(int ac, char** av)
bool list_all_cached = false;
bool list_help = false;
bool view_only = false;
- bool script_mode = false;
+ cmake::WorkingMode workingMode = cmake::NORMAL_MODE;
std::vector<std::string> args;
for(int i =0; i < ac; ++i)
{
@@ -481,12 +487,18 @@ int do_cmake(int ac, char** av)
}
else
{
- script_mode = true;
+ workingMode = cmake::SCRIPT_MODE;
args.push_back(av[i]);
i++;
args.push_back(av[i]);
}
}
+ else if (!command && strncmp(av[i], "--find-package",
+ strlen("--find-package")) == 0)
+ {
+ workingMode = cmake::FIND_PACKAGE_MODE;
+ args.push_back(av[i]);
+ }
else
{
args.push_back(av[i]);
@@ -511,7 +523,7 @@ int do_cmake(int ac, char** av)
cmake cm;
cmSystemTools::SetErrorCallback(cmakemainErrorCallback, (void *)&cm);
cm.SetProgressCallback(cmakemainProgressCallback, (void *)&cm);
- cm.SetScriptMode(script_mode);
+ cm.SetWorkingMode(workingMode);
int res = cm.Run(args, view_only);
if ( list_cached || list_all_cached )
@@ -568,6 +580,7 @@ static int do_build(int ac, char** av)
std::string dir;
std::vector<std::string> nativeOptions;
bool clean = false;
+ cmSystemTools::OutputOption outputflag = cmSystemTools::OUTPUT_MERGE;
enum Doing { DoingNone, DoingDir, DoingTarget, DoingConfig, DoingNative};
Doing doing = DoingDir;
@@ -590,6 +603,10 @@ static int do_build(int ac, char** av)
clean = true;
doing = DoingNone;
}
+ else if(strcmp(av[i], "--use-stderr") == 0)
+ {
+ outputflag = cmSystemTools::OUTPUT_NORMAL;
+ }
else if(strcmp(av[i], "--") == 0)
{
doing = DoingNative;
@@ -635,6 +652,6 @@ static int do_build(int ac, char** av)
}
cmake cm;
- return cm.Build(dir, target, config, nativeOptions, clean);
+ return cm.Build(dir, target, config, nativeOptions, clean, outputflag);
#endif
}
diff --git a/Source/ctest.cxx b/Source/ctest.cxx
index 3937d8d..85cecea 100644
--- a/Source/ctest.cxx
+++ b/Source/ctest.cxx
@@ -68,6 +68,10 @@ static const char * cmDocumentationOptions[][3] =
{"-F", "Enable failover.", "This option allows ctest to resume a test "
"set execution that was previously interrupted. If no interruption "
"occurred, the -F option will have no effect."},
+ {"-j <jobs>, --parallel <jobs>", "Run the tests in parallel using the"
+ "given number of jobs.",
+ "This option tells ctest to run the tests in parallel using given "
+ "number of jobs."},
{"-Q,--quiet", "Make ctest quiet.",
"This option will suppress all the output. The output log file will "
"still be generated if the --output-log is specified. Options such "
@@ -180,8 +184,8 @@ static const char * cmDocumentationOptions[][3] =
{"--build-project", "Specify the name of the project to build.", "" },
{"--build-makeprogram", "Specify the make program to use.", "" },
{"--build-noclean", "Skip the make clean step.", "" },
- {"--build-config-sample",
- "A sample executable to use to determine the configuration",
+ {"--build-config-sample",
+ "A sample executable to use to determine the configuration",
"A sample executable to use to determine the configuration that "
"should be used. e.g. Debug/Release/etc" },
{"--build-options", "Add extra options to the build step.",
@@ -276,7 +280,7 @@ int main (int argc, char *argv[])
// If there is a testing input file, check for documentation options
// only if there are actually arguments. We want running without
// arguments to run tests.
- if(argc > 1 || !(cmSystemTools::FileExists("CTestTestfile.cmake") ||
+ if(argc > 1 || !(cmSystemTools::FileExists("CTestTestfile.cmake") ||
cmSystemTools::FileExists("DartTestfile.txt")))
{
if(argc == 1)
@@ -301,7 +305,7 @@ int main (int argc, char *argv[])
doc.SetSection("Name",cmDocumentationName);
doc.SetSection("Usage",cmDocumentationUsage);
doc.SetSection("Description",cmDocumentationDescription);
- doc.SetSection("Options",cmDocumentationOptions);
+ doc.PrependSection("Options",cmDocumentationOptions);
doc.SetSection("Commands",commands);
doc.SetSeeAlsoList(cmDocumentationSeeAlso);
#ifdef cout
diff --git a/Source/kwsys/CommandLineArguments.cxx b/Source/kwsys/CommandLineArguments.cxx
index 9f43a47..ece88ae 100644
--- a/Source/kwsys/CommandLineArguments.cxx
+++ b/Source/kwsys/CommandLineArguments.cxx
@@ -592,7 +592,7 @@ void CommandLineArguments::GenerateHelp()
// Create format for that string
char format[80];
- sprintf(format, " %%-%ds ", static_cast<unsigned int>(maxlen));
+ sprintf(format, " %%-%us ", static_cast<unsigned int>(maxlen));
maxlen += 4; // For the space before and after the option
diff --git a/Source/kwsys/Glob.cxx b/Source/kwsys/Glob.cxx
index c1f5100..513eb64 100644
--- a/Source/kwsys/Glob.cxx
+++ b/Source/kwsys/Glob.cxx
@@ -215,7 +215,7 @@ kwsys_stl::string Glob::PatternToRegex(const kwsys_stl::string& pattern,
//----------------------------------------------------------------------------
void Glob::RecurseDirectory(kwsys_stl::string::size_type start,
- const kwsys_stl::string& dir, bool dir_only)
+ const kwsys_stl::string& dir)
{
kwsys::Directory d;
if ( !d.Load(dir.c_str()) )
@@ -258,25 +258,24 @@ void Glob::RecurseDirectory(kwsys_stl::string::size_type start,
fullname = dir + "/" + fname;
}
- if ( !dir_only || !kwsys::SystemTools::FileIsDirectory(realname.c_str()) )
+ bool isDir = kwsys::SystemTools::FileIsDirectory(realname.c_str());
+ bool isSymLink = kwsys::SystemTools::FileIsSymlink(realname.c_str());
+
+ if ( isDir && (!isSymLink || this->RecurseThroughSymlinks) )
{
- if ( (this->Internals->Expressions.size() > 0) &&
- this->Internals->Expressions[
- this->Internals->Expressions.size()-1].find(fname.c_str()) )
+ if (isSymLink)
{
- this->AddFile(this->Internals->Files, realname.c_str());
+ ++this->FollowedSymlinkCount;
}
+ this->RecurseDirectory(start+1, realname);
}
- if ( kwsys::SystemTools::FileIsDirectory(realname.c_str()) )
+ else
{
- bool isSymLink = kwsys::SystemTools::FileIsSymlink(realname.c_str());
- if (!isSymLink || this->RecurseThroughSymlinks)
+ if ( (this->Internals->Expressions.size() > 0) &&
+ this->Internals->Expressions[
+ this->Internals->Expressions.size()-1].find(fname.c_str()) )
{
- if (isSymLink)
- {
- ++this->FollowedSymlinkCount;
- }
- this->RecurseDirectory(start+1, realname, dir_only);
+ this->AddFile(this->Internals->Files, realname.c_str());
}
}
}
@@ -284,13 +283,13 @@ void Glob::RecurseDirectory(kwsys_stl::string::size_type start,
//----------------------------------------------------------------------------
void Glob::ProcessDirectory(kwsys_stl::string::size_type start,
- const kwsys_stl::string& dir, bool dir_only)
+ const kwsys_stl::string& dir)
{
//kwsys_ios::cout << "ProcessDirectory: " << dir << kwsys_ios::endl;
bool last = ( start == this->Internals->Expressions.size()-1 );
if ( last && this->Recurse )
{
- this->RecurseDirectory(start, dir, dir_only);
+ this->RecurseDirectory(start, dir);
return;
}
@@ -345,7 +344,7 @@ void Glob::ProcessDirectory(kwsys_stl::string::size_type start,
// << this->Internals->TextExpressions[start].c_str() << kwsys_ios::endl;
//kwsys_ios::cout << "Full name: " << fullname << kwsys_ios::endl;
- if ( (!dir_only || !last) &&
+ if ( !last &&
!kwsys::SystemTools::FileIsDirectory(realname.c_str()) )
{
continue;
@@ -359,7 +358,7 @@ void Glob::ProcessDirectory(kwsys_stl::string::size_type start,
}
else
{
- this->ProcessDirectory(start+1, realname + "/", dir_only);
+ this->ProcessDirectory(start+1, realname + "/");
}
}
}
@@ -462,12 +461,11 @@ bool Glob::FindFiles(const kwsys_stl::string& inexpr)
// Handle network paths
if ( skip > 0 )
{
- this->ProcessDirectory(0, fexpr.substr(0, skip) + "/",
- true);
+ this->ProcessDirectory(0, fexpr.substr(0, skip) + "/");
}
else
{
- this->ProcessDirectory(0, "/", true);
+ this->ProcessDirectory(0, "/");
}
return true;
}
diff --git a/Source/kwsys/Glob.hxx.in b/Source/kwsys/Glob.hxx.in
index cb050ee..88c343c 100644
--- a/Source/kwsys/Glob.hxx.in
+++ b/Source/kwsys/Glob.hxx.in
@@ -83,12 +83,12 @@ public:
protected:
//! Process directory
void ProcessDirectory(kwsys_stl::string::size_type start,
- const kwsys_stl::string& dir, bool dir_only);
+ const kwsys_stl::string& dir);
//! Process last directory, but only when recurse flags is on. That is
// effectively like saying: /path/to/file/**/file
void RecurseDirectory(kwsys_stl::string::size_type start,
- const kwsys_stl::string& dir, bool dir_only);
+ const kwsys_stl::string& dir);
//! Add regular expression
void AddExpression(const char* expr);
diff --git a/Source/kwsys/SystemInformation.cxx b/Source/kwsys/SystemInformation.cxx
index 9bc659e..d49c0d7 100644
--- a/Source/kwsys/SystemInformation.cxx
+++ b/Source/kwsys/SystemInformation.cxx
@@ -72,7 +72,7 @@
# include <ctype.h> // int isdigit(int c);
# include <errno.h> // extern int errno;
# include <sys/time.h>
-#elif __hpux
+#elif defined( __hpux )
# include <sys/param.h>
# include <sys/pstat.h>
#endif
@@ -1454,7 +1454,7 @@ bool SystemInformationImplementation::RetrieveCPUClockSpeed()
{
bool retrieved = false;
-#if _WIN32
+#if defined(_WIN32)
// First of all we check to see if the RDTSC (0x0F, 0x31) instruction is
// supported. If not, we fallback to trying to read this value from the
// registry:
@@ -2389,7 +2389,7 @@ int SystemInformationImplementation::QueryMemory()
this->AvailablePhysicalMemory = 0;
#ifdef __CYGWIN__
return 0;
-#elif _WIN32
+#elif defined(_WIN32)
#if _MSC_VER < 1300
MEMORYSTATUS ms;
unsigned long tv, tp, av, ap;
@@ -2415,7 +2415,7 @@ int SystemInformationImplementation::QueryMemory()
this->AvailableVirtualMemory = av>>10>>10;
this->AvailablePhysicalMemory = ap>>10>>10;
return 1;
-#elif __linux
+#elif defined(__linux)
unsigned long tv=0;
unsigned long tp=0;
unsigned long av=0;
@@ -2532,7 +2532,7 @@ int SystemInformationImplementation::QueryMemory()
}
fclose( fd );
return 1;
-#elif __hpux
+#elif defined(__hpux)
unsigned long tv=0;
unsigned long tp=0;
unsigned long av=0;
@@ -2639,7 +2639,7 @@ LongLong SystemInformationImplementation::GetCyclesDifference (DELAY_FUNC DelayF
/** Compute the delay overhead */
void SystemInformationImplementation::DelayOverhead(unsigned int uiMS)
{
-#if _WIN32
+#if defined(_WIN32)
LARGE_INTEGER Frequency, StartCounter, EndCounter;
__int64 x;
@@ -2664,10 +2664,19 @@ void SystemInformationImplementation::DelayOverhead(unsigned int uiMS)
/** Return the number of logical CPU per physical CPUs Works only for windows */
unsigned char SystemInformationImplementation::LogicalCPUPerPhysicalCPU(void)
{
+#ifdef __APPLE__
+ size_t len = 4;
+ int cores_per_package = 0;
+ int err = sysctlbyname("machdep.cpu.cores_per_package", &cores_per_package, &len, NULL, 0);
+ if (err != 0)
+ {
+ return 1; // That name was not found, default to 1
+ }
+ return static_cast<unsigned char>(cores_per_package);
+#else
unsigned int Regebx = 0;
-
#if USE_ASM_INSTRUCTIONS
- if (!this->IsHyperThreadingSupported())
+ if (!this->IsHyperThreadingSupported())
{
return static_cast<unsigned char>(1); // HT not supported
}
@@ -2678,22 +2687,8 @@ unsigned char SystemInformationImplementation::LogicalCPUPerPhysicalCPU(void)
mov Regebx, ebx
}
#endif
-
-#ifdef __APPLE__
- size_t len = 4;
- int cores_per_package = 0;
- int err = sysctlbyname("machdep.cpu.cores_per_package", &cores_per_package, &len, NULL, 0);
- if (err != 0)
- {
- return 1; // That name was not found, default to 1
- }
- else
- {
- return static_cast<unsigned char>(cores_per_package);
- }
-#endif
-
return static_cast<unsigned char> ((Regebx & NUM_LOGICAL_BITS) >> 16);
+#endif
}
@@ -2769,7 +2764,7 @@ unsigned char SystemInformationImplementation::GetAPICId()
/** Count the number of CPUs. Works only on windows. */
int SystemInformationImplementation::CPUCount()
{
-#if _WIN32
+#if defined(_WIN32)
unsigned char StatusFlag = 0;
SYSTEM_INFO info;
@@ -3359,7 +3354,7 @@ bool SystemInformationImplementation::QueryQNXProcessor()
/** Query the operating system information */
bool SystemInformationImplementation::QueryOSInformation()
{
-#if _WIN32
+#if defined(_WIN32)
this->OSName = "Windows";
diff --git a/Source/kwsys/SystemTools.cxx b/Source/kwsys/SystemTools.cxx
index eefa7f5..ed7f62c 100644
--- a/Source/kwsys/SystemTools.cxx
+++ b/Source/kwsys/SystemTools.cxx
@@ -56,6 +56,7 @@
// support for realpath call
#ifndef _WIN32
+#include <sys/time.h>
#include <utime.h>
#include <limits.h>
#include <sys/wait.h>
@@ -127,7 +128,7 @@ public:
#include <io.h>
#include <direct.h>
#define _unlink unlink
-#endif
+#endif
/* The maximum length of a file name. */
#if defined(PATH_MAX)
@@ -167,9 +168,9 @@ static inline char *realpath(const char *path, char *resolved_path)
snprintf(resolved_path, maxlen, "%s", path);
BPath normalized(resolved_path, NULL, true);
const char *resolved = normalized.Path();
- if (resolved != NULL) // NULL == No such file.
+ if (resolved != NULL) // NULL == No such file.
{
- if (snprintf(resolved_path, maxlen, "%s", resolved) < maxlen)
+ if (snprintf(resolved_path, maxlen, "%s", resolved) < maxlen)
{
return resolved_path;
}
@@ -178,7 +179,7 @@ static inline char *realpath(const char *path, char *resolved_path)
}
#endif
-#if defined(_WIN32) && (defined(_MSC_VER) || defined(__WATCOMC__) || defined(__BORLANDC__) || defined(__MINGW32__))
+#if defined(_WIN32) && (defined(_MSC_VER) || defined(__WATCOMC__) || defined(__BORLANDC__) || defined(__MINGW32__))
inline int Mkdir(const char* dir)
{
return _mkdir(dir);
@@ -281,71 +282,29 @@ extern int putenv (char *__string) __THROW;
}
#endif
-/* Implement floattime() for various platforms */
-// Taken from Python 2.1.3
-
-#if defined( _WIN32 ) && !defined( __CYGWIN__ )
-# include <sys/timeb.h>
-# define HAVE_FTIME
-# if defined( __BORLANDC__)
-# define FTIME ftime
-# define TIMEB timeb
-# else // Visual studio?
-# define FTIME _ftime
-# define TIMEB _timeb
-# endif
-#elif defined( __CYGWIN__ ) || defined( __linux__ ) || defined(__APPLE__)
-# include <sys/time.h>
-# include <time.h>
-# define HAVE_GETTIMEOFDAY
-#endif
-
namespace KWSYS_NAMESPACE
{
-class SystemToolsTranslationMap :
- public kwsys_stl::map<kwsys_stl::string,kwsys_stl::string>
+double SystemTools::GetTime(void)
{
-};
-
-
-double
-SystemTools::GetTime(void)
-{
- /* There are three ways to get the time:
- (1) gettimeofday() -- resolution in microseconds
- (2) ftime() -- resolution in milliseconds
- (3) time() -- resolution in seconds
- In all cases the return value is a float in seconds.
- Since on some systems (e.g. SCO ODT 3.0) gettimeofday() may
- fail, so we fall back on ftime() or time().
- Note: clock resolution does not imply clock accuracy! */
-#ifdef HAVE_GETTIMEOFDAY
- {
+#if defined(_WIN32) && !defined(__CYGWIN__)
+ FILETIME ft;
+ GetSystemTimeAsFileTime(&ft);
+ return (429.4967296*ft.dwHighDateTime
+ + 0.0000001*ft.dwLowDateTime
+ - 11644473600.0);
+#else
struct timeval t;
-#ifdef GETTIMEOFDAY_NO_TZ
- if (gettimeofday(&t) == 0)
-#else /* !GETTIMEOFDAY_NO_TZ */
- if (gettimeofday(&t, static_cast<struct timezone *>(NULL)) == 0)
-#endif /* !GETTIMEOFDAY_NO_TZ */
- return static_cast<double>(t.tv_sec) +
- static_cast<double>(t.tv_usec)*0.000001;
- }
-#endif /* !HAVE_GETTIMEOFDAY */
- {
-#if defined(HAVE_FTIME)
- struct TIMEB t;
- ::FTIME(&t);
- return static_cast<double>(t.time) +
- static_cast<double>(t.millitm) * static_cast<double>(0.001);
-#else /* !HAVE_FTIME */
- time_t secs;
- time(&secs);
- return static_cast<double>(secs);
-#endif /* !HAVE_FTIME */
- }
+ gettimeofday(&t, 0);
+ return 1.0*double(t.tv_sec) + 0.000001*double(t.tv_usec);
+#endif
}
+class SystemToolsTranslationMap :
+ public kwsys_stl::map<kwsys_stl::string,kwsys_stl::string>
+{
+};
+
// adds the elements of the env variable path to the arg passed in
void SystemTools::GetPath(kwsys_stl::vector<kwsys_stl::string>& path, const char* env)
{
@@ -412,6 +371,10 @@ bool SystemTools::GetEnv(const char* key, kwsys_stl::string& result)
}
}
+#ifdef __INTEL_COMPILER
+#pragma warning disable 444
+#endif
+
class kwsysDeletingCharVector : public kwsys_stl::vector<char*>
{
public:
@@ -429,7 +392,7 @@ kwsysDeletingCharVector::~kwsysDeletingCharVector()
#endif
}
bool SystemTools::PutEnv(const char* value)
-{
+{
static kwsysDeletingCharVector localEnvironment;
char* envVar = new char[strlen(value)+1];
strcpy(envVar, value);
@@ -440,14 +403,13 @@ bool SystemTools::PutEnv(const char* value)
return ret == 0;
}
-
const char* SystemTools::GetExecutableExtension()
{
#if defined(_WIN32) || defined(__CYGWIN__) || defined(__VMS)
return ".exe";
#else
return "";
-#endif
+#endif
}
@@ -515,7 +477,7 @@ void SystemTools::ReplaceString(kwsys_stl::string& source,
{
const char *src = source.c_str();
char *searchPos = const_cast<char *>(strstr(src,replace));
-
+
// get out quick if string is not found
if (!searchPos)
{
@@ -532,7 +494,7 @@ void SystemTools::ReplaceString(kwsys_stl::string& source,
char *orig = strdup(src);
char *currentPos = orig;
searchPos = searchPos - src + orig;
-
+
// initialize the result
source.erase(source.begin(),source.end());
do
@@ -584,7 +546,7 @@ static DWORD SystemToolsMakeRegistryMode(DWORD mode,
#endif
// Read a registry value.
-// Example :
+// Example :
// HKEY_LOCAL_MACHINE\SOFTWARE\Python\PythonCore\2.1\InstallPath
// => will return the data of the "default" value of the key
// HKEY_LOCAL_MACHINE\SOFTWARE\Scriptics\Tcl\8.4;Root
@@ -613,7 +575,7 @@ bool SystemTools::ReadRegistryValue(const char *key, kwsys_stl::string &value,
second = primary.substr(start+1, valuenamepos-start-1);
primary = primary.substr(0, start);
-
+
HKEY primaryKey = HKEY_CURRENT_USER;
if (primary == "HKEY_CURRENT_USER")
{
@@ -635,11 +597,11 @@ bool SystemTools::ReadRegistryValue(const char *key, kwsys_stl::string &value,
{
primaryKey = HKEY_USERS;
}
-
+
HKEY hKey;
- if(RegOpenKeyEx(primaryKey,
- second.c_str(),
- 0,
+ if(RegOpenKeyEx(primaryKey,
+ second.c_str(),
+ 0,
SystemToolsMakeRegistryMode(KEY_READ, view),
&hKey) != ERROR_SUCCESS)
{
@@ -650,11 +612,11 @@ bool SystemTools::ReadRegistryValue(const char *key, kwsys_stl::string &value,
DWORD dwType, dwSize;
dwSize = 1023;
char data[1024];
- if(RegQueryValueEx(hKey,
- (LPTSTR)valuename.c_str(),
- NULL,
- &dwType,
- (BYTE *)data,
+ if(RegQueryValueEx(hKey,
+ (LPTSTR)valuename.c_str(),
+ NULL,
+ &dwType,
+ (BYTE *)data,
&dwSize) == ERROR_SUCCESS)
{
if (dwType == REG_SZ)
@@ -689,7 +651,7 @@ bool SystemTools::ReadRegistryValue(const char *, kwsys_stl::string &,
// Write a registry value.
-// Example :
+// Example :
// HKEY_LOCAL_MACHINE\SOFTWARE\Python\PythonCore\2.1\InstallPath
// => will set the data of the "default" value of the key
// HKEY_LOCAL_MACHINE\SOFTWARE\Scriptics\Tcl\8.4;Root
@@ -702,7 +664,7 @@ bool SystemTools::WriteRegistryValue(const char *key, const char *value,
kwsys_stl::string primary = key;
kwsys_stl::string second;
kwsys_stl::string valuename;
-
+
size_t start = primary.find("\\");
if (start == kwsys_stl::string::npos)
{
@@ -717,7 +679,7 @@ bool SystemTools::WriteRegistryValue(const char *key, const char *value,
second = primary.substr(start+1, valuenamepos-start-1);
primary = primary.substr(0, start);
-
+
HKEY primaryKey = HKEY_CURRENT_USER;
if (primary == "HKEY_CURRENT_USER")
{
@@ -739,13 +701,13 @@ bool SystemTools::WriteRegistryValue(const char *key, const char *value,
{
primaryKey = HKEY_USERS;
}
-
+
HKEY hKey;
DWORD dwDummy;
char lpClass[] = "";
- if(RegCreateKeyEx(primaryKey,
- second.c_str(),
- 0,
+ if(RegCreateKeyEx(primaryKey,
+ second.c_str(),
+ 0,
lpClass,
REG_OPTION_NON_VOLATILE,
SystemToolsMakeRegistryMode(KEY_WRITE, view),
@@ -756,11 +718,11 @@ bool SystemTools::WriteRegistryValue(const char *key, const char *value,
return false;
}
- if(RegSetValueEx(hKey,
- (LPTSTR)valuename.c_str(),
- 0,
- REG_SZ,
- (CONST BYTE *)value,
+ if(RegSetValueEx(hKey,
+ (LPTSTR)valuename.c_str(),
+ 0,
+ REG_SZ,
+ (CONST BYTE *)value,
(DWORD)(strlen(value) + 1)) == ERROR_SUCCESS)
{
return true;
@@ -775,7 +737,7 @@ bool SystemTools::WriteRegistryValue(const char *, const char *, KeyWOW64)
#endif
// Delete a registry value.
-// Example :
+// Example :
// HKEY_LOCAL_MACHINE\SOFTWARE\Python\PythonCore\2.1\InstallPath
// => will delete the data of the "default" value of the key
// HKEY_LOCAL_MACHINE\SOFTWARE\Scriptics\Tcl\8.4;Root
@@ -787,7 +749,7 @@ bool SystemTools::DeleteRegistryValue(const char *key, KeyWOW64 view)
kwsys_stl::string primary = key;
kwsys_stl::string second;
kwsys_stl::string valuename;
-
+
size_t start = primary.find("\\");
if (start == kwsys_stl::string::npos)
{
@@ -802,7 +764,7 @@ bool SystemTools::DeleteRegistryValue(const char *key, KeyWOW64 view)
second = primary.substr(start+1, valuenamepos-start-1);
primary = primary.substr(0, start);
-
+
HKEY primaryKey = HKEY_CURRENT_USER;
if (primary == "HKEY_CURRENT_USER")
{
@@ -824,11 +786,11 @@ bool SystemTools::DeleteRegistryValue(const char *key, KeyWOW64 view)
{
primaryKey = HKEY_USERS;
}
-
+
HKEY hKey;
- if(RegOpenKeyEx(primaryKey,
- second.c_str(),
- 0,
+ if(RegOpenKeyEx(primaryKey,
+ second.c_str(),
+ 0,
SystemToolsMakeRegistryMode(KEY_WRITE, view),
&hKey) != ERROR_SUCCESS)
{
@@ -836,7 +798,7 @@ bool SystemTools::DeleteRegistryValue(const char *key, KeyWOW64 view)
}
else
{
- if(RegDeleteValue(hKey,
+ if(RegDeleteValue(hKey,
(LPTSTR)valuename.c_str()) == ERROR_SUCCESS)
{
RegCloseKey(hKey);
@@ -857,17 +819,17 @@ bool SystemTools::SameFile(const char* file1, const char* file2)
#ifdef _WIN32
HANDLE hFile1, hFile2;
- hFile1 = CreateFile( file1,
- GENERIC_READ,
+ hFile1 = CreateFile( file1,
+ GENERIC_READ,
FILE_SHARE_READ ,
NULL,
OPEN_EXISTING,
FILE_FLAG_BACKUP_SEMANTICS,
NULL
);
- hFile2 = CreateFile( file2,
- GENERIC_READ,
- FILE_SHARE_READ,
+ hFile2 = CreateFile( file2,
+ GENERIC_READ,
+ FILE_SHARE_READ,
NULL,
OPEN_EXISTING,
FILE_FLAG_BACKUP_SEMANTICS,
@@ -901,10 +863,10 @@ bool SystemTools::SameFile(const char* file1, const char* file2)
{
// see if the files are the same file
// check the device inode and size
- if(memcmp(&fileStat2.st_dev, &fileStat1.st_dev, sizeof(fileStat1.st_dev)) == 0 &&
+ if(memcmp(&fileStat2.st_dev, &fileStat1.st_dev, sizeof(fileStat1.st_dev)) == 0 &&
memcmp(&fileStat2.st_ino, &fileStat1.st_ino, sizeof(fileStat1.st_ino)) == 0 &&
- fileStat2.st_size == fileStat1.st_size
- )
+ fileStat2.st_size == fileStat1.st_size
+ )
{
return true;
}
@@ -1101,11 +1063,11 @@ kwsys_stl::string SystemTools::CapitalizedWords(const kwsys_stl::string& s)
#if defined(_MSC_VER) && defined (_MT) && defined (_DEBUG)
// MS has an assert that will fail if s[i] < 0; setting
// LC_CTYPE using setlocale() does *not* help. Painful.
- if ((int)s[i] >= 0 && isalpha(s[i]) &&
+ if ((int)s[i] >= 0 && isalpha(s[i]) &&
(i == 0 || ((int)s[i - 1] >= 0 && isspace(s[i - 1]))))
#else
if (isalpha(s[i]) && (i == 0 || isspace(s[i - 1])))
-#endif
+#endif
{
n[i] = static_cast<kwsys_stl::string::value_type>(toupper(s[i]));
}
@@ -1122,11 +1084,11 @@ kwsys_stl::string SystemTools::UnCapitalizedWords(const kwsys_stl::string& s)
#if defined(_MSC_VER) && defined (_MT) && defined (_DEBUG)
// MS has an assert that will fail if s[i] < 0; setting
// LC_CTYPE using setlocale() does *not* help. Painful.
- if ((int)s[i] >= 0 && isalpha(s[i]) &&
+ if ((int)s[i] >= 0 && isalpha(s[i]) &&
(i == 0 || ((int)s[i - 1] >= 0 && isspace(s[i - 1]))))
#else
if (isalpha(s[i]) && (i == 0 || isspace(s[i - 1])))
-#endif
+#endif
{
n[i] = static_cast<kwsys_stl::string::value_type>(tolower(s[i]));
}
@@ -1204,7 +1166,7 @@ char* SystemTools::AppendStrings(
return newstr;
}
-// Return a lower case string
+// Return a lower case string
kwsys_stl::string SystemTools::LowerCase(const kwsys_stl::string& s)
{
kwsys_stl::string n;
@@ -1216,7 +1178,7 @@ kwsys_stl::string SystemTools::LowerCase(const kwsys_stl::string& s)
return n;
}
-// Return a lower case string
+// Return a lower case string
kwsys_stl::string SystemTools::UpperCase(const kwsys_stl::string& s)
{
kwsys_stl::string n;
@@ -1346,7 +1308,7 @@ const char* SystemTools::FindLastString(const char* str1, const char* str2)
{
return NULL;
}
-
+
size_t len1 = strlen(str1), len2 = strlen(str2);
if (len1 >= len2)
{
@@ -1374,8 +1336,8 @@ char* SystemTools::DuplicateString(const char* str)
return NULL;
}
-// Return a cropped string
-kwsys_stl::string SystemTools::CropString(const kwsys_stl::string& s,
+// Return a cropped string
+kwsys_stl::string SystemTools::CropString(const kwsys_stl::string& s,
size_t max_len)
{
if (!s.size() || max_len == 0 || max_len >= s.size())
@@ -1419,7 +1381,7 @@ kwsys_stl::vector<kwsys::String> SystemTools::SplitString(const char* p, char se
if(isPath && path[0] == '/')
{
path.erase(path.begin());
- paths.push_back("/");
+ paths.push_back("/");
}
kwsys_stl::string::size_type pos1 = 0;
kwsys_stl::string::size_type pos2 = path.find(sep, pos1+1);
@@ -1428,9 +1390,9 @@ kwsys_stl::vector<kwsys::String> SystemTools::SplitString(const char* p, char se
paths.push_back(path.substr(pos1, pos2-pos1));
pos1 = pos2+1;
pos2 = path.find(sep, pos1+1);
- }
+ }
paths.push_back(path.substr(pos1, pos2-pos1));
-
+
return paths;
}
@@ -1444,11 +1406,11 @@ int SystemTools::EstimateFormatLength(const char *format, va_list ap)
// Quick-hack attempt at estimating the length of the string.
// Should never under-estimate.
-
+
// Start with the length of the format string itself.
size_t length = strlen(format);
-
+
// Increase the length for every argument in the format.
const char* cur = format;
@@ -1480,7 +1442,7 @@ int SystemTools::EstimateFormatLength(const char *format, va_list ap)
{
// Assume the argument contributes no more than 64 characters.
length += 64;
-
+
// Eat the argument.
static_cast<void>(va_arg(ap, double));
} break;
@@ -1488,24 +1450,24 @@ int SystemTools::EstimateFormatLength(const char *format, va_list ap)
{
// Assume the argument contributes no more than 64 characters.
length += 64;
-
+
// Eat the argument.
static_cast<void>(va_arg(ap, int));
} break;
}
}
-
+
// Move past the characters just tested.
++cur;
}
}
-
+
return static_cast<int>(length);
}
kwsys_stl::string SystemTools::EscapeChars(
- const char *str,
- const char *chars_to_escape,
+ const char *str,
+ const char *chars_to_escape,
char escape_char)
{
kwsys_stl::string n;
@@ -1562,7 +1524,7 @@ static void ConvertVMSToUnix(kwsys_stl::string& path)
}
#endif
-// convert windows slashes to unix slashes
+// convert windows slashes to unix slashes
void SystemTools::ConvertToUnixSlashes(kwsys_stl::string& path)
{
const char* pathCString = path.c_str();
@@ -1629,7 +1591,7 @@ void SystemTools::ConvertToUnixSlashes(kwsys_stl::string& path)
}
}
#endif
- // remove trailing slash if the path is more than
+ // remove trailing slash if the path is more than
// a single /
pathCString = path.c_str();
if(path.size() > 1 && *(pathCString+(path.size()-1)) == '/')
@@ -1647,7 +1609,7 @@ void SystemTools::ConvertToUnixSlashes(kwsys_stl::string& path)
kwsys_stl::string SystemTools::ConvertToUnixOutputPath(const char* path)
{
kwsys_stl::string ret = path;
-
+
// remove // except at the beginning might be a cygwin drive
kwsys_stl::string::size_type pos=1;
while((pos = ret.find("//", pos)) != kwsys_stl::string::npos)
@@ -1685,7 +1647,7 @@ kwsys_stl::string SystemTools::ConvertToOutputPath(const char* path)
// remove double slashes not at the start
kwsys_stl::string SystemTools::ConvertToWindowsOutputPath(const char* path)
-{
+{
kwsys_stl::string ret;
// make it big enough for all of path and double quotes
ret.reserve(strlen(path)+3);
@@ -1771,13 +1733,13 @@ bool SystemTools::FilesDiffer(const char* source,
const char* destination)
{
struct stat statSource;
- if (stat(source, &statSource) != 0)
+ if (stat(source, &statSource) != 0)
{
return true;
}
struct stat statDestination;
- if (stat(destination, &statDestination) != 0)
+ if (stat(destination, &statDestination) != 0)
{
return true;
}
@@ -1823,7 +1785,7 @@ bool SystemTools::FilesDiffer(const char* source,
{
return true;
}
-
+
// If this block differs the file differs.
if(memcmp(static_cast<const void*>(source_buf),
static_cast<const void*>(dest_buf),
@@ -1882,7 +1844,7 @@ bool SystemTools::CopyFileAlways(const char* source, const char* destination)
// Open files
#if defined(_WIN32) || defined(__CYGWIN__)
- kwsys_ios::ifstream fin(source,
+ kwsys_ios::ifstream fin(source,
kwsys_ios::ios::binary | kwsys_ios::ios::in);
#else
kwsys_ios::ifstream fin(source);
@@ -1891,7 +1853,7 @@ bool SystemTools::CopyFileAlways(const char* source, const char* destination)
{
return false;
}
-
+
// try and remove the destination file so that read only destination files
// can be written to.
// If the remove fails continue so that files in read only directories
@@ -1899,17 +1861,17 @@ bool SystemTools::CopyFileAlways(const char* source, const char* destination)
SystemTools::RemoveFile(destination);
#if defined(_WIN32) || defined(__CYGWIN__)
- kwsys_ios::ofstream fout(destination,
+ kwsys_ios::ofstream fout(destination,
kwsys_ios::ios::binary | kwsys_ios::ios::out | kwsys_ios::ios::trunc);
#else
- kwsys_ios::ofstream fout(destination,
+ kwsys_ios::ofstream fout(destination,
kwsys_ios::ios::out | kwsys_ios::ios::trunc);
#endif
if(!fout)
{
return false;
}
-
+
// This copy loop is very sensitive on certain platforms with
// slightly broken stream libraries (like HPUX). Normally, it is
// incorrect to not check the error condition on the fin.read()
@@ -1923,12 +1885,12 @@ bool SystemTools::CopyFileAlways(const char* source, const char* destination)
fout.write(buffer, fin.gcount());
}
}
-
+
// Make sure the operating system has finished writing the file
// before closing it. This will ensure the file is finished before
// the check below.
fout.flush();
-
+
fin.close();
fout.close();
@@ -2012,7 +1974,7 @@ bool SystemTools::CopyADirectory(const char* source, const char* destination,
unsigned long SystemTools::FileLength(const char* filename)
{
struct stat fs;
- if (stat(filename, &fs) != 0)
+ if (stat(filename, &fs) != 0)
{
return 0;
}
@@ -2258,7 +2220,7 @@ kwsys_stl::string SystemTools
{
// Add the system search path to our path first
kwsys_stl::vector<kwsys_stl::string> path;
- if (!no_system_path)
+ if (!no_system_path)
{
SystemTools::GetPath(path, "CMAKE_FILE_PATH");
SystemTools::GetPath(path);
@@ -2373,7 +2335,7 @@ kwsys_stl::string SystemTools::FindProgram(
// first try with extensions if the os supports them
if(extensions.size())
{
- for(kwsys_stl::vector<kwsys_stl::string>::iterator i =
+ for(kwsys_stl::vector<kwsys_stl::string>::iterator i =
extensions.begin(); i != extensions.end(); ++i)
{
tryPath = name;
@@ -2401,7 +2363,7 @@ kwsys_stl::string SystemTools::FindProgram(
}
// now add the additional paths
{
- for(kwsys_stl::vector<kwsys_stl::string>::const_iterator i =
+ for(kwsys_stl::vector<kwsys_stl::string>::const_iterator i =
userPaths.begin(); i != userPaths.end(); ++i)
{
path.push_back(*i);
@@ -2430,7 +2392,7 @@ kwsys_stl::string SystemTools::FindProgram(
// first try with extensions
if(extensions.size())
{
- for(kwsys_stl::vector<kwsys_stl::string>::iterator ext
+ for(kwsys_stl::vector<kwsys_stl::string>::iterator ext
= extensions.begin(); ext != extensions.end(); ++ext)
{
tryPath = *p;
@@ -2995,7 +2957,7 @@ kwsys_stl::string SystemTools::RelativePath(const char* local, const char* remot
}
// split up both paths into arrays of strings using / as a separator
- kwsys_stl::vector<kwsys::String> localSplit = SystemTools::SplitString(local, '/', true);
+ kwsys_stl::vector<kwsys::String> localSplit = SystemTools::SplitString(local, '/', true);
kwsys_stl::vector<kwsys::String> remoteSplit = SystemTools::SplitString(remote, '/', true);
kwsys_stl::vector<kwsys::String> commonPath; // store shared parts of path in this array
kwsys_stl::vector<kwsys::String> finalPath; // store the final relative path here
@@ -3052,7 +3014,7 @@ kwsys_stl::string SystemTools::RelativePath(const char* local, const char* remot
}
}
kwsys_stl::string relativePath; // result string
- // now turn the array of directories into a unix path by puttint /
+ // now turn the array of directories into a unix path by puttint /
// between each entry that does not already have one
for(kwsys_stl::vector<String>::iterator vit1 = finalPath.begin();
vit1 != finalPath.end(); ++vit1)
@@ -3429,7 +3391,7 @@ kwsys_stl::string SystemTools::GetFilenamePath(const kwsys_stl::string& filename
{
kwsys_stl::string fn = filename;
SystemTools::ConvertToUnixSlashes(fn);
-
+
kwsys_stl::string::size_type slash_pos = fn.rfind("/");
if(slash_pos != kwsys_stl::string::npos)
{
@@ -3548,7 +3510,7 @@ SystemTools::GetFilenameWithoutLastExtension(const kwsys_stl::string& filename)
}
bool SystemTools::FileHasSignature(const char *filename,
- const char *signature,
+ const char *signature,
long offset)
{
if (!filename || !signature)
@@ -3580,9 +3542,9 @@ bool SystemTools::FileHasSignature(const char *filename,
return res;
}
-SystemTools::FileTypeEnum
+SystemTools::FileTypeEnum
SystemTools::DetectFileType(const char *filename,
- unsigned long length,
+ unsigned long length,
double percent_bin)
{
if (!filename || percent_bin < 0)
@@ -3610,13 +3572,13 @@ SystemTools::DetectFileType(const char *filename,
// Loop over contents and count
size_t text_count = 0;
-
+
const unsigned char *ptr = buffer;
const unsigned char *buffer_end = buffer + read_length;
while (ptr != buffer_end)
{
- if ((*ptr >= 0x20 && *ptr <= 0x7F) ||
+ if ((*ptr >= 0x20 && *ptr <= 0x7F) ||
*ptr == '\n' ||
*ptr == '\r' ||
*ptr == '\t')
@@ -3628,7 +3590,7 @@ SystemTools::DetectFileType(const char *filename,
delete [] buffer;
- double current_percent_bin =
+ double current_percent_bin =
(static_cast<double>(read_length - text_count) /
static_cast<double>(read_length));
@@ -3640,8 +3602,8 @@ SystemTools::DetectFileType(const char *filename,
return SystemTools::FileTypeText;
}
-bool SystemTools::LocateFileInDir(const char *filename,
- const char *dir,
+bool SystemTools::LocateFileInDir(const char *filename,
+ const char *dir,
kwsys_stl::string& filename_found,
int try_filename_dirs)
{
@@ -3654,7 +3616,7 @@ bool SystemTools::LocateFileInDir(const char *filename,
kwsys_stl::string filename_base = SystemTools::GetFilenameName(filename);
- // Check if 'dir' is really a directory
+ // Check if 'dir' is really a directory
// If win32 and matches something like C:, accept it as a dir
kwsys_stl::string real_dir;
@@ -3678,7 +3640,7 @@ bool SystemTools::LocateFileInDir(const char *filename,
if (filename_base.size() && dir)
{
size_t dir_len = strlen(dir);
- int need_slash =
+ int need_slash =
(dir_len && dir[dir_len - 1] != '/' && dir[dir_len - 1] != '\\');
kwsys_stl::string temp = dir;
@@ -3709,7 +3671,7 @@ bool SystemTools::LocateFileInDir(const char *filename,
filename_dir = SystemTools::GetFilenamePath(filename_dir);
filename_dir_base = SystemTools::GetFilenameName(filename_dir);
#if defined( _WIN32 )
- if (!filename_dir_base.size() ||
+ if (!filename_dir_base.size() ||
filename_dir_base[filename_dir_base.size() - 1] == ':')
#else
if (!filename_dir_base.size())
@@ -3733,7 +3695,7 @@ bool SystemTools::LocateFileInDir(const char *filename,
} while (!res && filename_dir_base.size());
}
}
-
+
return res;
}
@@ -3779,12 +3741,12 @@ bool SystemTools::FileIsFullPath(const char* in_name)
bool SystemTools::GetShortPath(const char* path, kwsys_stl::string& shortPath)
{
-#if defined(WIN32) && !defined(__CYGWIN__)
+#if defined(WIN32) && !defined(__CYGWIN__)
const int size = int(strlen(path)) +1; // size of return
char *buffer = new char[size]; // create a buffer
char *tempPath = new char[size]; // create a buffer
int ret;
-
+
// if the path passed in has quotes around it, first remove the quotes
if (path[0] == '"' && path[strlen(path)-1] == '"')
{
@@ -3795,7 +3757,7 @@ bool SystemTools::GetShortPath(const char* path, kwsys_stl::string& shortPath)
{
strcpy(tempPath,path);
}
-
+
buffer[0] = 0;
ret = GetShortPathName(tempPath, buffer, size);
@@ -3818,7 +3780,7 @@ bool SystemTools::GetShortPath(const char* path, kwsys_stl::string& shortPath)
#endif
}
-void SystemTools::SplitProgramFromArgs(const char* path,
+void SystemTools::SplitProgramFromArgs(const char* path,
kwsys_stl::string& program, kwsys_stl::string& args)
{
// see if this is a full path to a program
@@ -3830,7 +3792,7 @@ void SystemTools::SplitProgramFromArgs(const char* path,
return;
}
// Try to find the program in the path, note the program
- // may have spaces in its name so we have to look for it
+ // may have spaces in its name so we have to look for it
kwsys_stl::vector<kwsys_stl::string> e;
kwsys_stl::string findProg = SystemTools::FindProgram(path, e);
if(findProg.size())
@@ -3861,7 +3823,7 @@ void SystemTools::SplitProgramFromArgs(const char* path,
args = dir.substr(spacePos, dir.size()-spacePos);
return;
}
- // Now try and find the the program in the path
+ // Now try and find the the program in the path
findProg = SystemTools::FindProgram(tryProg.c_str(), e);
if(findProg.size())
{
@@ -4236,23 +4198,23 @@ kwsys_stl::string SystemTools::GetOperatingSystemNameAndVersion()
if (!bOsVersionInfoEx)
{
osvi.dwOSVersionInfoSize = sizeof(OSVERSIONINFO);
- if (!GetVersionEx((OSVERSIONINFO *)&osvi))
+ if (!GetVersionEx((OSVERSIONINFO *)&osvi))
{
return 0;
}
}
-
+
switch (osvi.dwPlatformId)
{
// Test for the Windows NT product family.
case VER_PLATFORM_WIN32_NT:
-
+
// Test for the specific product family.
if (osvi.dwMajorVersion == 6 && osvi.dwMinorVersion == 0)
{
-#if (_MSC_VER >= 1300)
+#if (_MSC_VER >= 1300)
if (osvi.wProductType == VER_NT_WORKSTATION)
{
res += "Microsoft Windows Vista";
@@ -4292,7 +4254,7 @@ kwsys_stl::string SystemTools::GetOperatingSystemNameAndVersion()
{
// Test for the workstation type.
-#if (_MSC_VER >= 1300)
+#if (_MSC_VER >= 1300)
if (osvi.wProductType == VER_NT_WORKSTATION)
{
if (osvi.dwMajorVersion == 4)
@@ -4311,7 +4273,7 @@ kwsys_stl::string SystemTools::GetOperatingSystemNameAndVersion()
}
}
}
-
+
// Test for the server type.
else if (osvi.wProductType == VER_NT_SERVER)
@@ -4335,7 +4297,7 @@ kwsys_stl::string SystemTools::GetOperatingSystemNameAndVersion()
res += " Standard Edition";
}
}
-
+
else if (osvi.dwMajorVersion == 5 && osvi.dwMinorVersion == 0)
{
if (osvi.wSuiteMask & VER_SUITE_DATACENTER)
@@ -4352,7 +4314,7 @@ kwsys_stl::string SystemTools::GetOperatingSystemNameAndVersion()
}
}
- else if (osvi.dwMajorVersion <= 4) // Windows NT 4.0
+ else if (osvi.dwMajorVersion <= 4) // Windows NT 4.0
{
if (osvi.wSuiteMask & VER_SUITE_ENTERPRISE)
{
@@ -4369,7 +4331,7 @@ kwsys_stl::string SystemTools::GetOperatingSystemNameAndVersion()
// Test for specific product on Windows NT 4.0 SP5 and earlier
- else
+ else
{
HKEY hKey;
#define BUFSIZE 80
@@ -4419,7 +4381,7 @@ kwsys_stl::string SystemTools::GetOperatingSystemNameAndVersion()
// Display service pack (if any) and build number.
- if (osvi.dwMajorVersion == 4 &&
+ if (osvi.dwMajorVersion == 4 &&
lstrcmpi(osvi.szCSDVersion, "Service Pack 6") == 0)
{
HKEY hKey;
@@ -4448,7 +4410,7 @@ kwsys_stl::string SystemTools::GetOperatingSystemNameAndVersion()
res += buffer;
res += ")";
}
-
+
RegCloseKey(hKey);
}
else // Windows NT 3.51 and earlier or Windows 2000 and later
@@ -4488,11 +4450,11 @@ kwsys_stl::string SystemTools::GetOperatingSystemNameAndVersion()
if (osvi.dwMajorVersion == 4 && osvi.dwMinorVersion == 90)
{
res += "Microsoft Windows Millennium Edition";
- }
+ }
break;
case VER_PLATFORM_WIN32s:
-
+
res += "Microsoft Win32s";
break;
}
@@ -4502,7 +4464,7 @@ kwsys_stl::string SystemTools::GetOperatingSystemNameAndVersion()
}
// ----------------------------------------------------------------------
-bool SystemTools::ParseURLProtocol( const kwsys_stl::string& URL,
+bool SystemTools::ParseURLProtocol( const kwsys_stl::string& URL,
kwsys_stl::string& protocol,
kwsys_stl::string& dataglom )
{
@@ -4520,12 +4482,12 @@ bool SystemTools::ParseURLProtocol( const kwsys_stl::string& URL,
}
// ----------------------------------------------------------------------
-bool SystemTools::ParseURL( const kwsys_stl::string& URL,
+bool SystemTools::ParseURL( const kwsys_stl::string& URL,
kwsys_stl::string& protocol,
- kwsys_stl::string& username,
- kwsys_stl::string& password,
- kwsys_stl::string& hostname,
- kwsys_stl::string& dataport,
+ kwsys_stl::string& username,
+ kwsys_stl::string& password,
+ kwsys_stl::string& hostname,
+ kwsys_stl::string& dataport,
kwsys_stl::string& database )
{
kwsys::RegularExpression urlRe( VTK_URL_REGEX );
@@ -4548,7 +4510,7 @@ bool SystemTools::ParseURL( const kwsys_stl::string& URL,
hostname = urlRe.match( 6 );
dataport = urlRe.match( 8 );
database = urlRe.match( 9 );
-
+
return true;
}
@@ -4614,8 +4576,6 @@ void SystemTools::ClassInitialize()
// for windows because drive letters need to be maintained. Also,
// there are not sym-links and mount points on windows anyway.
#if !defined(_WIN32) || defined(__CYGWIN__)
- // Work-around an SGI problem by always adding this mapping:
- SystemTools::AddTranslationPath("/tmp_mnt/", "/");
// The tmp path is frequently a logical path so always keep it:
SystemTools::AddKeepPath("/tmp/");
diff --git a/Source/kwsys/SystemTools.hxx.in b/Source/kwsys/SystemTools.hxx.in
index cf47923..04f1978 100644
--- a/Source/kwsys/SystemTools.hxx.in
+++ b/Source/kwsys/SystemTools.hxx.in
@@ -612,7 +612,7 @@ public:
* Up to 'length' bytes are read from the file, if more than 'percent_bin' %
* of the bytes are non-textual elements, the file is considered binary,
* otherwise textual. Textual elements are bytes in the ASCII [0x20, 0x7E]
- * range, but also \n, \r, \t.
+ * range, but also \\n, \\r, \\t.
* The algorithm is simplistic, and should probably check for usual file
* extensions, 'magic' signature, unicode, etc.
*/
@@ -690,13 +690,7 @@ public:
* -----------------------------------------------------------------
*/
- /**
- * Get current time as a double. On certain platforms this will
- * return higher resolution than seconds:
- * (1) gettimeofday() -- resolution in microseconds
- * (2) ftime() -- resolution in milliseconds
- * (3) time() -- resolution in seconds
- */
+ /** Get current time in seconds since Posix Epoch (Jan 1, 1970). */
static double GetTime();
/**
@@ -818,7 +812,7 @@ public:
* Convert windows-style arguments given as a command-line string
* into more traditional argc/argv arguments.
* Note that argv[0] will be assigned the executable name using
- * the ::GetModuleFileName function.
+ * the GetModuleFileName() function.
*/
static void ConvertWindowsCommandLineToUnixArguments(
const char *cmd_line, int *argc, char ***argv);
diff --git a/Source/kwsys/hash_fun.hxx.in b/Source/kwsys/hash_fun.hxx.in
index f21efc5..8c5eb6a 100644
--- a/Source/kwsys/hash_fun.hxx.in
+++ b/Source/kwsys/hash_fun.hxx.in
@@ -38,8 +38,9 @@
#define @KWSYS_NAMESPACE@_hash_fun_hxx
#include <@KWSYS_NAMESPACE@/Configure.hxx>
-
+#include <@KWSYS_NAMESPACE@/FundamentalType.h>
#include <@KWSYS_NAMESPACE@/cstddef> // size_t
+#include <@KWSYS_NAMESPACE@/stl/string> // string
namespace @KWSYS_NAMESPACE@
{
@@ -66,6 +67,18 @@ struct hash<const char*> {
};
@KWSYS_NAMESPACE@_CXX_DEFINE_SPECIALIZATION
+ struct hash<@KWSYS_NAMESPACE@_stl::string> {
+ size_t operator()(const @KWSYS_NAMESPACE@_stl::string & __s) const { return _stl_hash_string(__s.c_str()); }
+};
+
+#if !defined(__BORLANDC__)
+@KWSYS_NAMESPACE@_CXX_DEFINE_SPECIALIZATION
+ struct hash<const @KWSYS_NAMESPACE@_stl::string> {
+ size_t operator()(const @KWSYS_NAMESPACE@_stl::string & __s) const { return _stl_hash_string(__s.c_str()); }
+};
+#endif
+
+@KWSYS_NAMESPACE@_CXX_DEFINE_SPECIALIZATION
struct hash<char> {
size_t operator()(char __x) const { return __x; }
};
@@ -110,6 +123,28 @@ struct hash<unsigned long> {
size_t operator()(unsigned long __x) const { return __x; }
};
+// use long long or __int64
+#if @KWSYS_NAMESPACE@_USE_LONG_LONG
+@KWSYS_NAMESPACE@_CXX_DEFINE_SPECIALIZATION
+struct hash<long long> {
+ size_t operator()(long long __x) const { return __x; }
+};
+
+@KWSYS_NAMESPACE@_CXX_DEFINE_SPECIALIZATION
+struct hash<unsigned long long> {
+ size_t operator()(unsigned long long __x) const { return __x; }
+};
+#elif @KWSYS_NAMESPACE@_USE___INT64
+@KWSYS_NAMESPACE@_CXX_DEFINE_SPECIALIZATION
+struct hash<__int64> {
+ size_t operator()(__int64 __x) const { return __x; }
+};
+@KWSYS_NAMESPACE@_CXX_DEFINE_SPECIALIZATION
+struct hash<unsigned __int64> {
+ size_t operator()(unsigned __int64 __x) const { return __x; }
+};
+#endif // use long long or __int64
+
} // namespace @KWSYS_NAMESPACE@
#endif
diff --git a/Source/kwsys/kwsysDateStamp.cmake b/Source/kwsys/kwsysDateStamp.cmake
index 3463dff..9e6a6d8 100644
--- a/Source/kwsys/kwsysDateStamp.cmake
+++ b/Source/kwsys/kwsysDateStamp.cmake
@@ -15,7 +15,7 @@
SET(KWSYS_DATE_STAMP_YEAR 2011)
# KWSys version date month component. Format is MM.
-SET(KWSYS_DATE_STAMP_MONTH 06)
+SET(KWSYS_DATE_STAMP_MONTH 11)
# KWSys version date day component. Format is DD.
-SET(KWSYS_DATE_STAMP_DAY 27)
+SET(KWSYS_DATE_STAMP_DAY 14)