diff options
author | Bill Hoffman <bill.hoffman@kitware.com> | 2006-05-15 22:05:24 (GMT) |
---|---|---|
committer | Bill Hoffman <bill.hoffman@kitware.com> | 2006-05-15 22:05:24 (GMT) |
commit | 73a1f4c6e8c27e0d9b9f7c76c2a86d8a02ff09cf (patch) | |
tree | 6d704f2e3375e433a2556daeb93ca5c1b0c0d118 | |
parent | bdb7d25e49c911803b06a8e0998c4b187b7bbf9e (diff) | |
download | CMake-73a1f4c6e8c27e0d9b9f7c76c2a86d8a02ff09cf.zip CMake-73a1f4c6e8c27e0d9b9f7c76c2a86d8a02ff09cf.tar.gz CMake-73a1f4c6e8c27e0d9b9f7c76c2a86d8a02ff09cf.tar.bz2 |
ENH: merge from main tree
-rw-r--r-- | ChangeLog.manual | 1 | ||||
-rw-r--r-- | Source/cmDependsFortranParser.h | 7 | ||||
-rw-r--r-- | Source/cmDependsJavaParser.cxx | 14 | ||||
-rw-r--r-- | Source/cmExprParser.cxx | 4 | ||||
-rw-r--r-- | Source/cmGlobalUnixMakefileGenerator3.cxx | 10 | ||||
-rw-r--r-- | Source/cmListCommand.cxx | 43 | ||||
-rw-r--r-- | Source/cmListCommand.h | 13 | ||||
-rw-r--r-- | Source/cmLocalUnixMakefileGenerator3.cxx | 83 | ||||
-rw-r--r-- | Source/cmQTWrapCPPCommand.h | 3 | ||||
-rw-r--r-- | Source/cmake.cxx | 2 | ||||
-rw-r--r-- | Tests/CMakeTests/ListTest.cmake.in | 38 |
11 files changed, 129 insertions, 89 deletions
diff --git a/ChangeLog.manual b/ChangeLog.manual index 22d1bf3..80eb39c 100644 --- a/ChangeLog.manual +++ b/ChangeLog.manual @@ -1,4 +1,5 @@ Changes in CMake 2.4.2 +* Changes to LIST command, see --help-command LIST * Fix FindQT to be able to use full paths to source files diff --git a/Source/cmDependsFortranParser.h b/Source/cmDependsFortranParser.h index 468682f..362c5d8 100644 --- a/Source/cmDependsFortranParser.h +++ b/Source/cmDependsFortranParser.h @@ -69,17 +69,20 @@ union cmDependsFortran_yystype_u /* Setup the proper yylex interface. */ #define YY_EXTRA_TYPE cmDependsFortranParser* -#define YY_DECL int cmDependsFortran_yylex(YYSTYPE* yylvalp, yyscan_t yyscanner) +#define YY_DECL \ +int cmDependsFortran_yylex(YYSTYPE* yylvalp, yyscan_t yyscanner) #define YYSTYPE cmDependsFortran_yystype #define YYSTYPE_IS_DECLARED 1 #if !defined(cmDependsFortranLexer_cxx) # include "cmDependsFortranLexer.h" #endif -#if !defined(cmDependsFortranLexer_cxx) && !defined(cmDependsFortranParser_cxx) +#if !defined(cmDependsFortranLexer_cxx) +#if !defined(cmDependsFortranParser_cxx) # undef YY_EXTRA_TYPE # undef YY_DECL # undef YYSTYPE # undef YYSTYPE_IS_DECLARED #endif +#endif #endif diff --git a/Source/cmDependsJavaParser.cxx b/Source/cmDependsJavaParser.cxx index fd4bb2f..2b1690c 100644 --- a/Source/cmDependsJavaParser.cxx +++ b/Source/cmDependsJavaParser.cxx @@ -1,7 +1,7 @@ /* A Bison parser, made by GNU Bison 1.875d. */ -/* Skeleton parser for Yacc-like parsing with Bison, - Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004 Free Software Foundation, Inc. +/* Skeleton parser for Yacc-like parsing with Bison, Copyright (C) 1984, + 1989, 1990, 2000, 2001, 2002, 2003, 2004 Free Software Foundation, Inc. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -299,7 +299,9 @@ This file must be translated to C and modified to build everywhere. Run bison like this: - bison --yacc --name-prefix=cmDependsJava_yy --defines=cmDependsJavaParserTokens.h -ocmDependsJavaParser.cxx cmDependsJavaParser.y + bison --yacc --name-prefix=cmDependsJava_yy + --defines=cmDependsJavaParserTokens.h -ocmDependsJavaParser.cxx + cmDependsJavaParser.y Modify cmDependsJavaParser.c: - remove TABs @@ -331,14 +333,16 @@ static void cmDependsJavaError(yyscan_t yyscanner, const char* message); #define jpCheckEmpty(cnt) yyGetParser->CheckEmpty(__LINE__, cnt, yyvsp); #define jpElementStart(cnt) yyGetParser->PrepareElement(&yyval) -#define jpStoreClass(str) yyGetParser->AddClassFound(str); yyGetParser->DeallocateParserType(&(str)) +#define jpStoreClass(str) \ +yyGetParser->AddClassFound(str); yyGetParser->DeallocateParserType(&(str)) /* Disable some warnings in the generated code. */ #ifdef __BORLANDC__ # pragma warn -8004 /* Variable assigned a value that is not used. */ #endif #ifdef _MSC_VER # pragma warning (disable: 4102) /* Unused goto label. */ -# pragma warning (disable: 4065) /* Switch statement contains default but no case. */ +# pragma warning (disable: 4065) /* Switch statement contains default but + no case. */ #endif diff --git a/Source/cmExprParser.cxx b/Source/cmExprParser.cxx index a389c7c..e973d1c 100644 --- a/Source/cmExprParser.cxx +++ b/Source/cmExprParser.cxx @@ -1,7 +1,7 @@ /* A Bison parser, made by GNU Bison 1.875d. */ -/* Skeleton parser for Yacc-like parsing with Bison, - Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004 Free Software Foundation, Inc. +/* Skeleton parser for Yacc-like parsing with Bison, Copyright (C) 1984, + 1989, 1990, 2000, 2001, 2002, 2003, 2004 Free Software Foundation, Inc. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/Source/cmGlobalUnixMakefileGenerator3.cxx b/Source/cmGlobalUnixMakefileGenerator3.cxx index ca106c2..7c506ea 100644 --- a/Source/cmGlobalUnixMakefileGenerator3.cxx +++ b/Source/cmGlobalUnixMakefileGenerator3.cxx @@ -865,17 +865,11 @@ cmGlobalUnixMakefileGenerator3 // search each local generator until a match is found if (!result) { - unsigned int i; - for (i = 0; i < this->LocalGenerators.size(); ++i) - { - // search all targets - result = this->LocalGenerators[i]->GetMakefile()->FindTarget(name); + result = this->FindTarget(0,name); if (result) { lg3 = static_cast<cmLocalUnixMakefileGenerator3 *> - (this->LocalGenerators[i]); - break; - } + (result->GetMakefile()->GetLocalGenerator()); } } diff --git a/Source/cmListCommand.cxx b/Source/cmListCommand.cxx index 1a1a9d8..88705b7 100644 --- a/Source/cmListCommand.cxx +++ b/Source/cmListCommand.cxx @@ -38,17 +38,17 @@ bool cmListCommand::InitialPass(std::vector<std::string> const& args) { return this->HandleGetCommand(args); } - if(subCommand == "SET" || subCommand == "APPEND") + if(subCommand == "APPEND") { - return this->HandleSetCommand(args); + return this->HandleAppendCommand(args); } if(subCommand == "INSERT") { return this->HandleInsertCommand(args); } - if(subCommand == "REMOVE") + if(subCommand == "REMOVE_AT") { - return this->HandleRemoveCommand(args); + return this->HandleRemoveAtCommand(args); } if(subCommand == "REMOVE_ITEM") { @@ -72,9 +72,6 @@ bool cmListCommand::GetListString(std::string& listString, const char* var) = this->Makefile->GetDefinition(var); if(!cacheValue) { - cmOStringStream str; - str << "cannot find variable: " << var; - this->SetError(str.str().c_str()); return false; } listString = cacheValue; @@ -133,7 +130,8 @@ bool cmListCommand::HandleGetCommand(std::vector<std::string> const& args) std::vector<std::string> varArgsExpanded; if ( !this->GetList(varArgsExpanded, listName.c_str()) ) { - return false; + this->Makefile->AddDefinition(variableName.c_str(), "NOTFOUND"); + return true; } std::string value; @@ -167,21 +165,18 @@ bool cmListCommand::HandleGetCommand(std::vector<std::string> const& args) } //---------------------------------------------------------------------------- -bool cmListCommand::HandleSetCommand(std::vector<std::string> const& args) +bool cmListCommand::HandleAppendCommand(std::vector<std::string> const& args) { if(args.size() < 3) { - this->SetError("sub-command SET requires at least two arguments."); + this->SetError("sub-command APPEND requires at least two arguments."); return false; } const std::string& listName = args[1]; // expand the variable std::string listString; - if ( !this->GetListString(listString, listName.c_str()) ) - { - return false; - } + this->GetListString(listString, listName.c_str()); size_t cc; for ( cc = 2; cc < args.size(); ++ cc ) { @@ -206,15 +201,20 @@ bool cmListCommand::HandleInsertCommand(std::vector<std::string> const& args) } const std::string& listName = args[1]; + // expand the variable + int item = atoi(args[2].c_str()); std::vector<std::string> varArgsExpanded; - if ( !this->GetList(varArgsExpanded, listName.c_str()) ) + if ( !this->GetList(varArgsExpanded, listName.c_str()) && item != 0) { + cmOStringStream str; + str << "index: " << item << " out of range (0, 0)"; + this->SetError(str.str().c_str()); return false; } - int item = atoi(args[2].c_str()); - + if ( varArgsExpanded.size() != 0 ) + { size_t nitem = varArgsExpanded.size(); if ( item < 0 ) { @@ -225,10 +225,11 @@ bool cmListCommand::HandleInsertCommand(std::vector<std::string> const& args) cmOStringStream str; str << "index: " << item << " out of range (-" << varArgsExpanded.size() << ", " - << varArgsExpanded.size()-1 << ")"; + << (varArgsExpanded.size() == 0?0:(varArgsExpanded.size()-1)) << ")"; this->SetError(str.str().c_str()); return false; } + } size_t cc; size_t cnt = 0; for ( cc = 3; cc < args.size(); ++ cc ) @@ -252,7 +253,8 @@ bool cmListCommand::HandleInsertCommand(std::vector<std::string> const& args) } //---------------------------------------------------------------------------- -bool cmListCommand::HandleRemoveCommand(std::vector<std::string> const& args) +bool cmListCommand +::HandleRemoveItemCommand(std::vector<std::string> const& args) { if(args.size() < 3) { @@ -297,8 +299,7 @@ bool cmListCommand::HandleRemoveCommand(std::vector<std::string> const& args) } //---------------------------------------------------------------------------- -bool cmListCommand -::HandleRemoveItemCommand(std::vector<std::string> const& args) +bool cmListCommand::HandleRemoveAtCommand(std::vector<std::string> const& args) { if(args.size() < 3) { diff --git a/Source/cmListCommand.h b/Source/cmListCommand.h index e510d19..c15a054 100644 --- a/Source/cmListCommand.h +++ b/Source/cmListCommand.h @@ -69,8 +69,8 @@ public: "<output variable>)\n" " LIST(APPEND <list> <element> [<element> ...])\n" " LIST(INSERT <list> <element_index> <element> [<element> ...])\n" - " LIST(REMOVE <list> <value> [<value> ...])\n" - " LIST(REMOVE_ITEM <list> <index> [<index> ...])\n" + " LIST(REMOVE_ITEM <list> <value> [<value> ...])\n" + " LIST(REMOVE_AT <list> <index> [<index> ...])\n" " LIST(SORT <list>)\n" " LIST(REVERSE <list>)\n" "LENGTH will return a given list's length.\n" @@ -79,8 +79,9 @@ public: "INSERT will insert elements to the list to the specified location.\n" "When specifying an index, negative value corresponds to index from the" " end of the list.\n" - "REMOVE and REMOVE_ITEM will remove item from the list. The difference " - "is that REMOVE will remove the given items, while REMOVE_ITEM will " + "REMOVE_AT and REMOVE_ITEM will remove item from the list. " + "The difference " + "is that REMOVE_ITEM will remove the given items, while REMOVE_AT will " "remove the item at the given indices.\n" ; } @@ -89,9 +90,9 @@ public: protected: bool HandleLengthCommand(std::vector<std::string> const& args); bool HandleGetCommand(std::vector<std::string> const& args); - bool HandleSetCommand(std::vector<std::string> const& args); + bool HandleAppendCommand(std::vector<std::string> const& args); bool HandleInsertCommand(std::vector<std::string> const& args); - bool HandleRemoveCommand(std::vector<std::string> const& args); + bool HandleRemoveAtCommand(std::vector<std::string> const& args); bool HandleRemoveItemCommand(std::vector<std::string> const& args); diff --git a/Source/cmLocalUnixMakefileGenerator3.cxx b/Source/cmLocalUnixMakefileGenerator3.cxx index ce26fac..6074e68 100644 --- a/Source/cmLocalUnixMakefileGenerator3.cxx +++ b/Source/cmLocalUnixMakefileGenerator3.cxx @@ -111,12 +111,14 @@ void cmLocalUnixMakefileGenerator3::Generate() void cmLocalUnixMakefileGenerator3::ConfigureOutputPaths() { // Format the library and executable output paths. - if(const char* libOut = this->Makefile->GetDefinition("LIBRARY_OUTPUT_PATH")) + if(const char* libOut = + this->Makefile->GetDefinition("LIBRARY_OUTPUT_PATH")) { this->LibraryOutputPath = libOut; this->FormatOutputPath(this->LibraryOutputPath, "LIBRARY"); } - if(const char* exeOut = this->Makefile->GetDefinition("EXECUTABLE_OUTPUT_PATH")) + if(const char* exeOut = + this->Makefile->GetDefinition("EXECUTABLE_OUTPUT_PATH")) { this->ExecutableOutputPath = exeOut; this->FormatOutputPath(this->ExecutableOutputPath, "EXECUTABLE"); @@ -144,9 +146,8 @@ void cmLocalUnixMakefileGenerator3::FormatOutputPath(std::string& path, // Convert the output path to a full path in case it is // specified as a relative path. Treat a relative path as // relative to the current output directory for this makefile. - path = - cmSystemTools::CollapseFullPath(path.c_str(), - this->Makefile->GetStartOutputDirectory()); + path = cmSystemTools::CollapseFullPath + (path.c_str(), this->Makefile->GetStartOutputDirectory()); // Add a trailing slash for easy appending later. if(path.empty() || path[path.size()-1] != '/') @@ -342,7 +343,8 @@ void cmLocalUnixMakefileGenerator3::WriteDirectoryInformationFile() // Store the include regular expressions for this directory. infoFileStream << "\n" - << "# The C and CXX include file regular expressions for this directory.\n"; + << "# The C and CXX include file regular expressions for " + << "this directory.\n"; infoFileStream << "SET(CMAKE_C_INCLUDE_REGEX_SCAN "; this->WriteCMakeArgument(infoFileStream, @@ -358,7 +360,8 @@ void cmLocalUnixMakefileGenerator3::WriteDirectoryInformationFile() infoFileStream << "SET(CMAKE_CXX_INCLUDE_REGEX_SCAN ${CMAKE_C_INCLUDE_REGEX_SCAN})\n"; infoFileStream - << "SET(CMAKE_CXX_INCLUDE_REGEX_COMPLAIN ${CMAKE_C_INCLUDE_REGEX_COMPLAIN})\n"; + << "SET(CMAKE_CXX_INCLUDE_REGEX_COMPLAIN " + "${CMAKE_C_INCLUDE_REGEX_COMPLAIN})\n"; // Store the set of available generated files. infoFileStream @@ -579,7 +582,8 @@ cmLocalUnixMakefileGenerator3 std::vector<std::string> commands; std::vector<std::string> no_depends; commands.clear(); - if((this->Makefile->IsOn("CMAKE_VERBOSE_MAKEFILE")) || (this->ForceVerboseMakefiles)) + if((this->Makefile->IsOn("CMAKE_VERBOSE_MAKEFILE")) + || (this->ForceVerboseMakefiles)) { makefileStream << "# Produce verbose output by default.\n" @@ -601,21 +605,20 @@ cmLocalUnixMakefileGenerator3 // Special target to cleanup operation of make tool. std::vector<std::string> depends; - this->WriteMakeRule(makefileStream, - "Disable implicit rules so canoncical targets will work.", - ".SUFFIXES", - depends, - commands, false); + this->WriteMakeRule + (makefileStream, + "Disable implicit rules so canoncical targets will work.", + ".SUFFIXES", + depends, commands, false); + // Add a fake suffix to keep HP happy. Must be max 32 chars for SGI make. depends.push_back(".hpux_make_needs_suffix_list"); this->WriteMakeRule(makefileStream, 0, ".SUFFIXES", depends, commands, false); - } //---------------------------------------------------------------------------- -void -cmLocalUnixMakefileGenerator3 +void cmLocalUnixMakefileGenerator3 ::WriteSpecialTargetsBottom(std::ostream& makefileStream) { this->WriteDivider(makefileStream); @@ -655,7 +658,6 @@ cmLocalUnixMakefileGenerator3 } std::vector<std::string> no_commands; - } @@ -703,7 +705,8 @@ cmLocalUnixMakefileGenerator3 { // Add a dependency on the rule file itself unless an option to skip // it is specifically enabled by the user or project. - const char* nodep = this->Makefile->GetDefinition("CMAKE_SKIP_RULE_DEPENDENCY"); + const char* nodep = + this->Makefile->GetDefinition("CMAKE_SKIP_RULE_DEPENDENCY"); if(!nodep || cmSystemTools::IsOff(nodep)) { depends.push_back(ruleFileName); @@ -733,8 +736,8 @@ cmLocalUnixMakefileGenerator3 d != cc.GetDepends().end(); ++d) { // Lookup the real name of the dependency in case it is a CMake target. - std::string dep = this->GetRealDependency(d->c_str(), - this->ConfigurationName.c_str()); + std::string dep = this->GetRealDependency + (d->c_str(), this->ConfigurationName.c_str()); depends.push_back(dep); } } @@ -883,6 +886,8 @@ cmLocalUnixMakefileGenerator3::AppendEcho(std::vector<std::string>& commands, break; } } +#else + (void)color; #endif // Echo one line at a time. @@ -941,9 +946,9 @@ cmLocalUnixMakefileGenerator3::AppendEcho(std::vector<std::string>& commands, } //---------------------------------------------------------------------------- -// take a tgt path and convert it into a make target, it could be full, or relative -std::string -cmLocalUnixMakefileGenerator3 +//take a tgt path and convert it into a make target, it could be full, or +//relative +std::string cmLocalUnixMakefileGenerator3 ::ConvertToMakeTarget(const char* tgt) { // Make targets should not have a leading './' for a file in the @@ -1051,7 +1056,8 @@ cmLocalUnixMakefileGenerator3 // see if the variable has been defined before and return // the modified version of the variable - std::map<cmStdString, cmStdString>::iterator i = this->MakeVariableMap.find(unmodified); + std::map<cmStdString, cmStdString>::iterator i = + this->MakeVariableMap.find(unmodified); if(i != this->MakeVariableMap.end()) { return i->second; @@ -1125,9 +1131,9 @@ bool cmLocalUnixMakefileGenerator3 ::ScanDependencies(std::vector<std::string> const& args) { - // Format of arguments is: - // $(CMAKE_COMMAND), cmake_depends, GeneratorName, home_output_dir, start_output_dir, info file - // The caller has ensured that all required arguments exist. + // Format of arguments is: $(CMAKE_COMMAND), cmake_depends, + // GeneratorName, home_output_dir, start_output_dir, info file The + // caller has ensured that all required arguments exist. // The info file for this target std::string const& infoFile = args[5]; @@ -1190,7 +1196,8 @@ cmLocalUnixMakefileGenerator3 } std::string internalRuleFileNameFull = dir; internalRuleFileNameFull += "/depend.internal"; - cmGeneratedFileStream internalRuleFileStream(internalRuleFileNameFull.c_str()); + cmGeneratedFileStream + internalRuleFileStream(internalRuleFileNameFull.c_str()); internalRuleFileStream.SetCopyIfDifferent(true); if(!internalRuleFileStream) { @@ -1256,7 +1263,8 @@ cmLocalUnixMakefileGenerator3 std::string complainRegexVar = "CMAKE_"; complainRegexVar += lang; complainRegexVar += "_INCLUDE_REGEX_COMPLAIN"; - if(const char* complainRegex = mf->GetDefinition(complainRegexVar.c_str())) + if(const char* complainRegex = + mf->GetDefinition(complainRegexVar.c_str())) { includeRegexComplain = complainRegex; } @@ -1290,7 +1298,8 @@ cmLocalUnixMakefileGenerator3 if (scanner) { - scanner->SetFileComparison(this->GlobalGenerator->GetCMakeInstance()->GetFileComparison()); + scanner->SetFileComparison + (this->GlobalGenerator->GetCMakeInstance()->GetFileComparison()); // for each file we need to scan std::string srcLang = "CMAKE_DEPENDS_CHECK_"; srcLang += lang; @@ -1305,7 +1314,8 @@ cmLocalUnixMakefileGenerator3 // make sure the object file is relative to home output std::string obj = *si; obj = lg->Convert(obj.c_str(),HOME_OUTPUT,MAKEFILE); - scanner->Write(src.c_str(),obj.c_str(),ruleFileStream, internalRuleFileStream); + scanner->Write(src.c_str(),obj.c_str(), + ruleFileStream, internalRuleFileStream); } // free the scanner for this language @@ -1403,6 +1413,8 @@ void cmLocalUnixMakefileGenerator3 this->CreateCDCommand(commands, this->Makefile->GetHomeOutputDirectory(), this->Makefile->GetStartOutputDirectory()); + std::string echoCommand = "@echo \"\""; + commands.push_back(echoCommand.c_str()); this->WriteMakeRule(ruleFileStream, "The main all target", "all", depends, commands, true); @@ -1491,7 +1503,8 @@ void cmLocalUnixMakefileGenerator3::CheckDependencies(cmMakefile* mf, // For each info file run the check cmDependsC checker; checker.SetVerbose(verbose); - checker.SetFileComparison(this->GlobalGenerator->GetCMakeInstance()->GetFileComparison()); + checker.SetFileComparison + (this->GlobalGenerator->GetCMakeInstance()->GetFileComparison()); for(std::vector<std::string>::iterator l = files.begin(); l != files.end(); ++l) { @@ -1619,7 +1632,8 @@ cmLocalUnixMakefileGenerator3 // Prepend the target directory. std::string obj; - const char* fileTargetDirectory = source.GetProperty("MACOSX_PACKAGE_LOCATION"); + const char* fileTargetDirectory = + source.GetProperty("MACOSX_PACKAGE_LOCATION"); if ( fileTargetDirectory ) { std::string targetName; @@ -1643,7 +1657,8 @@ cmLocalUnixMakefileGenerator3 // Framework not handled yet abort(); } - obj = cmSystemTools::RelativePath(this->Makefile->GetHomeOutputDirectory(), obj.c_str()); + obj = cmSystemTools::RelativePath + (this->Makefile->GetHomeOutputDirectory(), obj.c_str()); } else { diff --git a/Source/cmQTWrapCPPCommand.h b/Source/cmQTWrapCPPCommand.h index 6f3e95d..ad5740d 100644 --- a/Source/cmQTWrapCPPCommand.h +++ b/Source/cmQTWrapCPPCommand.h @@ -24,7 +24,8 @@ /** \class cmQTWrapCPPCommand * \brief Create moc file rules for QT classes * - * cmQTWrapCPPCommand is used to create wrappers for QT classes into normal C++ + * cmQTWrapCPPCommand is used to create wrappers for QT classes into + * normal C++ */ class cmQTWrapCPPCommand : public cmCommand { diff --git a/Source/cmake.cxx b/Source/cmake.cxx index 189e153..53b7526 100644 --- a/Source/cmake.cxx +++ b/Source/cmake.cxx @@ -749,6 +749,8 @@ void CMakeCommandUsage(const char* program) "content to directory 'destination'\n" << " compare_files file1 file2 - check if file1 is same as file2\n" << " echo [string]... - displays arguments as text\n" + << " echo_append [string]... - displays arguments as text but no new" + " line\n" << " environment - display the current enviroment\n" << " remove file1 file2 ... - remove the file(s)\n" << " tar [cxt][vfz] file.tar file/dir1 file/dir2 ... - create a tar.\n" diff --git a/Tests/CMakeTests/ListTest.cmake.in b/Tests/CMakeTests/ListTest.cmake.in index 48b157c..58a8435 100644 --- a/Tests/CMakeTests/ListTest.cmake.in +++ b/Tests/CMakeTests/ListTest.cmake.in @@ -1,8 +1,8 @@ MACRO(TEST command expected) IF("x${result}" STREQUAL "x${expected}") - MESSAGE("TEST \"${command}\" success: \"${result}\" expected: \"${expected}\"") + #MESSAGE("TEST \"${command}\" success: \"${result}\" expected: \"${expected}\"") ELSE("x${result}" STREQUAL "x${expected}") - MESSAGE(SEND_ERROR "TEST \"${command}\" failed: \"${result}\" expected: \"${expected}\"") + MESSAGE(SEND_ERROR "${CMAKE_CURRENT_LIST_LINE}: TEST \"${command}\" failed: \"${result}\" expected: \"${expected}\"") ENDIF("x${result}" STREQUAL "x${expected}") ENDMACRO(TEST command expected) @@ -13,6 +13,9 @@ TEST("LENGTH mylist result" "4") LIST(LENGTH "mylist" result) TEST("LENGTH \"mylist\" result" "4") +LIST(LENGTH "nonexiting_list1" result) +TEST("LENGTH \"nonexiting_list1\" result" "0") + LIST(GET mylist 3 2 1 0 result) TEST("GET mylist 3 2 1 0 result" "brad;ken;bill;andy") @@ -29,22 +32,37 @@ TEST("GET mylist -1 -2 -3 -4 result" "brad;ken;bill;andy") LIST(GET mylist -1 2 -3 0 result) TEST("GET mylist -1 2 -3 0 ${result}" "brad;ken;bill;andy") +LIST(GET "nonexiting_list2" 1 result) +TEST("GET \"nonexiting_list2\" 1 result" "NOTFOUND") + SET(result andy) -LIST(SET result brad) -TEST("SET result brad" "andy;brad") +LIST(APPEND result brad) +TEST("APPEND result brad" "andy;brad") + +LIST(APPEND "nonexiting_list3" brad) +SET(result "${nonexiting_list3}") +TEST("APPEND \"nonexiting_list3\" brad" "brad") + +LIST(INSERT "nonexiting_list4" 0 andy bill brad ken) +SET(result "${nonexiting_list4}") +TEST("APPEND \"nonexiting_list4\" andy bill brad ken" "andy;bill;brad;ken") SET(result andy brad) LIST(INSERT result -1 bill ken) TEST("INSERT result -1 bill ken" "andy;bill;ken;brad") SET(result andy bill brad ken bob) -LIST(REMOVE result bob) -TEST("REMOVE result bob" "andy;bill;brad;ken") +LIST(REMOVE_ITEM result bob) +TEST("REMOVE_ITEM result bob" "andy;bill;brad;ken") SET(result andy bill bob brad ken peter) -LIST(REMOVE result peter bob) -TEST("REMOVE result peter bob" "andy;bill;brad;ken") +LIST(REMOVE_ITEM result peter bob) +TEST("REMOVE_ITEM result peter bob" "andy;bill;brad;ken") + +SET(result bob andy bill bob brad ken bob) +LIST(REMOVE_ITEM result bob) +TEST("REMOVE_ITEM result bob" "andy;bill;brad;ken") SET(result andy bill bob brad ken peter) -LIST(REMOVE_ITEM result 2 -1) -TEST("REMOVE_ITEM result 2 -1" "andy;bill;brad;ken") +LIST(REMOVE_AT result 2 -1) +TEST("REMOVE_AT result 2 -1" "andy;bill;brad;ken") |