diff options
-rw-r--r-- | Modules/CMakeExtraGeneratorDetermineCompilerMacrosAndIncludeDirs.cmake | 25 | ||||
-rw-r--r-- | Modules/FindJava.cmake | 6 | ||||
-rw-r--r-- | Source/CMakeVersion.cmake | 2 | ||||
-rw-r--r-- | Source/CTest/cmCTestScriptHandler.cxx | 9 | ||||
-rw-r--r-- | Source/cmCTest.cxx | 88 | ||||
-rw-r--r-- | Source/cmCTest.h | 14 | ||||
-rw-r--r-- | Source/cmDocumentation.cxx | 58 | ||||
-rw-r--r-- | Source/cmDocumentation.h | 38 | ||||
-rw-r--r-- | Source/cmDocumentationFormatterMan.cxx | 16 | ||||
-rw-r--r-- | Source/cmDocumentationFormatterMan.h | 3 | ||||
-rw-r--r-- | Source/cmGlobalNinjaGenerator.cxx | 11 | ||||
-rw-r--r-- | Source/cmInstallCommand.h | 5 | ||||
-rw-r--r-- | Source/cmNinjaTargetGenerator.cxx | 16 | ||||
-rw-r--r-- | Source/cmakemain.cxx | 44 | ||||
-rw-r--r-- | Source/ctest.cxx | 6 | ||||
-rw-r--r-- | Tests/CMakeLists.txt | 13 | ||||
-rw-r--r-- | Tests/CTestConfig/ScriptWithArgs.cmake | 16 | ||||
-rw-r--r-- | Utilities/KWIML/ABI.h.in | 4 | ||||
-rw-r--r-- | Utilities/KWIML/INT.h.in | 29 |
19 files changed, 272 insertions, 131 deletions
diff --git a/Modules/CMakeExtraGeneratorDetermineCompilerMacrosAndIncludeDirs.cmake b/Modules/CMakeExtraGeneratorDetermineCompilerMacrosAndIncludeDirs.cmake index 1b4532d..455f95f 100644 --- a/Modules/CMakeExtraGeneratorDetermineCompilerMacrosAndIncludeDirs.cmake +++ b/Modules/CMakeExtraGeneratorDetermineCompilerMacrosAndIncludeDirs.cmake @@ -80,15 +80,10 @@ ENDMACRO(_DETERMINE_GCC_SYSTEM_INCLUDE_DIRS _lang) SET(_orig_lc_all $ENV{LC_ALL}) SET(_orig_lc_messages $ENV{LC_MESSAGES}) SET(_orig_lang $ENV{LANG}) -IF(_orig_lc_all) - SET(ENV{LC_ALL} C) -ENDIF() -IF(_orig_lc_messages) - SET(ENV{LC_MESSAGES} C) -ENDIF() -IF(_orig_lang) - SET(ENV{LANG} C) -ENDIF() + +SET(ENV{LC_ALL} C) +SET(ENV{LC_MESSAGES} C) +SET(ENV{LANG} C) # Now check for C, works for gcc and Intel compiler at least IF (NOT CMAKE_EXTRA_GENERATOR_C_SYSTEM_INCLUDE_DIRS) @@ -109,12 +104,6 @@ IF (NOT CMAKE_EXTRA_GENERATOR_CXX_SYSTEM_INCLUDE_DIRS) ENDIF () # Restore original LC_ALL, LC_MESSAGES, and LANG -IF(_orig_lc_all) - SET(ENV{LC_ALL} ${_orig_lc_all}) -ENDIF() -IF(_orig_lc_messages) - SET(ENV{LC_MESSAGES} ${_orig_lc_messages}) -ENDIF() -IF(_orig_lang) - SET(ENV{LANG} ${_orig_lang}) -ENDIF() +SET(ENV{LC_ALL} ${_orig_lc_all}) +SET(ENV{LC_MESSAGES} ${_orig_lc_messages}) +SET(ENV{LANG} ${_orig_lang}) diff --git a/Modules/FindJava.cmake b/Modules/FindJava.cmake index 34a7077..3457021 100644 --- a/Modules/FindJava.cmake +++ b/Modules/FindJava.cmake @@ -107,9 +107,9 @@ IF(Java_JAVA_EXECUTABLE) # 2. OpenJDK 1.6 # 3. GCJ 1.5 # 4. Kaffe 1.4.2 - IF(var MATCHES "java version \"[0-9]+\\.[0-9]+\\.[0-9_.]+[oem-]*\".*") + IF(var MATCHES "java version \"[0-9]+\\.[0-9]+\\.[0-9_.]+.*\".*") # This is most likely Sun / OpenJDK, or maybe GCJ-java compat layer - STRING( REGEX REPLACE ".* version \"([0-9]+\\.[0-9]+\\.[0-9_.]+)[oem-]*\".*" + STRING( REGEX REPLACE ".* version \"([0-9]+\\.[0-9]+\\.[0-9_.]+.*)\".*" "\\1" Java_VERSION_STRING "${var}" ) ELSEIF(var MATCHES "java full version \"kaffe-[0-9]+\\.[0-9]+\\.[0-9_]+\".*") # Kaffe style @@ -124,7 +124,7 @@ IF(Java_JAVA_EXECUTABLE) STRING( REGEX REPLACE "[0-9]+\\.([0-9]+).*" "\\1" Java_VERSION_MINOR "${Java_VERSION_STRING}" ) STRING( REGEX REPLACE "[0-9]+\\.[0-9]+\\.([0-9]+).*" "\\1" Java_VERSION_PATCH "${Java_VERSION_STRING}" ) # warning tweak version can be empty: - STRING( REGEX REPLACE "[0-9]+\\.[0-9]+\\.[0-9]+\\_?\\.?([0-9]*)$" "\\1" Java_VERSION_TWEAK "${Java_VERSION_STRING}" ) + STRING( REGEX REPLACE "[0-9]+\\.[0-9]+\\.[0-9]+[_\\.]?([0-9]*).*$" "\\1" Java_VERSION_TWEAK "${Java_VERSION_STRING}" ) if( Java_VERSION_TWEAK STREQUAL "" ) # check case where tweak is not defined set(Java_VERSION ${Java_VERSION_MAJOR}.${Java_VERSION_MINOR}.${Java_VERSION_PATCH}) else( ) diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake index 82b9125..7feb0d7 100644 --- a/Source/CMakeVersion.cmake +++ b/Source/CMakeVersion.cmake @@ -2,5 +2,5 @@ SET(CMake_VERSION_MAJOR 2) SET(CMake_VERSION_MINOR 8) SET(CMake_VERSION_PATCH 8) -SET(CMake_VERSION_TWEAK 20120626) +SET(CMake_VERSION_TWEAK 20120709) #SET(CMake_VERSION_RC 1) diff --git a/Source/CTest/cmCTestScriptHandler.cxx b/Source/CTest/cmCTestScriptHandler.cxx index d3ab2ef..8643cb3 100644 --- a/Source/CTest/cmCTestScriptHandler.cxx +++ b/Source/CTest/cmCTestScriptHandler.cxx @@ -435,6 +435,15 @@ int cmCTestScriptHandler::ReadInScript(const std::string& total_script_arg) return 2; } + // Add definitions of variables passed in on the command line: + const std::map<std::string, std::string> &defs = + this->CTest->GetDefinitions(); + for (std::map<std::string, std::string>::const_iterator it = defs.begin(); + it != defs.end(); ++it) + { + this->Makefile->AddDefinition(it->first.c_str(), it->second.c_str()); + } + // finally read in the script if (!this->Makefile->ReadListFile(0, script.c_str()) || cmSystemTools::GetErrorOccuredFlag()) diff --git a/Source/cmCTest.cxx b/Source/cmCTest.cxx index 4aff64b..b5687e3 100644 --- a/Source/cmCTest.cxx +++ b/Source/cmCTest.cxx @@ -1944,29 +1944,6 @@ bool cmCTest::AddTestsForDashboardType(std::string &targ) } else { - cmCTestLog(this, ERROR_MESSAGE, - "CTest -D called with incorrect option: " - << targ << std::endl); - cmCTestLog(this, ERROR_MESSAGE, "Available options are:" << std::endl - << " " << "ctest" << " -D Continuous" << std::endl - << " " << "ctest" - << " -D Continuous(Start|Update|Configure|Build)" << std::endl - << " " << "ctest" - << " -D Continuous(Test|Coverage|MemCheck|Submit)" - << std::endl - << " " << "ctest" << " -D Experimental" << std::endl - << " " << "ctest" - << " -D Experimental(Start|Update|Configure|Build)" - << std::endl - << " " << "ctest" - << " -D Experimental(Test|Coverage|MemCheck|Submit)" - << std::endl - << " " << "ctest" << " -D Nightly" << std::endl - << " " << "ctest" - << " -D Nightly(Start|Update|Configure|Build)" << std::endl - << " " << "ctest" - << " -D Nightly(Test|Coverage|MemCheck|Submit)" << std::endl - << " " << "ctest" << " -D NightlyMemoryCheck" << std::endl); return false; } return true; @@ -1974,6 +1951,27 @@ bool cmCTest::AddTestsForDashboardType(std::string &targ) //---------------------------------------------------------------------- +void cmCTest::ErrorMessageUnknownDashDValue(std::string &val) +{ + cmCTestLog(this, ERROR_MESSAGE, + "CTest -D called with incorrect option: " << val << std::endl); + + cmCTestLog(this, ERROR_MESSAGE, + "Available options are:" << std::endl + << " ctest -D Continuous" << std::endl + << " ctest -D Continuous(Start|Update|Configure|Build)" << std::endl + << " ctest -D Continuous(Test|Coverage|MemCheck|Submit)" << std::endl + << " ctest -D Experimental" << std::endl + << " ctest -D Experimental(Start|Update|Configure|Build)" << std::endl + << " ctest -D Experimental(Test|Coverage|MemCheck|Submit)" << std::endl + << " ctest -D Nightly" << std::endl + << " ctest -D Nightly(Start|Update|Configure|Build)" << std::endl + << " ctest -D Nightly(Test|Coverage|MemCheck|Submit)" << std::endl + << " ctest -D NightlyMemoryCheck" << std::endl); +} + + +//---------------------------------------------------------------------- bool cmCTest::CheckArgument(const std::string& arg, const char* varg1, const char* varg2) { @@ -2232,13 +2230,29 @@ void cmCTest::HandleScriptArguments(size_t &i, } //---------------------------------------------------------------------- +bool cmCTest::AddVariableDefinition(const std::string &arg) +{ + std::string name; + std::string value; + cmCacheManager::CacheEntryType type = cmCacheManager::UNINITIALIZED; + + if (cmCacheManager::ParseEntry(arg.c_str(), name, value, type)) + { + this->Definitions[name] = value; + return true; + } + + return false; +} + +//---------------------------------------------------------------------- // the main entry point of ctest, called from main int cmCTest::Run(std::vector<std::string> &args, std::string* output) { this->FindRunningCMake(); const char* ctestExec = "ctest"; bool cmakeAndTest = false; - bool performSomeTest = true; + bool executeTests = true; bool SRArgumentSpecified = false; // copy the command line @@ -2263,14 +2277,29 @@ int cmCTest::Run(std::vector<std::string> &args, std::string* output) this->ProduceXML = true; i++; std::string targ = args[i]; - // AddTestsForDashboard parses the dashborad type and converts it + // AddTestsForDashboard parses the dashboard type and converts it // into the separate stages if (!this->AddTestsForDashboardType(targ)) { - performSomeTest = false; + if (!this->AddVariableDefinition(targ)) + { + this->ErrorMessageUnknownDashDValue(targ); + executeTests = false; + } } } + // If it's not exactly -D, but it starts with -D, then try to parse out + // a variable definition from it, same as CMake does. Unsuccessful + // attempts are simply ignored since previous ctest versions ignore + // this too. (As well as many other unknown command line args.) + // + if(arg != "-D" && cmSystemTools::StringStartsWith(arg.c_str(), "-D")) + { + std::string input = arg.substr(2); + this->AddVariableDefinition(input); + } + if(this->CheckArgument(arg, "-T", "--test-action") && (i < args.size() -1) ) { @@ -2278,7 +2307,7 @@ int cmCTest::Run(std::vector<std::string> &args, std::string* output) i++; if ( !this->SetTest(args[i].c_str(), false) ) { - performSomeTest = false; + executeTests = false; cmCTestLog(this, ERROR_MESSAGE, "CTest -T called with incorrect option: " << args[i].c_str() << std::endl); @@ -2316,7 +2345,7 @@ int cmCTest::Run(std::vector<std::string> &args, std::string* output) } else { - performSomeTest = false; + executeTests = false; cmCTestLog(this, ERROR_MESSAGE, "CTest -M called with incorrect option: " << str.c_str() << std::endl); @@ -2387,8 +2416,7 @@ int cmCTest::Run(std::vector<std::string> &args, std::string* output) return retv; } - // if some tests must be run - if(performSomeTest) + if(executeTests) { int res; // call process directory diff --git a/Source/cmCTest.h b/Source/cmCTest.h index 7c71b00..beffe9e 100644 --- a/Source/cmCTest.h +++ b/Source/cmCTest.h @@ -417,6 +417,12 @@ public: bool GetLabelSummary() { return this->LabelSummary;} std::string GetCostDataFile(); + + const std::map<std::string, std::string> &GetDefinitions() + { + return this->Definitions; + } + private: std::string ConfigType; std::string ScheduleType; @@ -516,6 +522,12 @@ private: //! parse the option after -D and convert it into the appropriate steps bool AddTestsForDashboardType(std::string &targ); + //! read as "emit an error message for an unknown -D value" + void ErrorMessageUnknownDashDValue(std::string &val); + + //! add a variable definition from a command line -D value + bool AddVariableDefinition(const std::string &arg); + //! parse and process most common command line arguments void HandleCommandLineArguments(size_t &i, std::vector<std::string> &args); @@ -558,6 +570,8 @@ private: int OutputLogFileLastTag; bool OutputTestOutputOnTestFailure; + + std::map<std::string, std::string> Definitions; }; class cmCTestLogWrite diff --git a/Source/cmDocumentation.cxx b/Source/cmDocumentation.cxx index 904a157..1b042ae 100644 --- a/Source/cmDocumentation.cxx +++ b/Source/cmDocumentation.cxx @@ -221,7 +221,7 @@ DOCUMENT_INTRO(CompatCommands, "cmakecompat", cmDocumentation::cmDocumentation() :CurrentFormatter(0) { - this->SetForm(TextForm); + this->SetForm(TextForm, 0); this->addCommonStandardDocSections(); this->ShowGenerators = true; } @@ -594,7 +594,7 @@ bool cmDocumentation::PrintRequestedDocumentation(std::ostream& os) i != this->RequestedHelpItems.end(); ++i) { - this->SetForm(i->HelpForm); + this->SetForm(i->HelpForm, i->ManSection); this->CurrentArgument = i->Argument; // If a file name was given, use it. Otherwise, default to the // given stream. @@ -642,7 +642,8 @@ bool cmDocumentation::PrintRequestedDocumentation(std::ostream& os) cmDocumentation::Form cmDocumentation::GetFormFromFilename( - const std::string& filename) + const std::string& filename, + int* manSection) { std::string ext = cmSystemTools::GetFilenameLastExtension(filename); ext = cmSystemTools::UpperCase(ext); @@ -659,6 +660,10 @@ cmDocumentation::Form cmDocumentation::GetFormFromFilename( // ".1" to ".9" should be manpages if ((ext.length()==2) && (ext[1] >='1') && (ext[1]<='9')) { + if (manSection) + { + *manSection = ext[1] - '0'; + } return cmDocumentation::ManForm; } @@ -1128,49 +1133,57 @@ bool cmDocumentation::CheckOptions(int argc, const char* const* argv, { help.HelpType = cmDocumentation::Properties; GET_OPT_ARGUMENT(help.Filename); - help.HelpForm = this->GetFormFromFilename(help.Filename); + help.HelpForm = this->GetFormFromFilename(help.Filename, + &help.ManSection); } else if(strcmp(argv[i], "--help-policies") == 0) { help.HelpType = cmDocumentation::Policies; GET_OPT_ARGUMENT(help.Filename); - help.HelpForm = this->GetFormFromFilename(help.Filename); + help.HelpForm = this->GetFormFromFilename(help.Filename, + &help.ManSection); } else if(strcmp(argv[i], "--help-variables") == 0) { help.HelpType = cmDocumentation::Variables; GET_OPT_ARGUMENT(help.Filename); - help.HelpForm = this->GetFormFromFilename(help.Filename); + help.HelpForm = this->GetFormFromFilename(help.Filename, + &help.ManSection); } else if(strcmp(argv[i], "--help-modules") == 0) { help.HelpType = cmDocumentation::Modules; GET_OPT_ARGUMENT(help.Filename); - help.HelpForm = this->GetFormFromFilename(help.Filename); + help.HelpForm = this->GetFormFromFilename(help.Filename, + &help.ManSection); } else if(strcmp(argv[i], "--help-custom-modules") == 0) { help.HelpType = cmDocumentation::CustomModules; GET_OPT_ARGUMENT(help.Filename); - help.HelpForm = this->GetFormFromFilename(help.Filename); + help.HelpForm = this->GetFormFromFilename(help.Filename, + &help.ManSection); } else if(strcmp(argv[i], "--help-commands") == 0) { help.HelpType = cmDocumentation::Commands; GET_OPT_ARGUMENT(help.Filename); - help.HelpForm = this->GetFormFromFilename(help.Filename); + help.HelpForm = this->GetFormFromFilename(help.Filename, + &help.ManSection); } else if(strcmp(argv[i], "--help-compatcommands") == 0) { help.HelpType = cmDocumentation::CompatCommands; GET_OPT_ARGUMENT(help.Filename); - help.HelpForm = this->GetFormFromFilename(help.Filename); + help.HelpForm = this->GetFormFromFilename(help.Filename, + &help.ManSection); } else if(strcmp(argv[i], "--help-full") == 0) { help.HelpType = cmDocumentation::Full; GET_OPT_ARGUMENT(help.Filename); - help.HelpForm = this->GetFormFromFilename(help.Filename); + help.HelpForm = this->GetFormFromFilename(help.Filename, + &help.ManSection); } else if(strcmp(argv[i], "--help-html") == 0) { @@ -1183,6 +1196,7 @@ bool cmDocumentation::CheckOptions(int argc, const char* const* argv, help.HelpType = cmDocumentation::Full; GET_OPT_ARGUMENT(help.Filename); help.HelpForm = cmDocumentation::ManForm; + help.ManSection = 1; } else if(strcmp(argv[i], "--help-command") == 0) { @@ -1190,35 +1204,40 @@ bool cmDocumentation::CheckOptions(int argc, const char* const* argv, GET_OPT_ARGUMENT(help.Argument); GET_OPT_ARGUMENT(help.Filename); help.Argument = cmSystemTools::LowerCase(help.Argument); - help.HelpForm = this->GetFormFromFilename(help.Filename); + help.HelpForm = this->GetFormFromFilename(help.Filename, + &help.ManSection); } else if(strcmp(argv[i], "--help-module") == 0) { help.HelpType = cmDocumentation::SingleModule; GET_OPT_ARGUMENT(help.Argument); GET_OPT_ARGUMENT(help.Filename); - help.HelpForm = this->GetFormFromFilename(help.Filename); + help.HelpForm = this->GetFormFromFilename(help.Filename, + &help.ManSection); } else if(strcmp(argv[i], "--help-property") == 0) { help.HelpType = cmDocumentation::SingleProperty; GET_OPT_ARGUMENT(help.Argument); GET_OPT_ARGUMENT(help.Filename); - help.HelpForm = this->GetFormFromFilename(help.Filename); + help.HelpForm = this->GetFormFromFilename(help.Filename, + &help.ManSection); } else if(strcmp(argv[i], "--help-policy") == 0) { help.HelpType = cmDocumentation::SinglePolicy; GET_OPT_ARGUMENT(help.Argument); GET_OPT_ARGUMENT(help.Filename); - help.HelpForm = this->GetFormFromFilename(help.Filename); + help.HelpForm = this->GetFormFromFilename(help.Filename, + &help.ManSection); } else if(strcmp(argv[i], "--help-variable") == 0) { help.HelpType = cmDocumentation::SingleVariable; GET_OPT_ARGUMENT(help.Argument); GET_OPT_ARGUMENT(help.Filename); - help.HelpForm = this->GetFormFromFilename(help.Filename); + help.HelpForm = this->GetFormFromFilename(help.Filename, + &help.ManSection); } else if(strcmp(argv[i], "--help-command-list") == 0) { @@ -1269,9 +1288,9 @@ bool cmDocumentation::CheckOptions(int argc, const char* const* argv, } //---------------------------------------------------------------------------- -void cmDocumentation::Print(Form f, std::ostream& os) +void cmDocumentation::Print(Form f, int manSection, std::ostream& os) { - this->SetForm(f); + this->SetForm(f, manSection); this->Print(os); } @@ -1879,7 +1898,7 @@ void cmDocumentation::CreateFullDocumentation() } //---------------------------------------------------------------------------- -void cmDocumentation::SetForm(Form f) +void cmDocumentation::SetForm(Form f, int manSection) { switch(f) { @@ -1890,6 +1909,7 @@ void cmDocumentation::SetForm(Form f) this->CurrentFormatter = &this->DocbookFormatter; break; case ManForm: + this->ManFormatter.SetManSection(manSection); this->CurrentFormatter = &this->ManFormatter; break; case TextForm: diff --git a/Source/cmDocumentation.h b/Source/cmDocumentation.h index 11bef16..e180f60 100644 --- a/Source/cmDocumentation.h +++ b/Source/cmDocumentation.h @@ -33,7 +33,7 @@ class cmDocumentation: public cmDocumentationEnums { public: cmDocumentation(); - + ~cmDocumentation(); /** @@ -51,18 +51,18 @@ public: typedef std::list<documentedModuleSectionPair_t> documentedModulesList_t; // High-level interface for standard documents: - + /** * Check command line arguments for documentation options. Returns * true if documentation options are found, and false otherwise. * When true is returned, PrintRequestedDocumentation should be - * called. exitOpt can be used for things like cmake -E, so that + * called. exitOpt can be used for things like cmake -E, so that * all arguments after the -E are ignored and not searched for * help arguments. */ - bool CheckOptions(int argc, const char* const* argv, + bool CheckOptions(int argc, const char* const* argv, const char* exitOpt =0); - + /** * Print help requested on the command line. Call after * CheckOptions returns true. Returns true on success, and false @@ -70,12 +70,12 @@ public: * command line cannot be written. */ bool PrintRequestedDocumentation(std::ostream& os); - + /** Print help of the given type. */ bool PrintDocumentation(Type ht, std::ostream& os, const char* docname=0); void SetShowGenerators(bool showGen) { this->ShowGenerators = showGen; } - + /** Set the program name for standard document generation. */ void SetName(const char* name); @@ -108,8 +108,8 @@ public: * Print documentation in the given form. All previously added * sections will be generated. */ - void Print(Form f, std::ostream& os); - + void Print(Form f, int manSection, std::ostream& os); + /** * Print documentation in the current form. All previously added * sections will be generated. @@ -125,15 +125,16 @@ public: void SetSeeAlsoList(const char *data[][3]); /** Clear all previously added sections of help. */ - void ClearSections(); - + void ClearSections(); + /** Set cmake root so we can find installed files */ void SetCMakeRoot(const char* root) { this->CMakeRoot = root;} /** Set CMAKE_MODULE_PATH so we can find additional cmake modules */ void SetCMakeModulePath(const char* path) { this->CMakeModulePath = path;} - - static Form GetFormFromFilename(const std::string& filename); + + static Form GetFormFromFilename(const std::string& filename, + int* ManSection); /** Add common (to all tools) documentation section(s) */ void addCommonStandardDocSections(); @@ -190,13 +191,13 @@ public: std::vector<cmDocumentationEntry>& commands, cmake* cm); private: - void SetForm(Form f); + void SetForm(Form f, int manSection); void SetDocName(const char* docname); - bool CreateSingleModule(const char* fname, + bool CreateSingleModule(const char* fname, const char* moduleName, cmDocumentationSection &sec); - void CreateModuleDocsForDir(cmsys::Directory& dir, + void CreateModuleDocsForDir(cmsys::Directory& dir, cmDocumentationSection &moduleSection); bool CreateModulesSection(); bool CreateCustomModulesSection(); @@ -236,7 +237,7 @@ private: std::string NameString; std::string DocName; std::map<std::string,cmDocumentationSection*> AllSections; - + std::string SeeAlsoString; std::string CMakeRoot; std::string CMakeModulePath; @@ -247,11 +248,12 @@ private: struct RequestedHelpItem { - RequestedHelpItem():HelpForm(TextForm), HelpType(None) {} + RequestedHelpItem():HelpForm(TextForm), HelpType(None), ManSection(1) {} cmDocumentationEnums::Form HelpForm; cmDocumentationEnums::Type HelpType; std::string Filename; std::string Argument; + int ManSection; }; std::vector<RequestedHelpItem> RequestedHelpItems; diff --git a/Source/cmDocumentationFormatterMan.cxx b/Source/cmDocumentationFormatterMan.cxx index 79a3b25..4123c85 100644 --- a/Source/cmDocumentationFormatterMan.cxx +++ b/Source/cmDocumentationFormatterMan.cxx @@ -19,9 +19,15 @@ cmDocumentationFormatterMan::cmDocumentationFormatterMan() :cmDocumentationFormatter() +,ManSection(1) { } +void cmDocumentationFormatterMan::SetManSection(int manSection) +{ + this->ManSection = manSection; +} + void cmDocumentationFormatterMan ::PrintSection(std::ostream& os, const cmDocumentationSection §ion, @@ -32,9 +38,9 @@ void cmDocumentationFormatterMan os << ".SH " << name << "\n"; } - const std::vector<cmDocumentationEntry> &entries = + const std::vector<cmDocumentationEntry> &entries = section.GetEntries(); - for(std::vector<cmDocumentationEntry>::const_iterator op = entries.begin(); + for(std::vector<cmDocumentationEntry>::const_iterator op = entries.begin(); op != entries.end(); ++op) { if(op->Name.size()) @@ -58,7 +64,7 @@ void cmDocumentationFormatterMan::EscapeText(std::string& man_text) cmSystemTools::ReplaceString(man_text, "-", "\\-"); } -void cmDocumentationFormatterMan::PrintPreformatted(std::ostream& os, +void cmDocumentationFormatterMan::PrintPreformatted(std::ostream& os, const char* text) { std::string man_text = text; @@ -69,7 +75,7 @@ void cmDocumentationFormatterMan::PrintPreformatted(std::ostream& os, os << ".fi\n\n"; } -void cmDocumentationFormatterMan::PrintParagraph(std::ostream& os, +void cmDocumentationFormatterMan::PrintParagraph(std::ostream& os, const char* text) { std::string man_text = text; @@ -87,7 +93,7 @@ void cmDocumentationFormatterMan::PrintHeader(const char* docname, this->EscapeText(s_docname); this->EscapeText(s_appname); - os << ".TH " << s_docname << " 1 \"" + os << ".TH " << s_docname << " " << this->ManSection << " \"" << cmSystemTools::GetCurrentDateTime("%B %d, %Y").c_str() << "\" \"" << s_appname << " " << cmVersion::GetCMakeVersion() diff --git a/Source/cmDocumentationFormatterMan.h b/Source/cmDocumentationFormatterMan.h index 11b5acb..b3d069c 100644 --- a/Source/cmDocumentationFormatterMan.h +++ b/Source/cmDocumentationFormatterMan.h @@ -22,6 +22,8 @@ class cmDocumentationFormatterMan : public cmDocumentationFormatter public: cmDocumentationFormatterMan(); + void SetManSection(int manSection); + virtual cmDocumentationEnums::Form GetForm() const { return cmDocumentationEnums::ManForm;} @@ -35,6 +37,7 @@ public: private: void EscapeText(std::string& man_text); + int ManSection; }; #endif diff --git a/Source/cmGlobalNinjaGenerator.cxx b/Source/cmGlobalNinjaGenerator.cxx index ea9e6c5..af61d95 100644 --- a/Source/cmGlobalNinjaGenerator.cxx +++ b/Source/cmGlobalNinjaGenerator.cxx @@ -701,13 +701,22 @@ void cmGlobalNinjaGenerator::AddCXXCompileCommand( *this->CompileCommandsStream << "," << std::endl; } + std::string sourceFileName = sourceFile; + if (!cmSystemTools::FileIsFullPath(sourceFileName.c_str())) + { + sourceFileName = cmSystemTools::CollapseFullPath( + sourceFileName.c_str(), + this->GetCMakeInstance()->GetHomeOutputDirectory()); + } + + *this->CompileCommandsStream << "\n{\n" << " \"directory\": \"" << cmGlobalGenerator::EscapeJSON(buildFileDir) << "\",\n" << " \"command\": \"" << cmGlobalGenerator::EscapeJSON(commandLine) << "\",\n" << " \"file\": \"" - << cmGlobalGenerator::EscapeJSON(sourceFile) << "\"\n" + << cmGlobalGenerator::EscapeJSON(sourceFileName) << "\"\n" << "}"; } diff --git a/Source/cmInstallCommand.h b/Source/cmInstallCommand.h index bf9fd9e..76e622e 100644 --- a/Source/cmInstallCommand.h +++ b/Source/cmInstallCommand.h @@ -85,7 +85,10 @@ public: "with which the install rule is associated, such as \"runtime\" or " "\"development\". During component-specific installation only " "install rules associated with the given component name will be " - "executed. During a full installation all components are installed.\n" + "executed. During a full installation all components are installed." + " If COMPONENT is not provided a default component \"Unspecified\" is" + " created. The default component name may be controlled with the " + "CMAKE_INSTALL_DEFAULT_COMPONENT_NAME variable.\n" "The RENAME argument specifies a name for an installed file that " "may be different from the original file. Renaming is allowed only " "when a single file is installed by the command.\n" diff --git a/Source/cmNinjaTargetGenerator.cxx b/Source/cmNinjaTargetGenerator.cxx index 6157931..4758989 100644 --- a/Source/cmNinjaTargetGenerator.cxx +++ b/Source/cmNinjaTargetGenerator.cxx @@ -534,9 +534,21 @@ cmNinjaTargetGenerator cmLocalGenerator::RuleVariables compileObjectVars; std::string lang = language; compileObjectVars.Language = lang.c_str(); - std::string escapedSourceFileName = + + std::string escapedSourceFileName = sourceFileName; + + if (!cmSystemTools::FileIsFullPath(sourceFileName.c_str())) + { + escapedSourceFileName = cmSystemTools::CollapseFullPath( + escapedSourceFileName.c_str(), + this->GetGlobalGenerator()->GetCMakeInstance()-> + GetHomeOutputDirectory()); + } + + escapedSourceFileName = this->LocalGenerator->ConvertToOutputFormat( - sourceFileName.c_str(), cmLocalGenerator::SHELL); + escapedSourceFileName.c_str(), cmLocalGenerator::SHELL); + compileObjectVars.Source = escapedSourceFileName.c_str(); compileObjectVars.Object = objectFileName.c_str(); compileObjectVars.Flags = vars["FLAGS"].c_str(); diff --git a/Source/cmakemain.cxx b/Source/cmakemain.cxx index c3de8ca..11a4267 100644 --- a/Source/cmakemain.cxx +++ b/Source/cmakemain.cxx @@ -9,8 +9,8 @@ implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the License for more information. ============================================================================*/ -// include these first, otherwise there will be problems on Windows -// with GetCurrentDirectory() being redefined +// include these first, otherwise there will be problems on Windows +// with GetCurrentDirectory() being redefined #ifdef CMAKE_BUILD_WITH_CMAKE #include "cmDynamicLoader.h" #include "cmDocumentation.h" @@ -183,7 +183,7 @@ static const char * cmDocumentationOptions[][3] = "If a file is specified, the documentation is written into and the output " "format is determined depending on the filename suffix. Supported are man " "page, HTML, DocBook and plain text."}, - {"--help-policy cmp [file]", + {"--help-policy cmp [file]", "Print help for a single policy and exit.", "Full documentation specific to the given policy is displayed." "If a file is specified, the documentation is written into and the output " @@ -194,7 +194,7 @@ static const char * cmDocumentationOptions[][3] = "If a file is specified, the documentation is written into and the output " "format is determined depending on the filename suffix. Supported are man " "page, HTML, DocBook and plain text."}, - {"--help-property prop [file]", + {"--help-property prop [file]", "Print help for a single property and exit.", "Full documentation specific to the given property is displayed." "If a file is specified, the documentation is written into and the output " @@ -212,7 +212,7 @@ static const char * cmDocumentationOptions[][3] = "If a file is specified, the documentation is written into and the output " "format is determined depending on the filename suffix. Supported are man " "page, HTML, DocBook and plain text."}, - {"--help-variable var [file]", + {"--help-variable var [file]", "Print help for a single variable and exit.", "Full documentation specific to the given variable is displayed." "If a file is specified, the documentation is written into and the output " @@ -296,13 +296,13 @@ static std::string cmakemainGetStack(void *clientdata) return msg; } -static void cmakemainErrorCallback(const char* m, const char*, bool&, +static void cmakemainErrorCallback(const char* m, const char*, bool&, void *clientdata) { std::cerr << m << cmakemainGetStack(clientdata) << std::endl << std::flush; } -static void cmakemainProgressCallback(const char *m, float prog, +static void cmakemainProgressCallback(const char *m, float prog, void* clientdata) { cmMakefile* mf = cmakemainGetMakefile(clientdata); @@ -348,7 +348,7 @@ int do_cmake(int ac, char** av) if ( cmSystemTools::GetCurrentWorkingDirectory().size() == 0 ) { - std::cerr << "Current working directory cannot be established." + std::cerr << "Current working directory cannot be established." << std::endl; nocwd = 1; } @@ -357,13 +357,13 @@ int do_cmake(int ac, char** av) cmDocumentation doc; doc.addCMakeStandardDocSections(); if(doc.CheckOptions(ac, av, "-E") || nocwd) - { + { // Construct and print requested documentation. cmake hcm; hcm.AddCMakePaths(); doc.SetCMakeRoot(hcm.GetCacheDefinition("CMAKE_ROOT")); - // the command line args are processed here so that you can do + // the command line args are processed here so that you can do // -DCMAKE_MODULE_PATH=/some/path and have this value accessible here std::vector<std::string> args; for(int i =0; i < ac; ++i) @@ -401,7 +401,7 @@ int do_cmake(int ac, char** av) doc.SetSections(propDocs); cmDocumentationEntry e; - e.Brief = + e.Brief = "variables defined by cmake, that give information about the project, " "and cmake"; doc.PrependSection("Variables that Provide Information",e); @@ -418,7 +418,7 @@ int do_cmake(int ac, char** av) { doc.ClearSections(); doc.SetSection("NOTE", cmDocumentationNOTE); - doc.Print(cmDocumentation::UsageForm, std::cerr); + doc.Print(cmDocumentation::UsageForm, 0, std::cerr); return 1; } return result; @@ -426,13 +426,13 @@ int do_cmake(int ac, char** av) #else if ( nocwd || ac == 1 ) { - std::cout << + std::cout << "Bootstrap CMake should not be used outside CMake build process." << std::endl; return 0; } #endif - + bool wiz = false; bool sysinfo = false; bool command = false; @@ -453,7 +453,7 @@ int do_cmake(int ac, char** av) sysinfo = true; } // if command has already been set, then - // do not eat the -E + // do not eat the -E else if (!command && strcmp(av[i], "-E") == 0) { command = true; @@ -500,7 +500,7 @@ int do_cmake(int ac, char** av) workingMode = cmake::FIND_PACKAGE_MODE; args.push_back(av[i]); } - else + else { args.push_back(av[i]); } @@ -513,15 +513,15 @@ int do_cmake(int ac, char** av) if (wiz) { cmakewizard wizard; - return wizard.RunWizard(args); + return wizard.RunWizard(args); } if (sysinfo) { cmake cm; int ret = cm.GetSystemInformation(args); - return ret; + return ret; } - cmake cm; + cmake cm; cmSystemTools::SetErrorCallback(cmakemainErrorCallback, (void *)&cm); cm.SetProgressCallback(cmakemainProgressCallback, (void *)&cm); cm.SetWorkingMode(workingMode); @@ -529,7 +529,7 @@ int do_cmake(int ac, char** av) int res = cm.Run(args, view_only); if ( list_cached || list_all_cached ) { - cmCacheManager::CacheIterator it = + cmCacheManager::CacheIterator it = cm.GetCacheManager()->GetCacheIterator(); std::cout << "-- Cache values" << std::endl; for ( it.Begin(); !it.IsAtEnd(); it.Next() ) @@ -545,8 +545,8 @@ int do_cmake(int ac, char** av) { std::cout << "// " << it.GetProperty("HELPSTRING") << std::endl; } - std::cout << it.GetName() << ":" << - cmCacheManager::TypeToString(it.GetType()) + std::cout << it.GetName() << ":" << + cmCacheManager::TypeToString(it.GetType()) << "=" << it.GetValue() << std::endl; if ( list_help ) { diff --git a/Source/ctest.cxx b/Source/ctest.cxx index d41627e..d650777 100644 --- a/Source/ctest.cxx +++ b/Source/ctest.cxx @@ -103,6 +103,12 @@ static const char * cmDocumentationOptions[][3] = "a dashboard test. All tests are <Mode><Test>, where Mode can be " "Experimental, Nightly, and Continuous, and Test can be Start, Update, " "Configure, Build, Test, Coverage, and Submit."}, + {"-D <var>:<type>=<value>", "Define a variable for script mode", + "Pass in variable values on the command line. Use in " + "conjunction with -S to pass variable values to a dashboard script. " + "Parsing -D arguments as variable values is only attempted if " + "the value following -D does not match any of the known dashboard " + "types."}, {"-M <model>, --test-model <model>", "Sets the model for a dashboard", "This option tells ctest to act as a Dart client " "where the TestModel can be Experimental, " diff --git a/Tests/CMakeLists.txt b/Tests/CMakeLists.txt index 9deb8ac..300ab09 100644 --- a/Tests/CMakeLists.txt +++ b/Tests/CMakeLists.txt @@ -1822,6 +1822,19 @@ ${CMake_BINARY_DIR}/bin/cmake -DVERSION=master -P ${CMake_SOURCE_DIR}/Utilities/ add_config_tests(Release) add_config_tests(RelWithDebInfo) + # Test -S script with some -D variable definition args to ctest: + add_test(CTestConfig.ScriptWithArgs ${CMAKE_CTEST_COMMAND} + -C "Release" + -D arg1=this + -D arg2=that + -D "arg3=the other" + "-Darg4=this is the fourth" + -Darg5=the_fifth + -Darg6:STRING=value-with-type + -S "${CMake_SOURCE_DIR}/Tests/CTestConfig/ScriptWithArgs.cmake" -VV + --output-log "${CMake_BINARY_DIR}/Tests/CTestConfig/ScriptWithArgs.log" + ) + ADD_TEST_MACRO(CMakeCommands.target_link_libraries target_link_libraries) CONFIGURE_FILE( diff --git a/Tests/CTestConfig/ScriptWithArgs.cmake b/Tests/CTestConfig/ScriptWithArgs.cmake new file mode 100644 index 0000000..79896a7 --- /dev/null +++ b/Tests/CTestConfig/ScriptWithArgs.cmake @@ -0,0 +1,16 @@ +set(CTEST_RUN_CURRENT_SCRIPT 0) + +macro(check_arg name expected_value) + message("${name}='${${name}}'") + if(NOT "${${name}}" STREQUAL "${expected_value}") + message(FATAL_ERROR "unexpected ${name} value '${${name}}', expected '${expected_value}'") + endif() +endmacro() + +check_arg(arg1 "this") +check_arg(arg2 "that") +check_arg(arg3 "the other") +check_arg(arg4 "this is the fourth") +check_arg(arg5 "the_fifth") +check_arg(arg6 "value-with-type") +check_arg(arg7 "") diff --git a/Utilities/KWIML/ABI.h.in b/Utilities/KWIML/ABI.h.in index e85a1c5..060a520 100644 --- a/Utilities/KWIML/ABI.h.in +++ b/Utilities/KWIML/ABI.h.in @@ -156,6 +156,8 @@ suppression macro @KWIML@_ABI_NO_VERIFY was defined. # define @KWIML@_ABI_CHAR_IS_UNSIGNED 1 # elif defined(__BORLANDC__) /* Borland default */ # define @KWIML@_ABI_CHAR_IS_SIGNED 1 +# elif defined(__hpux) /* Old HP: no __HP_cc/__HP_aCC/__GNUC__ above */ +# define @KWIML@_ABI_CHAR_IS_SIGNED 1 /* (unless +uc) */ # endif #endif #if !defined(@KWIML@_ABI_CHAR_IS_UNSIGNED) && !defined(@KWIML@_ABI_CHAR_IS_SIGNED) \ @@ -251,6 +253,8 @@ suppression macro @KWIML@_ABI_NO_VERIFY was defined. # else # define @KWIML@_ABI_SIZEOF_LONG_LONG 0 # endif +# elif defined(__hpux) && !defined(__GNUC__) /* Old HP: no __HP_cc/__HP_aCC above */ +# define @KWIML@_ABI_SIZEOF_LONG_LONG 8 # endif #endif #if !defined(@KWIML@_ABI_SIZEOF_LONG_LONG) && !defined(@KWIML@_ABI_NO_ERROR_LONG_LONG) diff --git a/Utilities/KWIML/INT.h.in b/Utilities/KWIML/INT.h.in index d40edcd..d2eda63 100644 --- a/Utilities/KWIML/INT.h.in +++ b/Utilities/KWIML/INT.h.in @@ -91,10 +91,11 @@ An includer may test the following macros after inclusion: Some compilers define integer format macros incorrectly for their own formatted print/scan implementations. - @KWIML@_INT_BROKEN_INT64_C = macro INT64_C is incorrect if defined - @KWIML@_INT_BROKEN_UINT64_C = macro UINT64_C is incorrect if defined + @KWIML@_INT_BROKEN_INT#_C = macro INT#_C is incorrect if defined + @KWIML@_INT_BROKEN_UINT#_C = macro UINT#_C is incorrect if defined Some compilers define integer constant macros incorrectly and - cannot handle literals as large as the integer type. + cannot handle literals as large as the integer type or even + produce bad preprocessor syntax. @KWIML@_INT_BROKEN_INT8_T = type 'int8_t' is available but incorrect Some compilers have a flag to make 'char' (un)signed but do not account @@ -259,8 +260,6 @@ An includer may test the following macros after inclusion: # endif #elif defined(__SUNPRO_C) || defined(__SUNPRO_CC) # define @KWIML@_INT__NO_SCN8 -#elif defined(__HP_cc) || defined(__HP_aCC) -# define @KWIML@_INT__NO_SCN8 #elif defined(__BORLANDC__) # define @KWIML@_INT__NO_SCN8 # define @KWIML@_INT__NO_SCN64 @@ -268,6 +267,8 @@ An includer may test the following macros after inclusion: # define @KWIML@_INT__NO_SCN8 #elif defined(__WATCOMC__) # define @KWIML@_INT__NO_SCN8 +# elif defined(__hpux) /* HP runtime lacks support (any compiler) */ +# define @KWIML@_INT__NO_SCN8 #endif /* 8-bit d, i */ @@ -341,12 +342,12 @@ An includer may test the following macros after inclusion: #endif /* 8-bit constants */ -#if defined(INT8_C) +#if defined(INT8_C) && !defined(@KWIML@_INT_BROKEN_INT8_C) # define @KWIML@_INT_INT8_C(c) INT8_C(c) #else # define @KWIML@_INT_INT8_C(c) c #endif -#if defined(UINT8_C) +#if defined(UINT8_C) && !defined(@KWIML@_INT_BROKEN_UINT8_C) # define @KWIML@_INT_UINT8_C(c) UINT8_C(c) #else # define @KWIML@_INT_UINT8_C(c) c ## u @@ -435,12 +436,12 @@ An includer may test the following macros after inclusion: #endif /* 16-bit constants */ -#if defined(INT16_C) +#if defined(INT16_C) && !defined(@KWIML@_INT_BROKEN_INT16_C) # define @KWIML@_INT_INT16_C(c) INT16_C(c) #else # define @KWIML@_INT_INT16_C(c) c #endif -#if defined(UINT16_C) +#if defined(UINT16_C) && !defined(@KWIML@_INT_BROKEN_UINT16_C) # define @KWIML@_INT_UINT16_C(c) UINT16_C(c) #else # define @KWIML@_INT_UINT16_C(c) c ## u @@ -528,13 +529,19 @@ An includer may test the following macros after inclusion: # define @KWIML@_INT_PRIX32 "X" #endif +#if defined(__hpux) && defined(__GNUC__) && !defined(__LP64__) \ + && defined(__CONCAT__) && defined(__CONCAT_U__) + /* Some HPs define UINT32_C incorrectly and break GNU. */ +# define @KWIML@_INT_BROKEN_UINT32_C +#endif + /* 32-bit constants */ -#if defined(INT32_C) +#if defined(INT32_C) && !defined(@KWIML@_INT_BROKEN_INT32_C) # define @KWIML@_INT_INT32_C(c) INT32_C(c) #else # define @KWIML@_INT_INT32_C(c) c #endif -#if defined(UINT32_C) +#if defined(UINT32_C) && !defined(@KWIML@_INT_BROKEN_UINT32_C) # define @KWIML@_INT_UINT32_C(c) UINT32_C(c) #else # define @KWIML@_INT_UINT32_C(c) c ## u |