diff options
Diffstat (limited to 'Source')
45 files changed, 647 insertions, 319 deletions
diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake index 8709521..e7d0bb7 100644 --- a/Source/CMakeVersion.cmake +++ b/Source/CMakeVersion.cmake @@ -1,6 +1,6 @@ # CMake version number components. set(CMake_VERSION_MAJOR 2) set(CMake_VERSION_MINOR 8) -set(CMake_VERSION_PATCH 11) -set(CMake_VERSION_TWEAK 20130924) +set(CMake_VERSION_PATCH 12) +set(CMake_VERSION_TWEAK 20131007) #set(CMake_VERSION_RC 1) diff --git a/Source/CTest/cmCTestTestHandler.cxx b/Source/CTest/cmCTestTestHandler.cxx index 497774d..85d7a56 100644 --- a/Source/CTest/cmCTestTestHandler.cxx +++ b/Source/CTest/cmCTestTestHandler.cxx @@ -249,7 +249,7 @@ public: /** * The name of the command as specified in CMakeList.txt. */ - virtual const char* GetName() const { return "ADD_TEST";} + virtual const char* GetName() const { return "add_test";} // Unused methods virtual const char* GetTerseDocumentation() const { return ""; } @@ -297,7 +297,7 @@ public: /** * The name of the command as specified in CMakeList.txt. */ - virtual const char* GetName() const { return "SET_TESTS_PROPERTIES";} + virtual const char* GetName() const { return "set_tests_properties";} // Unused methods virtual const char* GetTerseDocumentation() const { return ""; } diff --git a/Source/CursesDialog/CMakeLists.txt b/Source/CursesDialog/CMakeLists.txt index 5efc2fb..548f5a5 100644 --- a/Source/CursesDialog/CMakeLists.txt +++ b/Source/CursesDialog/CMakeLists.txt @@ -11,6 +11,7 @@ #============================================================================= set( CURSES_SRCS + CursesDialog/cmCursesOptionsWidget CursesDialog/cmCursesBoolWidget CursesDialog/cmCursesCacheEntryComposite CursesDialog/cmCursesDummyWidget diff --git a/Source/CursesDialog/cmCursesCacheEntryComposite.cxx b/Source/CursesDialog/cmCursesCacheEntryComposite.cxx index c58d037..249137f 100644 --- a/Source/CursesDialog/cmCursesCacheEntryComposite.cxx +++ b/Source/CursesDialog/cmCursesCacheEntryComposite.cxx @@ -10,6 +10,7 @@ See the License for more information. ============================================================================*/ #include "cmCursesCacheEntryComposite.h" +#include "cmCursesOptionsWidget.h" #include "cmCursesStringWidget.h" #include "cmCursesLabelWidget.h" #include "cmCursesBoolWidget.h" @@ -69,9 +70,27 @@ cmCursesCacheEntryComposite::cmCursesCacheEntryComposite( it.GetValue()); break; case cmCacheManager::STRING: - this->Entry = new cmCursesStringWidget(this->EntryWidth, 1, 1, 1); - static_cast<cmCursesStringWidget*>(this->Entry)->SetString( - it.GetValue()); + if(it.PropertyExists("STRINGS")) + { + cmCursesOptionsWidget* ow = + new cmCursesOptionsWidget(this->EntryWidth, 1, 1, 1); + this->Entry = ow; + std::vector<std::string> options; + cmSystemTools::ExpandListArgument( + std::string(it.GetProperty("STRINGS")), options); + for(std::vector<std::string>::iterator + si = options.begin(); si != options.end(); ++si) + { + ow->AddOption(*si); + } + ow->SetOption(it.GetValue()); + } + else + { + this->Entry = new cmCursesStringWidget(this->EntryWidth, 1, 1, 1); + static_cast<cmCursesStringWidget*>(this->Entry)->SetString( + it.GetValue()); + } break; case cmCacheManager::UNINITIALIZED: cmSystemTools::Error("Found an undefined variable: ", it.GetName()); diff --git a/Source/CursesDialog/cmCursesOptionsWidget.cxx b/Source/CursesDialog/cmCursesOptionsWidget.cxx new file mode 100644 index 0000000..652b2df --- /dev/null +++ b/Source/CursesDialog/cmCursesOptionsWidget.cxx @@ -0,0 +1,106 @@ +/*============================================================================ + 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 "cmCursesOptionsWidget.h" +#include "cmCursesMainForm.h" + +inline int ctrl(int z) +{ + return (z&037); +} + +cmCursesOptionsWidget::cmCursesOptionsWidget(int width, int height, + int left, int top) : + cmCursesWidget(width, height, left, top) +{ + this->Type = cmCacheManager::BOOL; // this is a bit of a hack + // there is no option type, and string type causes ccmake to cast + // the widget into a string widget at some point. BOOL is safe for + // now. + set_field_fore(this->Field, A_NORMAL); + set_field_back(this->Field, A_STANDOUT); + field_opts_off(this->Field, O_STATIC); +} + +bool cmCursesOptionsWidget::HandleInput(int& key, cmCursesMainForm*, WINDOW* w) +{ + + // 10 == enter + if (key == 10 || key == KEY_ENTER) + { + this->NextOption(); + touchwin(w); + wrefresh(w); + return true; + } + else if (key == KEY_LEFT || key == ctrl('b')) + { + touchwin(w); + wrefresh(w); + this->PreviousOption(); + return true; + } + else if (key == KEY_RIGHT || key == ctrl('f')) + { + this->NextOption(); + touchwin(w); + wrefresh(w); + return true; + } + else + { + return false; + } + return false; +} + +void cmCursesOptionsWidget::AddOption(std::string const & option ) +{ + this->Options.push_back(option); +} + +void cmCursesOptionsWidget::NextOption() +{ + this->CurrentOption++; + if(this->CurrentOption > this->Options.size()-1) + { + this->CurrentOption = 0; + } + this->SetValue(this->Options[this->CurrentOption].c_str()); +} +void cmCursesOptionsWidget::PreviousOption() +{ + if(this->CurrentOption == 0) + { + this->CurrentOption = this->Options.size()-1; + } + else + { + this->CurrentOption--; + } + this->SetValue(this->Options[this->CurrentOption].c_str()); +} + +void cmCursesOptionsWidget::SetOption(const char* value) +{ + this->CurrentOption = 0; // default to 0 index + this->SetValue(value); + int index = 0; + for(std::vector<std::string>::iterator i = this->Options.begin(); + i != this->Options.end(); ++i) + { + if(*i == value) + { + this->CurrentOption = index; + } + index++; + } +} diff --git a/Source/CursesDialog/cmCursesOptionsWidget.h b/Source/CursesDialog/cmCursesOptionsWidget.h new file mode 100644 index 0000000..b52ac9d --- /dev/null +++ b/Source/CursesDialog/cmCursesOptionsWidget.h @@ -0,0 +1,39 @@ +/*============================================================================ + 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 __cmCursesOptionsWidget_h +#define __cmCursesOptionsWidget_h + +#include "cmCursesWidget.h" +class cmCursesMainForm; + +class cmCursesOptionsWidget : public cmCursesWidget +{ +public: + cmCursesOptionsWidget(int width, int height, int left, int top); + + // Description: + // Handle user input. Called by the container of this widget + // when this widget has focus. Returns true if the input was + // handled. + virtual bool HandleInput(int& key, cmCursesMainForm* fm, WINDOW* w); + void SetOption(const char*); + void AddOption(std::string const &); + void NextOption(); + void PreviousOption(); +protected: + cmCursesOptionsWidget(const cmCursesOptionsWidget& from); + void operator=(const cmCursesOptionsWidget&); + std::vector<std::string> Options; + std::vector<std::string>::size_type CurrentOption; +}; + +#endif // __cmCursesOptionsWidget_h diff --git a/Source/QtDialog/CMakeSetupDialog.cxx b/Source/QtDialog/CMakeSetupDialog.cxx index 4d62f72..a4dfdc9 100644 --- a/Source/QtDialog/CMakeSetupDialog.cxx +++ b/Source/QtDialog/CMakeSetupDialog.cxx @@ -66,9 +66,8 @@ CMakeSetupDialog::CMakeSetupDialog() // create the GUI QSettings settings; settings.beginGroup("Settings/StartPath"); - int h = settings.value("Height", 500).toInt(); - int w = settings.value("Width", 700).toInt(); - this->resize(w, h); + restoreGeometry(settings.value("geometry").toByteArray()); + restoreState(settings.value("windowState").toByteArray()); this->AddVariableCompletions = settings.value("AddVariableCompletionEntries", QStringList("CMAKE_INSTALL_PREFIX")).toStringList(); @@ -299,8 +298,8 @@ CMakeSetupDialog::~CMakeSetupDialog() { QSettings settings; settings.beginGroup("Settings/StartPath"); - settings.setValue("Height", this->height()); - settings.setValue("Width", this->width()); + settings.setValue("windowState", QVariant(saveState())); + settings.setValue("geometry", QVariant(saveGeometry())); settings.setValue("SplitterSizes", this->Splitter->saveState()); // wait for thread to stop diff --git a/Source/cmAddDependenciesCommand.h b/Source/cmAddDependenciesCommand.h index ed80067..148fd99 100644 --- a/Source/cmAddDependenciesCommand.h +++ b/Source/cmAddDependenciesCommand.h @@ -56,14 +56,14 @@ public: virtual const char* GetFullDocumentation() const { return - " add_dependencies(target-name depend-target1\n" - " depend-target2 ...)\n" - "Make a top-level target depend on other top-level targets. A " - "top-level target is one created by ADD_EXECUTABLE, ADD_LIBRARY, " - "or ADD_CUSTOM_TARGET. Adding dependencies with this command " - "can be used to make sure one target is built before another target. " + " add_dependencies(<target> [<target-dependency>]...)\n" + "Make a top-level <target> depend on other top-level targets to " + "ensure that they build before <target> does. " + "A top-level target is one created by ADD_EXECUTABLE, ADD_LIBRARY, " + "or ADD_CUSTOM_TARGET. " "Dependencies added to an IMPORTED target are followed transitively " "in its place since the target itself does not build. " + "\n" "See the DEPENDS option of ADD_CUSTOM_TARGET " "and ADD_CUSTOM_COMMAND for adding file-level dependencies in custom " "rules. See the OBJECT_DEPENDS option in " diff --git a/Source/cmAddTestCommand.h b/Source/cmAddTestCommand.h index ec7fda3..ce98aaa 100644 --- a/Source/cmAddTestCommand.h +++ b/Source/cmAddTestCommand.h @@ -66,7 +66,8 @@ public: "built by this project or an arbitrary executable on the " "system (like tclsh). The test will be run with the current working " "directory set to the CMakeList.txt files corresponding directory " - "in the binary tree.\n" + "in the binary tree. Tests added using this signature do not support " + "generator expressions.\n" "\n" " add_test(NAME <name> [CONFIGURATIONS [Debug|Release|...]]\n" " [WORKING_DIRECTORY dir]\n" diff --git a/Source/cmCoreTryCompile.cxx b/Source/cmCoreTryCompile.cxx index 086f27a..8dfaf3b 100644 --- a/Source/cmCoreTryCompile.cxx +++ b/Source/cmCoreTryCompile.cxx @@ -294,7 +294,7 @@ int cmCoreTryCompile::TryCompileCode(std::vector<std::string> const& argv) cmVersion::GetPatchVersion(), cmVersion::GetTweakVersion()); if(def) { - fprintf(fout, "SET(CMAKE_MODULE_PATH %s)\n", def); + fprintf(fout, "set(CMAKE_MODULE_PATH %s)\n", def); } std::string projectLangs; @@ -307,35 +307,35 @@ int cmCoreTryCompile::TryCompileCode(std::vector<std::string> const& argv) if(const char* rulesOverridePath = this->Makefile->GetDefinition(rulesOverrideLang.c_str())) { - fprintf(fout, "SET(%s \"%s\")\n", + fprintf(fout, "set(%s \"%s\")\n", rulesOverrideLang.c_str(), rulesOverridePath); } else if(const char* rulesOverridePath2 = this->Makefile->GetDefinition(rulesOverrideBase.c_str())) { - fprintf(fout, "SET(%s \"%s\")\n", + fprintf(fout, "set(%s \"%s\")\n", rulesOverrideBase.c_str(), rulesOverridePath2); } } - fprintf(fout, "PROJECT(CMAKE_TRY_COMPILE%s)\n", projectLangs.c_str()); - fprintf(fout, "SET(CMAKE_VERBOSE_MAKEFILE 1)\n"); + fprintf(fout, "project(CMAKE_TRY_COMPILE%s)\n", projectLangs.c_str()); + fprintf(fout, "set(CMAKE_VERBOSE_MAKEFILE 1)\n"); for(std::set<std::string>::iterator li = testLangs.begin(); li != testLangs.end(); ++li) { std::string langFlags = "CMAKE_" + *li + "_FLAGS"; const char* flags = this->Makefile->GetDefinition(langFlags.c_str()); - fprintf(fout, "SET(CMAKE_%s_FLAGS %s)\n", li->c_str(), + fprintf(fout, "set(CMAKE_%s_FLAGS %s)\n", li->c_str(), lg->EscapeForCMake(flags?flags:"").c_str()); - fprintf(fout, "SET(CMAKE_%s_FLAGS \"${CMAKE_%s_FLAGS}" + fprintf(fout, "set(CMAKE_%s_FLAGS \"${CMAKE_%s_FLAGS}" " ${COMPILE_DEFINITIONS}\")\n", li->c_str(), li->c_str()); } - fprintf(fout, "INCLUDE_DIRECTORIES(${INCLUDE_DIRECTORIES})\n"); - fprintf(fout, "SET(CMAKE_SUPPRESS_REGENERATION 1)\n"); - fprintf(fout, "LINK_DIRECTORIES(${LINK_DIRECTORIES})\n"); + fprintf(fout, "include_directories(${INCLUDE_DIRECTORIES})\n"); + fprintf(fout, "set(CMAKE_SUPPRESS_REGENERATION 1)\n"); + fprintf(fout, "link_directories(${LINK_DIRECTORIES})\n"); // handle any compile flags we need to pass on if (compileDefs.size()) { - fprintf(fout, "ADD_DEFINITIONS( "); + fprintf(fout, "add_definitions( "); for (size_t i = 0; i < compileDefs.size(); ++i) { fprintf(fout,"%s ",compileDefs[i].c_str()); @@ -406,14 +406,14 @@ int cmCoreTryCompile::TryCompileCode(std::vector<std::string> const& argv) } if(this->Makefile->GetDefinition("CMAKE_POSITION_INDEPENDENT_CODE")!=0) { - fprintf(fout, "SET(CMAKE_POSITION_INDEPENDENT_CODE \"ON\")\n"); + fprintf(fout, "set(CMAKE_POSITION_INDEPENDENT_CODE \"ON\")\n"); } /* Put the executable at a known location (for COPY_FILE). */ - fprintf(fout, "SET(CMAKE_RUNTIME_OUTPUT_DIRECTORY \"%s\")\n", + fprintf(fout, "set(CMAKE_RUNTIME_OUTPUT_DIRECTORY \"%s\")\n", this->BinaryDirectory.c_str()); /* Create the actual executable. */ - fprintf(fout, "ADD_EXECUTABLE(%s", targetName); + fprintf(fout, "add_executable(%s", targetName); for(std::vector<std::string>::iterator si = sources.begin(); si != sources.end(); ++si) { @@ -429,11 +429,11 @@ int cmCoreTryCompile::TryCompileCode(std::vector<std::string> const& argv) if (useOldLinkLibs) { fprintf(fout, - "TARGET_LINK_LIBRARIES(%s ${LINK_LIBRARIES})\n",targetName); + "target_link_libraries(%s ${LINK_LIBRARIES})\n",targetName); } else { - fprintf(fout, "TARGET_LINK_LIBRARIES(%s %s)\n", + fprintf(fout, "target_link_libraries(%s %s)\n", targetName, libsToLink.c_str()); } diff --git a/Source/cmDocumentGeneratorExpressions.h b/Source/cmDocumentGeneratorExpressions.h index 46cd77e..7bab741 100644 --- a/Source/cmDocumentGeneratorExpressions.h +++ b/Source/cmDocumentGeneratorExpressions.h @@ -40,6 +40,9 @@ "is exported using export(), or when the target is used by another " \ "target in the same buildsystem. Expands to the empty string " \ "otherwise.\n" \ + " $<PLATFORM_ID> = The CMake-id of the platform " \ + " $<PLATFORM_ID:comp> = '1' if the The CMake-id of the " \ + "platform matches comp, otherwise '0'.\n" \ " $<C_COMPILER_ID> = The CMake-id of the C compiler " \ "used.\n" \ " $<C_COMPILER_ID:comp> = '1' if the CMake-id of the C " \ diff --git a/Source/cmDocumentVariables.cxx b/Source/cmDocumentVariables.cxx index c4f6216..fb2b3b9 100644 --- a/Source/cmDocumentVariables.cxx +++ b/Source/cmDocumentVariables.cxx @@ -428,7 +428,7 @@ void cmDocumentVariables::DefineVariables(cmake* cm) "PROJECT command.",false, "Variables that Provide Information"); cm->DefineProperty - ("[Project name]_BINARY_DIR", cmProperty::VARIABLE, + ("<PROJECT-NAME>_BINARY_DIR", cmProperty::VARIABLE, "Top level binary directory for the named project.", "A variable is created with the name used in the PROJECT " "command, and is the binary directory for the project. " @@ -436,7 +436,7 @@ void cmDocumentVariables::DefineVariables(cmake* cm) "several projects.",false, "Variables that Provide Information"); cm->DefineProperty - ("[Project name]_SOURCE_DIR", cmProperty::VARIABLE, + ("<PROJECT-NAME>_SOURCE_DIR", cmProperty::VARIABLE, "Top level source directory for the named project.", "A variable is created with the name used in the PROJECT " "command, and is the source directory for the project." @@ -1477,7 +1477,7 @@ void cmDocumentVariables::DefineVariables(cmake* cm) "On most compilers this is \"-L\".",false, "Variables that Control the Build"); cm->DefineProperty - ("CMAKE_LINK_DEF_FILE_FLAG ", cmProperty::VARIABLE, + ("CMAKE_LINK_DEF_FILE_FLAG", cmProperty::VARIABLE, "Linker flag to be used to specify a .def file for dll creation.", "The flag will be used to add a .def file when creating " "a dll on Windows; this is only defined on Windows." @@ -1578,6 +1578,14 @@ void cmDocumentVariables::DefineVariables(cmake* cm) "See that target property for additional information.", false, "Variables that Control the Build"); + cm->DefineProperty + ("CMAKE_MAP_IMPORTED_CONFIG_<CONFIG>", cmProperty::VARIABLE, + "Default value for MAP_IMPORTED_CONFIG_<CONFIG> of targets.", + "This variable is used to initialize the " + "MAP_IMPORTED_CONFIG_<CONFIG> 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) @@ -1853,7 +1861,7 @@ void cmDocumentVariables::DefineVariables(cmake* cm) "Variables for Languages"); cm->DefineProperty - ("CMAKE_<LANG>_LINK_EXECUTABLE ", cmProperty::VARIABLE, + ("CMAKE_<LANG>_LINK_EXECUTABLE", cmProperty::VARIABLE, "Rule variable to link an executable.", "Rule variable to link an executable for the given language." ,false, @@ -1940,8 +1948,6 @@ void cmDocumentVariables::DefineVariables(cmake* cm) cmProperty::VARIABLE,0,0); cm->DefineProperty("CMAKE_<LANG>_INFORMATION_LOADED", cmProperty::VARIABLE,0,0); - cm->DefineProperty("CMAKE_<LANG>_LINK_EXECUTABLE", - cmProperty::VARIABLE,0,0); cm->DefineProperty("CMAKE_<LANG>_LINK_FLAGS", cmProperty::VARIABLE,0,0); cm->DefineProperty("CMAKE_<LANG>_RESPONSE_FILE_LINK_FLAG", diff --git a/Source/cmDocumentation.cxx b/Source/cmDocumentation.cxx index 4edacbb..58ce36b 100644 --- a/Source/cmDocumentation.cxx +++ b/Source/cmDocumentation.cxx @@ -829,10 +829,10 @@ int cmDocumentation::GetStructuredDocFromFile( std::vector<cmDocumentationEntry>& commands, cmake* cm) { - typedef enum sdoce { + enum sdoce { SDOC_NONE, SDOC_MODULE, SDOC_MACRO, SDOC_FUNCTION, SDOC_VARIABLE, SDOC_SECTION, - SDOC_UNKNOWN} sdoc_t; + SDOC_UNKNOWN}; int nbDocItemFound = 0; int docCtxIdx = 0; std::vector<int> docContextStack(60); @@ -1617,7 +1617,7 @@ bool cmDocumentation::PrintDocumentationSinglePolicy(std::ostream& os) return true; } - // Argument was not a command. Complain. + // Argument was not a policy. Complain. os << "Argument \"" << this->CurrentArgument.c_str() << "\" to --help-policy is not a CMake policy.\n"; return false; @@ -1639,7 +1639,7 @@ bool cmDocumentation::PrintDocumentationSingleVariable(std::ostream& os) return true; } - // Argument was not a command. Complain. + // Argument was not a variable. Complain. os << "Argument \"" << this->CurrentArgument.c_str() << "\" to --help-variable is not a defined variable. " << "Use --help-variable-list to see all defined variables.\n"; diff --git a/Source/cmExportInstallFileGenerator.cxx b/Source/cmExportInstallFileGenerator.cxx index c97d4ff..c8b4a79 100644 --- a/Source/cmExportInstallFileGenerator.cxx +++ b/Source/cmExportInstallFileGenerator.cxx @@ -162,7 +162,7 @@ bool cmExportInstallFileGenerator::GenerateMainFile(std::ostream& os) if (require2_8_12) { - this->GenerateRequiredCMakeVersion(os, "2.8.11.20130626"); + this->GenerateRequiredCMakeVersion(os, "2.8.12"); } // Now load per-configuration properties for them. diff --git a/Source/cmExportLibraryDependencies.cxx b/Source/cmExportLibraryDependencies.cxx index f07b783..e3b1626 100644 --- a/Source/cmExportLibraryDependencies.cxx +++ b/Source/cmExportLibraryDependencies.cxx @@ -169,7 +169,7 @@ void cmExportLibraryDependenciesCommand::ConstFinalPass() const const char* vertest = "\"${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION}\" GREATER 2.4"; fout << "# Generated by CMake " << cmVersion::GetCMakeVersion() << "\n\n"; - fout << "IF(" << vertest << ")\n"; + fout << "if(" << vertest << ")\n"; fout << " # Information for CMake 2.6 and above.\n"; for(std::map<cmStdString, cmStdString>::const_iterator i = libDepsNew.begin(); @@ -177,10 +177,10 @@ void cmExportLibraryDependenciesCommand::ConstFinalPass() const { if(!i->second.empty()) { - fout << " SET(\"" << i->first << "\" \"" << i->second << "\")\n"; + fout << " set(\"" << i->first << "\" \"" << i->second << "\")\n"; } } - fout << "ELSE(" << vertest << ")\n"; + fout << "else()\n"; fout << " # Information for CMake 2.4 and lower.\n"; for(std::map<cmStdString, cmStdString>::const_iterator i = libDepsOld.begin(); @@ -188,7 +188,7 @@ void cmExportLibraryDependenciesCommand::ConstFinalPass() const { if(!i->second.empty()) { - fout << " SET(\"" << i->first << "\" \"" << i->second << "\")\n"; + fout << " set(\"" << i->first << "\" \"" << i->second << "\")\n"; } } for(std::map<cmStdString, cmStdString>::const_iterator i = libTypes.begin(); @@ -196,9 +196,9 @@ void cmExportLibraryDependenciesCommand::ConstFinalPass() const { if(i->second != "general") { - fout << " SET(\"" << i->first << "\" \"" << i->second << "\")\n"; + fout << " set(\"" << i->first << "\" \"" << i->second << "\")\n"; } } - fout << "ENDIF(" << vertest << ")\n"; + fout << "endif()\n"; return; } diff --git a/Source/cmGeneratorExpression.cxx b/Source/cmGeneratorExpression.cxx index 127cf6b..97853f3 100644 --- a/Source/cmGeneratorExpression.cxx +++ b/Source/cmGeneratorExpression.cxx @@ -71,7 +71,7 @@ const char *cmCompiledGeneratorExpression::Evaluate( cmTarget *currentTarget, cmGeneratorExpressionDAGChecker *dagChecker) const { - if (!this->NeedsParsing) + if (!this->NeedsEvaluation) { return this->Input.c_str(); } @@ -129,9 +129,9 @@ cmCompiledGeneratorExpression::cmCompiledGeneratorExpression( cmGeneratorExpressionLexer l; std::vector<cmGeneratorExpressionToken> tokens = l.Tokenize(this->Input.c_str()); - this->NeedsParsing = l.GetSawGeneratorExpression(); + this->NeedsEvaluation = l.GetSawGeneratorExpression(); - if (this->NeedsParsing) + if (this->NeedsEvaluation) { cmGeneratorExpressionParser p(tokens); p.Parse(this->Evaluators); @@ -238,9 +238,12 @@ static void prefixItems(const std::string &content, std::string &result, { std::vector<std::string> entries; cmGeneratorExpression::Split(content, entries); + const char *sep = ""; for(std::vector<std::string>::const_iterator ei = entries.begin(); ei != entries.end(); ++ei) { + result += sep; + sep = ";"; if (!cmSystemTools::FileIsFullPath(ei->c_str()) && cmGeneratorExpression::Find(*ei) == std::string::npos) { diff --git a/Source/cmGeneratorExpression.h b/Source/cmGeneratorExpression.h index c20f130..bc0f6c2 100644 --- a/Source/cmGeneratorExpression.h +++ b/Source/cmGeneratorExpression.h @@ -126,7 +126,7 @@ private: cmListFileBacktrace Backtrace; std::vector<cmGeneratorExpressionEvaluator*> Evaluators; const std::string Input; - bool NeedsParsing; + bool NeedsEvaluation; mutable std::set<cmTarget*> DependTargets; mutable std::set<cmTarget*> AllTargetsSeen; diff --git a/Source/cmGeneratorExpressionEvaluator.cxx b/Source/cmGeneratorExpressionEvaluator.cxx index abe4e70..7fd0fdc 100644 --- a/Source/cmGeneratorExpressionEvaluator.cxx +++ b/Source/cmGeneratorExpressionEvaluator.cxx @@ -438,6 +438,39 @@ static const struct CxxCompilerVersionNode : public CompilerVersionNode //---------------------------------------------------------------------------- +struct PlatformIdNode : public cmGeneratorExpressionNode +{ + PlatformIdNode() {} + + virtual int NumExpectedParameters() const { return ZeroOrMoreParameters; } + + std::string Evaluate(const std::vector<std::string> ¶meters, + cmGeneratorExpressionContext *context, + const GeneratorExpressionContent *, + cmGeneratorExpressionDAGChecker *) const + { + const char *platformId = context->Makefile ? + context->Makefile->GetSafeDefinition( + "CMAKE_SYSTEM_NAME") : ""; + if (parameters.size() == 0) + { + return platformId ? platformId : ""; + } + + if (!platformId) + { + return parameters.front().empty() ? "1" : "0"; + } + + if (cmsysString_strcasecmp(parameters.begin()->c_str(), platformId) == 0) + { + return "1"; + } + return "0"; + } +} platformIdNode; + +//---------------------------------------------------------------------------- static const struct VersionGreaterNode : public cmGeneratorExpressionNode { VersionGreaterNode() {} @@ -1356,6 +1389,8 @@ cmGeneratorExpressionNode* GetNode(const std::string &identifier) return &cCompilerVersionNode; else if (identifier == "CXX_COMPILER_VERSION") return &cxxCompilerVersionNode; + else if (identifier == "PLATFORM_ID") + return &platformIdNode; else if (identifier == "CONFIGURATION") return &configurationNode; else if (identifier == "CONFIG") diff --git a/Source/cmGlobalGenerator.cxx b/Source/cmGlobalGenerator.cxx index 7f2b592..799bbdb 100644 --- a/Source/cmGlobalGenerator.cxx +++ b/Source/cmGlobalGenerator.cxx @@ -146,9 +146,17 @@ void cmGlobalGenerator::ResolveLanguageCompiler(const std::string &lang, const char* cname = this->GetCMakeInstance()-> GetCacheManager()->GetCacheValue(langComp.c_str()); std::string changeVars; - if(cname && (path != cname) && (optional==false)) + if(cname && !optional) { - std::string cnameString = cname; + std::string cnameString; + if(!cmSystemTools::FileIsFullPath(cname)) + { + cnameString = cmSystemTools::FindProgram(cname); + } + else + { + cnameString = cname; + } std::string pathString = path; // get rid of potentially multiple slashes: cmSystemTools::ConvertToUnixSlashes(cnameString); diff --git a/Source/cmGlobalUnixMakefileGenerator3.cxx b/Source/cmGlobalUnixMakefileGenerator3.cxx index 88cd6e5..3a9dc44 100644 --- a/Source/cmGlobalUnixMakefileGenerator3.cxx +++ b/Source/cmGlobalUnixMakefileGenerator3.cxx @@ -281,7 +281,7 @@ void cmGlobalUnixMakefileGenerator3::WriteMainCMakefile() // Save the generator name cmakefileStream << "# The generator used is:\n" - << "SET(CMAKE_DEPENDS_GENERATOR \"" << this->GetName() << "\")\n\n"; + << "set(CMAKE_DEPENDS_GENERATOR \"" << this->GetName() << "\")\n\n"; // for each cmMakefile get its list of dependencies std::vector<std::string> lfiles; @@ -312,7 +312,7 @@ void cmGlobalUnixMakefileGenerator3::WriteMainCMakefile() // Save the list to the cmake file. cmakefileStream << "# The top level Makefile was generated from the following files:\n" - << "SET(CMAKE_MAKEFILE_DEPENDS\n" + << "set(CMAKE_MAKEFILE_DEPENDS\n" << " \"" << lg->Convert(cache.c_str(), cmLocalGenerator::START_OUTPUT).c_str() << "\"\n"; @@ -335,7 +335,7 @@ void cmGlobalUnixMakefileGenerator3::WriteMainCMakefile() // Set the corresponding makefile in the cmake file. cmakefileStream << "# The corresponding makefile is:\n" - << "SET(CMAKE_MAKEFILE_OUTPUTS\n" + << "set(CMAKE_MAKEFILE_OUTPUTS\n" << " \"" << lg->Convert(makefileName.c_str(), cmLocalGenerator::START_OUTPUT).c_str() << "\"\n" @@ -348,7 +348,7 @@ void cmGlobalUnixMakefileGenerator3::WriteMainCMakefile() { cmakefileStream << "# Byproducts of CMake generate step:\n" - << "SET(CMAKE_MAKEFILE_PRODUCTS\n"; + << "set(CMAKE_MAKEFILE_PRODUCTS\n"; const std::vector<std::string>& outfiles = lg->GetMakefile()->GetOutputFiles(); for(std::vector<std::string>::const_iterator k = outfiles.begin(); @@ -390,7 +390,7 @@ void cmGlobalUnixMakefileGenerator3 cmakefileStream << "# Dependency information for all targets:\n"; cmakefileStream - << "SET(CMAKE_DEPEND_INFO_FILES\n"; + << "set(CMAKE_DEPEND_INFO_FILES\n"; for (unsigned int i = 0; i < lGenerators.size(); ++i) { lg = static_cast<cmLocalUnixMakefileGenerator3 *>(lGenerators[i]); diff --git a/Source/cmGlobalVisualStudio8Generator.cxx b/Source/cmGlobalVisualStudio8Generator.cxx index e4244e0..1a4c7ff 100644 --- a/Source/cmGlobalVisualStudio8Generator.cxx +++ b/Source/cmGlobalVisualStudio8Generator.cxx @@ -202,7 +202,7 @@ std::string cmGlobalVisualStudio8Generator::GetUserMacrosRegKeyBase() } //---------------------------------------------------------------------------- -void cmGlobalVisualStudio8Generator::AddCheckTarget() +bool cmGlobalVisualStudio8Generator::AddCheckTarget() { // Add a special target on which all other targets depend that // checks the build system and optionally re-runs CMake. @@ -216,7 +216,7 @@ void cmGlobalVisualStudio8Generator::AddCheckTarget() // Skip the target if no regeneration is to be done. if(mf->IsOn("CMAKE_SUPPRESS_REGENERATION")) { - return; + return false; } std::string cmake_command = mf->GetRequiredDefinition("CMAKE_COMMAND"); @@ -315,21 +315,24 @@ void cmGlobalVisualStudio8Generator::AddCheckTarget() cmSystemTools::Error("Error adding rule for ", stamps[0].c_str()); } } + + return true; } //---------------------------------------------------------------------------- void cmGlobalVisualStudio8Generator::Generate() { - this->AddCheckTarget(); - - // All targets depend on the build-system check target. - for(std::map<cmStdString,cmTarget *>::const_iterator - ti = this->TotalTargets.begin(); - ti != this->TotalTargets.end(); ++ti) + if(this->AddCheckTarget()) { - if(ti->first != CMAKE_CHECK_BUILD_SYSTEM_TARGET) + // All targets depend on the build-system check target. + for(std::map<cmStdString,cmTarget *>::const_iterator + ti = this->TotalTargets.begin(); + ti != this->TotalTargets.end(); ++ti) { - ti->second->AddUtility(CMAKE_CHECK_BUILD_SYSTEM_TARGET); + if(ti->first != CMAKE_CHECK_BUILD_SYSTEM_TARGET) + { + ti->second->AddUtility(CMAKE_CHECK_BUILD_SYSTEM_TARGET); + } } } diff --git a/Source/cmGlobalVisualStudio8Generator.h b/Source/cmGlobalVisualStudio8Generator.h index d181742..2376f8a 100644 --- a/Source/cmGlobalVisualStudio8Generator.h +++ b/Source/cmGlobalVisualStudio8Generator.h @@ -71,7 +71,7 @@ protected: virtual bool VSLinksDependencies() const { return false; } - void AddCheckTarget(); + bool AddCheckTarget(); static cmIDEFlagTable const* GetExtraFlagTableVS8(); virtual void WriteSLNHeader(std::ostream& fout); diff --git a/Source/cmGlobalXCodeGenerator.cxx b/Source/cmGlobalXCodeGenerator.cxx index 7cb2d1f..0a2b32b 100644 --- a/Source/cmGlobalXCodeGenerator.cxx +++ b/Source/cmGlobalXCodeGenerator.cxx @@ -431,13 +431,16 @@ cmGlobalXCodeGenerator::AddExtraTargets(cmLocalGenerator* root, // Add XCODE depend helper std::string dir = mf->GetCurrentOutputDirectory(); - cmCustomCommandLine makecommand; - makecommand.push_back("make"); - makecommand.push_back("-C"); - makecommand.push_back(dir.c_str()); - makecommand.push_back("-f"); - makecommand.push_back(this->CurrentXCodeHackMakefile.c_str()); - makecommand.push_back(""); // placeholder, see below + cmCustomCommandLine makeHelper; + if(this->XcodeVersion < 50) + { + makeHelper.push_back("make"); + makeHelper.push_back("-C"); + makeHelper.push_back(dir.c_str()); + makeHelper.push_back("-f"); + makeHelper.push_back(this->CurrentXCodeHackMakefile.c_str()); + makeHelper.push_back(""); // placeholder, see below + } // Add ZERO_CHECK bool regenerate = !mf->IsOn("CMAKE_SUPPRESS_REGENERATION"); @@ -477,17 +480,18 @@ cmGlobalXCodeGenerator::AddExtraTargets(cmLocalGenerator* root, // run the depend check makefile as a post build rule // this will make sure that when the next target is built // things are up-to-date - if((target.GetType() == cmTarget::EXECUTABLE || + if(!makeHelper.empty() && + (target.GetType() == cmTarget::EXECUTABLE || // Nope - no post-build for OBJECT_LIRBRARY // target.GetType() == cmTarget::OBJECT_LIBRARY || target.GetType() == cmTarget::STATIC_LIBRARY || target.GetType() == cmTarget::SHARED_LIBRARY || target.GetType() == cmTarget::MODULE_LIBRARY)) { - makecommand[makecommand.size()-1] = + makeHelper[makeHelper.size()-1] = // fill placeholder this->PostBuildMakeTarget(target.GetName(), "$(CONFIGURATION)"); cmCustomCommandLines commandLines; - commandLines.push_back(makecommand); + commandLines.push_back(makeHelper); lg->GetMakefile()->AddCustomCommandToTarget(target.GetName(), no_depends, commandLines, @@ -1027,18 +1031,21 @@ cmGlobalXCodeGenerator::CreateXCodeTargets(cmLocalGenerator* gen, } } - // Add object library contents as external objects. (Equivalent to - // the externalObjFiles above, except each one is not a cmSourceFile - // within the target.) - std::vector<std::string> objs; - this->GetGeneratorTarget(&cmtarget)->UseObjectLibraries(objs); - for(std::vector<std::string>::const_iterator - oi = objs.begin(); oi != objs.end(); ++oi) + if(this->XcodeVersion < 50) { - std::string obj = *oi; - cmXCodeObject* xsf = - this->CreateXCodeSourceFileFromPath(obj, cmtarget, ""); - externalObjFiles.push_back(xsf); + // Add object library contents as external objects. (Equivalent to + // the externalObjFiles above, except each one is not a cmSourceFile + // within the target.) + std::vector<std::string> objs; + this->GetGeneratorTarget(&cmtarget)->UseObjectLibraries(objs); + for(std::vector<std::string>::const_iterator + oi = objs.begin(); oi != objs.end(); ++oi) + { + std::string obj = *oi; + cmXCodeObject* xsf = + this->CreateXCodeSourceFileFromPath(obj, cmtarget, ""); + externalObjFiles.push_back(xsf); + } } // some build phases only apply to bundles and/or frameworks @@ -2765,13 +2772,6 @@ void cmGlobalXCodeGenerator } } - // Skip link information for static libraries. - if(cmtarget->GetType() == cmTarget::OBJECT_LIBRARY || - cmtarget->GetType() == cmTarget::STATIC_LIBRARY) - { - return; - } - // Loop over configuration types and set per-configuration info. for(std::vector<std::string>::iterator i = this->CurrentConfigurationTypes.begin(); @@ -2784,6 +2784,31 @@ void cmGlobalXCodeGenerator configName = 0; } + if(this->XcodeVersion >= 50) + { + // Add object library contents as link flags. + std::string linkObjs; + const char* sep = ""; + std::vector<std::string> objs; + this->GetGeneratorTarget(cmtarget)->UseObjectLibraries(objs); + for(std::vector<std::string>::const_iterator + oi = objs.begin(); oi != objs.end(); ++oi) + { + linkObjs += sep; + sep = " "; + linkObjs += this->XCodeEscapePath(oi->c_str()); + } + this->AppendBuildSettingAttribute(target, "OTHER_LDFLAGS", + linkObjs.c_str(), configName); + } + + // Skip link information for object libraries. + if(cmtarget->GetType() == cmTarget::OBJECT_LIBRARY || + cmtarget->GetType() == cmTarget::STATIC_LIBRARY) + { + continue; + } + // Compute the link library and directory information. cmComputeLinkInformation* pcli = cmtarget->GetLinkInformation(configName); if(!pcli) @@ -3338,8 +3363,11 @@ void cmGlobalXCodeGenerator cmXCodeObject* t = *i; this->AddDependAndLinkInformation(t); } - // now create xcode depend hack makefile - this->CreateXCodeDependHackTarget(targets); + if(this->XcodeVersion < 50) + { + // now create xcode depend hack makefile + this->CreateXCodeDependHackTarget(targets); + } // now add all targets to the root object cmXCodeObject* allTargets = this->CreateObject(cmXCodeObject::OBJECT_LIST); for(std::vector<cmXCodeObject*>::iterator i = targets.begin(); diff --git a/Source/cmInstallExportGenerator.cxx b/Source/cmInstallExportGenerator.cxx index 3e9e6ac..1287ea6 100644 --- a/Source/cmInstallExportGenerator.cxx +++ b/Source/cmInstallExportGenerator.cxx @@ -183,11 +183,11 @@ cmInstallExportGenerator::GenerateScriptConfigs(std::ostream& os, { files.push_back(i->second); std::string config_test = this->CreateConfigTest(i->first.c_str()); - os << indent << "IF(" << config_test << ")\n"; + os << indent << "if(" << config_test << ")\n"; this->AddInstallRule(os, cmInstallType_FILES, files, false, this->FilePermissions.c_str(), 0, 0, 0, indent.Next()); - os << indent << "ENDIF(" << config_test << ")\n"; + os << indent << "endif()\n"; files.clear(); } } @@ -202,23 +202,23 @@ void cmInstallExportGenerator::GenerateScriptActions(std::ostream& os, installedDir += "/"; std::string installedFile = installedDir; installedFile += this->FileName; - os << indent << "IF(EXISTS \"" << installedFile << "\")\n"; + os << indent << "if(EXISTS \"" << installedFile << "\")\n"; Indent indentN = indent.Next(); Indent indentNN = indentN.Next(); Indent indentNNN = indentNN.Next(); - os << indentN << "FILE(DIFFERENT EXPORT_FILE_CHANGED FILES\n" + os << indentN << "file(DIFFERENT EXPORT_FILE_CHANGED FILES\n" << indentN << " \"" << installedFile << "\"\n" << indentN << " \"" << this->MainImportFile << "\")\n"; - os << indentN << "IF(EXPORT_FILE_CHANGED)\n"; - os << indentNN << "FILE(GLOB OLD_CONFIG_FILES \"" << installedDir + os << indentN << "if(EXPORT_FILE_CHANGED)\n"; + os << indentNN << "file(GLOB OLD_CONFIG_FILES \"" << installedDir << this->EFGen->GetConfigImportFileGlob() << "\")\n"; - os << indentNN << "IF(OLD_CONFIG_FILES)\n"; - os << indentNNN << "MESSAGE(STATUS \"Old export file \\\"" << installedFile + os << indentNN << "if(OLD_CONFIG_FILES)\n"; + os << indentNNN << "message(STATUS \"Old export file \\\"" << installedFile << "\\\" will be replaced. Removing files [${OLD_CONFIG_FILES}].\")\n"; - os << indentNNN << "FILE(REMOVE ${OLD_CONFIG_FILES})\n"; - os << indentNN << "ENDIF(OLD_CONFIG_FILES)\n"; - os << indentN << "ENDIF(EXPORT_FILE_CHANGED)\n"; - os << indent << "ENDIF()\n"; + os << indentNNN << "file(REMOVE ${OLD_CONFIG_FILES})\n"; + os << indentNN << "endif()\n"; + os << indentN << "endif()\n"; + os << indent << "endif()\n"; // Install the main export file. std::vector<std::string> files; diff --git a/Source/cmInstallGenerator.cxx b/Source/cmInstallGenerator.cxx index 3be2c2b..d105a0c 100644 --- a/Source/cmInstallGenerator.cxx +++ b/Source/cmInstallGenerator.cxx @@ -80,18 +80,18 @@ void cmInstallGenerator } } os << "\")\n"; - os << indent << "IF (CMAKE_WARN_ON_ABSOLUTE_INSTALL_DESTINATION)\n"; + os << indent << "if(CMAKE_WARN_ON_ABSOLUTE_INSTALL_DESTINATION)\n"; os << indent << indent << "message(WARNING \"ABSOLUTE path INSTALL " << "DESTINATION : ${CMAKE_ABSOLUTE_DESTINATION_FILES}\")\n"; - os << indent << "ENDIF (CMAKE_WARN_ON_ABSOLUTE_INSTALL_DESTINATION)\n"; + os << indent << "endif()\n"; - os << indent << "IF (CMAKE_ERROR_ON_ABSOLUTE_INSTALL_DESTINATION)\n"; + os << indent << "if(CMAKE_ERROR_ON_ABSOLUTE_INSTALL_DESTINATION)\n"; os << indent << indent << "message(FATAL_ERROR \"ABSOLUTE path INSTALL " << "DESTINATION forbidden (by caller): " << "${CMAKE_ABSOLUTE_DESTINATION_FILES}\")\n"; - os << indent << "ENDIF (CMAKE_ERROR_ON_ABSOLUTE_INSTALL_DESTINATION)\n"; + os << indent << "endif()\n"; } - os << "FILE(INSTALL DESTINATION \"" << dest << "\" TYPE " << stype.c_str(); + os << "file(INSTALL DESTINATION \"" << dest << "\" TYPE " << stype.c_str(); if(optional) { os << " OPTIONAL"; @@ -153,13 +153,13 @@ void cmInstallGenerator::GenerateScript(std::ostream& os) // Begin this block of installation. std::string component_test = this->CreateComponentTest(this->Component.c_str()); - os << indent << "IF(" << component_test << ")\n"; + os << indent << "if(" << component_test << ")\n"; // Generate the script possibly with per-configuration code. this->GenerateScriptConfigs(os, indent.Next()); // End this block of installation. - os << indent << "ENDIF(" << component_test << ")\n\n"; + os << indent << "endif()\n\n"; } //---------------------------------------------------------------------------- diff --git a/Source/cmInstallScriptGenerator.cxx b/Source/cmInstallScriptGenerator.cxx index bcfbe63..1ecf021 100644 --- a/Source/cmInstallScriptGenerator.cxx +++ b/Source/cmInstallScriptGenerator.cxx @@ -32,7 +32,7 @@ void cmInstallScriptGenerator::GenerateScript(std::ostream& os) Indent indent; std::string component_test = this->CreateComponentTest(this->Component.c_str()); - os << indent << "IF(" << component_test << ")\n"; + os << indent << "if(" << component_test << ")\n"; if(this->Code) { @@ -40,8 +40,8 @@ void cmInstallScriptGenerator::GenerateScript(std::ostream& os) } else { - os << indent.Next() << "INCLUDE(\"" << this->Script << "\")\n"; + os << indent.Next() << "include(\"" << this->Script << "\")\n"; } - os << indent << "ENDIF(" << component_test << ")\n\n"; + os << indent << "endif()\n\n"; } diff --git a/Source/cmInstallTargetGenerator.cxx b/Source/cmInstallTargetGenerator.cxx index c9624c8..d0768c8 100644 --- a/Source/cmInstallTargetGenerator.cxx +++ b/Source/cmInstallTargetGenerator.cxx @@ -407,10 +407,10 @@ cmInstallTargetGenerator std::string tws = tw.str(); if(!tws.empty()) { - os << indent << "IF(EXISTS \"" << file << "\" AND\n" + os << indent << "if(EXISTS \"" << file << "\" AND\n" << indent << " NOT IS_SYMLINK \"" << file << "\")\n"; os << tws; - os << indent << "ENDIF()\n"; + os << indent << "endif()\n"; } } @@ -434,7 +434,7 @@ cmInstallTargetGenerator if(!tws.empty()) { Indent indent2 = indent.Next().Next(); - os << indent << "FOREACH(file\n"; + os << indent << "foreach(file\n"; for(std::vector<std::string>::const_iterator i = files.begin(); i != files.end(); ++i) { @@ -442,7 +442,7 @@ cmInstallTargetGenerator } os << indent2 << ")\n"; os << tws; - os << indent << "ENDFOREACH()\n"; + os << indent << "endforeach()\n"; } } } @@ -577,7 +577,7 @@ cmInstallTargetGenerator // install_name value and references. if(!new_id.empty() || !install_name_remap.empty()) { - os << indent << "EXECUTE_PROCESS(COMMAND \"" << installNameTool; + os << indent << "execute_process(COMMAND \"" << installNameTool; os << "\""; if(!new_id.empty()) { @@ -626,7 +626,7 @@ cmInstallTargetGenerator // Write a rule to remove the installed file if its rpath is not the // new rpath. This is needed for existing build/install trees when // the installed rpath changes but the file is not rebuilt. - os << indent << "FILE(RPATH_CHECK\n" + os << indent << "file(RPATH_CHECK\n" << indent << " FILE \"" << toDestDirPath << "\"\n" << indent << " RPATH \"" << newRpath << "\")\n"; } @@ -697,12 +697,12 @@ cmInstallTargetGenerator // Write a rule to run chrpath to set the install-tree RPATH if(newRpath.empty()) { - os << indent << "FILE(RPATH_REMOVE\n" + os << indent << "file(RPATH_REMOVE\n" << indent << " FILE \"" << toDestDirPath << "\")\n"; } else { - os << indent << "FILE(RPATH_CHANGE\n" + os << indent << "file(RPATH_CHANGE\n" << indent << " FILE \"" << toDestDirPath << "\"\n" << indent << " OLD_RPATH \"" << oldRpath << "\"\n" << indent << " NEW_RPATH \"" << newRpath << "\")\n"; @@ -736,11 +736,11 @@ cmInstallTargetGenerator::AddStripRule(std::ostream& os, return; } - os << indent << "IF(CMAKE_INSTALL_DO_STRIP)\n"; - os << indent << " EXECUTE_PROCESS(COMMAND \"" + os << indent << "if(CMAKE_INSTALL_DO_STRIP)\n"; + os << indent << " execute_process(COMMAND \"" << this->Target->GetMakefile()->GetDefinition("CMAKE_STRIP") << "\" \"" << toDestDirPath << "\")\n"; - os << indent << "ENDIF(CMAKE_INSTALL_DO_STRIP)\n"; + os << indent << "endif()\n"; } //---------------------------------------------------------------------------- @@ -769,6 +769,6 @@ cmInstallTargetGenerator::AddRanlibRule(std::ostream& os, return; } - os << indent << "EXECUTE_PROCESS(COMMAND \"" + os << indent << "execute_process(COMMAND \"" << ranlib << "\" \"" << toDestDirPath << "\")\n"; } diff --git a/Source/cmListFileLexer.c b/Source/cmListFileLexer.c index 2841fe5..f127add 100644 --- a/Source/cmListFileLexer.c +++ b/Source/cmListFileLexer.c @@ -2271,6 +2271,7 @@ static void cmListFileLexerInit(cmListFileLexer* lexer) /*--------------------------------------------------------------------------*/ static void cmListFileLexerDestroy(cmListFileLexer* lexer) { + cmListFileLexerSetToken(lexer, 0, 0); if(lexer->file || lexer->string_buffer) { cmListFileLexer_yylex_destroy(lexer->scanner); diff --git a/Source/cmListFileLexer.in.l b/Source/cmListFileLexer.in.l index 12b53ee..bd3c1eb 100644 --- a/Source/cmListFileLexer.in.l +++ b/Source/cmListFileLexer.in.l @@ -292,6 +292,7 @@ static void cmListFileLexerInit(cmListFileLexer* lexer) /*--------------------------------------------------------------------------*/ static void cmListFileLexerDestroy(cmListFileLexer* lexer) { + cmListFileLexerSetToken(lexer, 0, 0); if(lexer->file || lexer->string_buffer) { cmListFileLexer_yylex_destroy(lexer->scanner); diff --git a/Source/cmLocalGenerator.cxx b/Source/cmLocalGenerator.cxx index 9c04109..afc04b9 100644 --- a/Source/cmLocalGenerator.cxx +++ b/Source/cmLocalGenerator.cxx @@ -297,7 +297,7 @@ void cmLocalGenerator::GenerateTestFiles() this->Makefile->GetProperty("TEST_INCLUDE_FILE"); if ( testIncludeFile ) { - fout << "INCLUDE(\"" << testIncludeFile << "\")" << std::endl; + fout << "include(\"" << testIncludeFile << "\")" << std::endl; } // Ask each test generator to write its code. @@ -313,7 +313,8 @@ void cmLocalGenerator::GenerateTestFiles() size_t i; for(i = 0; i < this->Children.size(); ++i) { - fout << "SUBDIRS("; + // TODO: Use add_subdirectory instead? + fout << "subdirs("; std::string outP = this->Children[i]->GetMakefile()->GetStartOutputDirectory(); fout << this->Convert(outP.c_str(),START_OUTPUT); @@ -416,39 +417,39 @@ void cmLocalGenerator::GenerateInstallRules() fout << "# Install script for directory: " << this->Makefile->GetCurrentDirectory() << std::endl << std::endl; fout << "# Set the install prefix" << std::endl - << "IF(NOT DEFINED CMAKE_INSTALL_PREFIX)" << std::endl - << " SET(CMAKE_INSTALL_PREFIX \"" << prefix << "\")" << std::endl - << "ENDIF(NOT DEFINED CMAKE_INSTALL_PREFIX)" << std::endl - << "STRING(REGEX REPLACE \"/$\" \"\" CMAKE_INSTALL_PREFIX " + << "if(NOT DEFINED CMAKE_INSTALL_PREFIX)" << std::endl + << " set(CMAKE_INSTALL_PREFIX \"" << prefix << "\")" << std::endl + << "endif()" << std::endl + << "string(REGEX REPLACE \"/$\" \"\" CMAKE_INSTALL_PREFIX " << "\"${CMAKE_INSTALL_PREFIX}\")" << std::endl << std::endl; // Write support code for generating per-configuration install rules. fout << "# Set the install configuration name.\n" - "IF(NOT DEFINED CMAKE_INSTALL_CONFIG_NAME)\n" - " IF(BUILD_TYPE)\n" - " STRING(REGEX REPLACE \"^[^A-Za-z0-9_]+\" \"\"\n" + "if(NOT DEFINED CMAKE_INSTALL_CONFIG_NAME)\n" + " if(BUILD_TYPE)\n" + " string(REGEX REPLACE \"^[^A-Za-z0-9_]+\" \"\"\n" " CMAKE_INSTALL_CONFIG_NAME \"${BUILD_TYPE}\")\n" - " ELSE(BUILD_TYPE)\n" - " SET(CMAKE_INSTALL_CONFIG_NAME \"" << default_config << "\")\n" - " ENDIF(BUILD_TYPE)\n" - " MESSAGE(STATUS \"Install configuration: " + " else()\n" + " set(CMAKE_INSTALL_CONFIG_NAME \"" << default_config << "\")\n" + " endif()\n" + " message(STATUS \"Install configuration: " "\\\"${CMAKE_INSTALL_CONFIG_NAME}\\\"\")\n" - "ENDIF(NOT DEFINED CMAKE_INSTALL_CONFIG_NAME)\n" + "endif()\n" "\n"; // Write support code for dealing with component-specific installs. fout << "# Set the component getting installed.\n" - "IF(NOT CMAKE_INSTALL_COMPONENT)\n" - " IF(COMPONENT)\n" - " MESSAGE(STATUS \"Install component: \\\"${COMPONENT}\\\"\")\n" - " SET(CMAKE_INSTALL_COMPONENT \"${COMPONENT}\")\n" - " ELSE(COMPONENT)\n" - " SET(CMAKE_INSTALL_COMPONENT)\n" - " ENDIF(COMPONENT)\n" - "ENDIF(NOT CMAKE_INSTALL_COMPONENT)\n" + "if(NOT CMAKE_INSTALL_COMPONENT)\n" + " if(COMPONENT)\n" + " message(STATUS \"Install component: \\\"${COMPONENT}\\\"\")\n" + " set(CMAKE_INSTALL_COMPONENT \"${COMPONENT}\")\n" + " else()\n" + " set(CMAKE_INSTALL_COMPONENT)\n" + " endif()\n" + "endif()\n" "\n"; // Copy user-specified install options to the install code. @@ -457,9 +458,9 @@ void cmLocalGenerator::GenerateInstallRules() { fout << "# Install shared libraries without execute permission?\n" - "IF(NOT DEFINED CMAKE_INSTALL_SO_NO_EXE)\n" - " SET(CMAKE_INSTALL_SO_NO_EXE \"" << so_no_exe << "\")\n" - "ENDIF(NOT DEFINED CMAKE_INSTALL_SO_NO_EXE)\n" + "if(NOT DEFINED CMAKE_INSTALL_SO_NO_EXE)\n" + " set(CMAKE_INSTALL_SO_NO_EXE \"" << so_no_exe << "\")\n" + "endif()\n" "\n"; } @@ -479,7 +480,7 @@ void cmLocalGenerator::GenerateInstallRules() // Include install scripts from subdirectories. if(!this->Children.empty()) { - fout << "IF(NOT CMAKE_INSTALL_LOCAL_ONLY)\n"; + fout << "if(NOT CMAKE_INSTALL_LOCAL_ONLY)\n"; fout << " # Include the install script for each subdirectory.\n"; for(std::vector<cmLocalGenerator*>::const_iterator ci = this->Children.begin(); ci != this->Children.end(); ++ci) @@ -488,34 +489,34 @@ void cmLocalGenerator::GenerateInstallRules() { std::string odir = (*ci)->GetMakefile()->GetStartOutputDirectory(); cmSystemTools::ConvertToUnixSlashes(odir); - fout << " INCLUDE(\"" << odir.c_str() + fout << " include(\"" << odir.c_str() << "/cmake_install.cmake\")" << std::endl; } } fout << "\n"; - fout << "ENDIF(NOT CMAKE_INSTALL_LOCAL_ONLY)\n\n"; + fout << "endif()\n\n"; } // Record the install manifest. if ( toplevel_install ) { fout << - "IF(CMAKE_INSTALL_COMPONENT)\n" - " SET(CMAKE_INSTALL_MANIFEST \"install_manifest_" + "if(CMAKE_INSTALL_COMPONENT)\n" + " set(CMAKE_INSTALL_MANIFEST \"install_manifest_" "${CMAKE_INSTALL_COMPONENT}.txt\")\n" - "ELSE(CMAKE_INSTALL_COMPONENT)\n" - " SET(CMAKE_INSTALL_MANIFEST \"install_manifest.txt\")\n" - "ENDIF(CMAKE_INSTALL_COMPONENT)\n\n"; + "else()\n" + " set(CMAKE_INSTALL_MANIFEST \"install_manifest.txt\")\n" + "endif()\n\n"; fout - << "FILE(WRITE \"" + << "file(WRITE \"" << homedir.c_str() << "/${CMAKE_INSTALL_MANIFEST}\" " << "\"\")" << std::endl; fout - << "FOREACH(file ${CMAKE_INSTALL_MANIFEST_FILES})" << std::endl - << " FILE(APPEND \"" + << "foreach(file ${CMAKE_INSTALL_MANIFEST_FILES})" << std::endl + << " file(APPEND \"" << homedir.c_str() << "/${CMAKE_INSTALL_MANIFEST}\" " << "\"${file}\\n\")" << std::endl - << "ENDFOREACH(file)" << std::endl; + << "endforeach()" << std::endl; } } diff --git a/Source/cmLocalNinjaGenerator.cxx b/Source/cmLocalNinjaGenerator.cxx index a522e37..89b05d7 100644 --- a/Source/cmLocalNinjaGenerator.cxx +++ b/Source/cmLocalNinjaGenerator.cxx @@ -17,7 +17,6 @@ #include "cmNinjaTargetGenerator.h" #include "cmGeneratedFileStream.h" #include "cmSourceFile.h" -#include "cmComputeLinkInformation.h" #include "cmake.h" #include <assert.h> diff --git a/Source/cmLocalUnixMakefileGenerator3.cxx b/Source/cmLocalUnixMakefileGenerator3.cxx index 56da1f9..2443583 100644 --- a/Source/cmLocalUnixMakefileGenerator3.cxx +++ b/Source/cmLocalUnixMakefileGenerator3.cxx @@ -474,9 +474,9 @@ void cmLocalUnixMakefileGenerator3::WriteDirectoryInformationFile() // Setup relative path conversion tops. infoFileStream << "# Relative path conversion top directories.\n" - << "SET(CMAKE_RELATIVE_PATH_TOP_SOURCE \"" << this->RelativePathTopSource + << "set(CMAKE_RELATIVE_PATH_TOP_SOURCE \"" << this->RelativePathTopSource << "\")\n" - << "SET(CMAKE_RELATIVE_PATH_TOP_BINARY \"" << this->RelativePathTopBinary + << "set(CMAKE_RELATIVE_PATH_TOP_BINARY \"" << this->RelativePathTopBinary << "\")\n" << "\n"; @@ -485,7 +485,7 @@ void cmLocalUnixMakefileGenerator3::WriteDirectoryInformationFile() { infoFileStream << "# Force unix paths in dependencies.\n" - << "SET(CMAKE_FORCE_UNIX_PATHS 1)\n" + << "set(CMAKE_FORCE_UNIX_PATHS 1)\n" << "\n"; } @@ -495,21 +495,21 @@ void cmLocalUnixMakefileGenerator3::WriteDirectoryInformationFile() << "# The C and CXX include file regular expressions for " << "this directory.\n"; infoFileStream - << "SET(CMAKE_C_INCLUDE_REGEX_SCAN "; + << "set(CMAKE_C_INCLUDE_REGEX_SCAN "; this->WriteCMakeArgument(infoFileStream, this->Makefile->GetIncludeRegularExpression()); infoFileStream << ")\n"; infoFileStream - << "SET(CMAKE_C_INCLUDE_REGEX_COMPLAIN "; + << "set(CMAKE_C_INCLUDE_REGEX_COMPLAIN "; this->WriteCMakeArgument(infoFileStream, this->Makefile->GetComplainRegularExpression()); infoFileStream << ")\n"; infoFileStream - << "SET(CMAKE_CXX_INCLUDE_REGEX_SCAN ${CMAKE_C_INCLUDE_REGEX_SCAN})\n"; + << "set(CMAKE_CXX_INCLUDE_REGEX_SCAN ${CMAKE_C_INCLUDE_REGEX_SCAN})\n"; infoFileStream - << "SET(CMAKE_CXX_INCLUDE_REGEX_COMPLAIN " + << "set(CMAKE_CXX_INCLUDE_REGEX_COMPLAIN " "${CMAKE_C_INCLUDE_REGEX_COMPLAIN})\n"; } @@ -1176,7 +1176,7 @@ cmLocalUnixMakefileGenerator3 { cmSystemTools::Error("Could not create ", cleanfilePath.c_str()); } - fout << "FILE(REMOVE_RECURSE\n"; + fout << "file(REMOVE_RECURSE\n"; std::string remove = "$(CMAKE_COMMAND) -P "; remove += this->Convert(cleanfile.c_str(), START_OUTPUT, SHELL); for(std::vector<std::string>::const_iterator f = files.begin(); @@ -1196,16 +1196,16 @@ cmLocalUnixMakefileGenerator3 target.GetLanguages(languages); fout << "\n" << "# Per-language clean rules from dependency scanning.\n" - << "FOREACH(lang"; + << "foreach(lang"; for(std::set<cmStdString>::const_iterator l = languages.begin(); l != languages.end(); ++l) { fout << " " << *l; } fout << ")\n" - << " INCLUDE(" << this->GetTargetDirectory(target) + << " include(" << this->GetTargetDirectory(target) << "/cmake_clean_${lang}.cmake OPTIONAL)\n" - << "ENDFOREACH(lang)\n"; + << "endforeach()\n"; } } } @@ -1915,7 +1915,7 @@ void cmLocalUnixMakefileGenerator3 cmakefileStream << "# The set of languages for which implicit dependencies are needed:\n"; cmakefileStream - << "SET(CMAKE_DEPENDS_LANGUAGES\n"; + << "set(CMAKE_DEPENDS_LANGUAGES\n"; for(ImplicitDependLanguageMap::const_iterator l = implicitLangs.begin(); l != implicitLangs.end(); ++l) { @@ -1930,7 +1930,7 @@ void cmLocalUnixMakefileGenerator3 l = implicitLangs.begin(); l != implicitLangs.end(); ++l) { cmakefileStream - << "SET(CMAKE_DEPENDS_CHECK_" << l->first.c_str() << "\n"; + << "set(CMAKE_DEPENDS_CHECK_" << l->first.c_str() << "\n"; ImplicitDependFileMap const& implicitPairs = l->second; // for each file pair @@ -1954,7 +1954,7 @@ void cmLocalUnixMakefileGenerator3 if(cid && *cid) { cmakefileStream - << "SET(CMAKE_" << l->first.c_str() << "_COMPILER_ID \"" + << "set(CMAKE_" << l->first.c_str() << "_COMPILER_ID \"" << cid << "\")\n"; } } @@ -1968,7 +1968,7 @@ void cmLocalUnixMakefileGenerator3 cmakefileStream << "\n" << "# Preprocessor definitions for this target.\n" - << "SET(CMAKE_TARGET_DEFINITIONS\n"; + << "set(CMAKE_TARGET_DEFINITIONS\n"; for(std::set<std::string>::const_iterator di = defines.begin(); di != defines.end(); ++di) { @@ -1995,7 +1995,7 @@ void cmLocalUnixMakefileGenerator3 if(!transformRules.empty()) { cmakefileStream - << "SET(CMAKE_INCLUDE_TRANSFORMS\n"; + << "set(CMAKE_INCLUDE_TRANSFORMS\n"; for(std::vector<std::string>::const_iterator tri = transformRules.begin(); tri != transformRules.end(); ++tri) { diff --git a/Source/cmLocalVisualStudio6Generator.cxx b/Source/cmLocalVisualStudio6Generator.cxx index e5b4057..f00a937 100644 --- a/Source/cmLocalVisualStudio6Generator.cxx +++ b/Source/cmLocalVisualStudio6Generator.cxx @@ -147,7 +147,7 @@ void cmLocalVisualStudio6Generator::OutputDSPFile() this->SetBuildType(UTILITY, l->first.c_str(), l->second); break; default: - cmSystemTools::Error("Bad target type", l->first.c_str()); + cmSystemTools::Error("Bad target type: ", l->first.c_str()); break; } // INCLUDE_EXTERNAL_MSPROJECT command only affects the workspace @@ -165,7 +165,7 @@ void cmLocalVisualStudio6Generator::OutputDSPFile() dir += l->first.substr(0, pos); if(!cmSystemTools::MakeDirectory(dir.c_str())) { - cmSystemTools::Error("Error creating directory ", dir.c_str()); + cmSystemTools::Error("Error creating directory: ", dir.c_str()); } } this->CreateSingleDSP(l->first.c_str(),l->second); diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx index fd06a33..34541e9 100644 --- a/Source/cmMakefile.cxx +++ b/Source/cmMakefile.cxx @@ -1069,6 +1069,19 @@ void cmMakefile::UpdateOutputToSourceMap(std::string const& output, cmSourceFile* source) { + OutputToSourceMap::iterator i = this->OutputToSource.find(output); + if(i != this->OutputToSource.end()) + { + // Multiple custom commands produce the same output but may + // be attached to a different source file (MAIN_DEPENDENCY). + // LinearGetSourceFileWithOutput would return the first one, + // so keep the mapping for the first one. + // + // TODO: Warn the user about this case. However, the VS 8 generator + // triggers it for separate generate.stamp rules in ZERO_CHECK and + // individual targets. + return; + } this->OutputToSource[output] = source; } diff --git a/Source/cmMakefileTargetGenerator.cxx b/Source/cmMakefileTargetGenerator.cxx index 0829cab..33974ae 100644 --- a/Source/cmMakefileTargetGenerator.cxx +++ b/Source/cmMakefileTargetGenerator.cxx @@ -21,6 +21,7 @@ #include "cmTarget.h" #include "cmake.h" #include "cmComputeLinkInformation.h" +#include "cmGeneratorExpression.h" #include "cmMakefileExecutableTargetGenerator.h" #include "cmMakefileLibraryTargetGenerator.h" @@ -131,7 +132,14 @@ void cmMakefileTargetGenerator::WriteTargetBuildRules() this->Makefile->GetProperty ("ADDITIONAL_MAKE_CLEAN_FILES")) { - cmSystemTools::ExpandListArgument(additional_clean_files, + const char *config = this->Makefile->GetDefinition("CMAKE_BUILD_TYPE"); + cmListFileBacktrace lfbt; + cmGeneratorExpression ge(lfbt); + cmsys::auto_ptr<cmCompiledGeneratorExpression> cge = + ge.Parse(additional_clean_files); + + cmSystemTools::ExpandListArgument(cge->Evaluate(this->Makefile, config, + false, this->Target, 0, 0), this->CleanFiles); } @@ -968,7 +976,7 @@ void cmMakefileTargetGenerator::WriteTargetDependRules() *this->InfoFileStream << "\n" << "# Pairs of files generated by the same build rule.\n" - << "SET(CMAKE_MULTIPLE_OUTPUT_PAIRS\n"; + << "set(CMAKE_MULTIPLE_OUTPUT_PAIRS\n"; for(MultipleOutputPairsType::const_iterator pi = this->MultipleOutputPairs.begin(); pi != this->MultipleOutputPairs.end(); ++pi) @@ -986,7 +994,7 @@ void cmMakefileTargetGenerator::WriteTargetDependRules() *this->InfoFileStream << "\n" << "# Targets to which this target links.\n" - << "SET(CMAKE_TARGET_LINKED_INFO_FILES\n"; + << "set(CMAKE_TARGET_LINKED_INFO_FILES\n"; std::set<cmTarget const*> emitted; const char* cfg = this->LocalGenerator->ConfigurationName.c_str(); if(cmComputeLinkInformation* cli = this->Target->GetLinkInformation(cfg)) @@ -1018,7 +1026,7 @@ void cmMakefileTargetGenerator::WriteTargetDependRules() *this->InfoFileStream << "\n" << "# Fortran module output directory.\n" - << "SET(CMAKE_Fortran_TARGET_MODULE_DIR \"" << mdir << "\")\n"; + << "set(CMAKE_Fortran_TARGET_MODULE_DIR \"" << mdir << "\")\n"; } // Target-specific include directories: @@ -1026,7 +1034,7 @@ void cmMakefileTargetGenerator::WriteTargetDependRules() << "\n" << "# The include file search paths:\n"; *this->InfoFileStream - << "SET(CMAKE_C_TARGET_INCLUDE_PATH\n"; + << "set(CMAKE_C_TARGET_INCLUDE_PATH\n"; std::vector<std::string> includes; const char *config = this->Makefile->GetDefinition("CMAKE_BUILD_TYPE"); @@ -1045,13 +1053,13 @@ void cmMakefileTargetGenerator::WriteTargetDependRules() *this->InfoFileStream << " )\n"; *this->InfoFileStream - << "SET(CMAKE_CXX_TARGET_INCLUDE_PATH " + << "set(CMAKE_CXX_TARGET_INCLUDE_PATH " << "${CMAKE_C_TARGET_INCLUDE_PATH})\n"; *this->InfoFileStream - << "SET(CMAKE_Fortran_TARGET_INCLUDE_PATH " + << "set(CMAKE_Fortran_TARGET_INCLUDE_PATH " << "${CMAKE_C_TARGET_INCLUDE_PATH})\n"; *this->InfoFileStream - << "SET(CMAKE_ASM_TARGET_INCLUDE_PATH " + << "set(CMAKE_ASM_TARGET_INCLUDE_PATH " << "${CMAKE_C_TARGET_INCLUDE_PATH})\n"; // and now write the rule to use it diff --git a/Source/cmMarkAsAdvancedCommand.h b/Source/cmMarkAsAdvancedCommand.h index 246eb8a..adfc553 100644 --- a/Source/cmMarkAsAdvancedCommand.h +++ b/Source/cmMarkAsAdvancedCommand.h @@ -56,7 +56,7 @@ public: virtual const char* GetFullDocumentation() const { return - " mark_as_advanced([CLEAR|FORCE] VAR VAR2 VAR...)\n" + " mark_as_advanced([CLEAR|FORCE] VAR [VAR2 ...])\n" "Mark the named cached variables as advanced. An advanced variable " "will not be displayed in any of the cmake GUIs unless the show " "advanced option is on. " diff --git a/Source/cmPolicies.cxx b/Source/cmPolicies.cxx index a823f05..f9197e0 100644 --- a/Source/cmPolicies.cxx +++ b/Source/cmPolicies.cxx @@ -27,11 +27,11 @@ public: cmPolicies::PolicyStatus status) { if (!idString || !shortDescription || ! longDescription) - { + { cmSystemTools::Error("Attempt to define a policy without " "all parameters being specified!"); return; - } + } this->ID = iD; this->IDString = idString; this->ShortDescription = shortDescription; @@ -61,29 +61,29 @@ public: unsigned int tweakV) { if (majorV < this->MajorVersionIntroduced) - { + { return true; - } + } if (majorV > this->MajorVersionIntroduced) - { + { return false; - } + } if (minorV < this->MinorVersionIntroduced) - { + { return true; - } + } if (minorV > this->MinorVersionIntroduced) - { + { return false; - } + } if (patchV < this->PatchVersionIntroduced) - { + { return true; - } + } if (patchV > this->PatchVersionIntroduced) - { + { return false; - } + } return (tweakV < this->TweakVersionIntroduced); } @@ -609,9 +609,9 @@ cmPolicies::~cmPolicies() std::map<cmPolicies::PolicyID,cmPolicy *>::iterator i = this->Policies.begin(); for (;i != this->Policies.end(); ++i) - { + { delete i->second; - } + } } void cmPolicies::DefinePolicy(cmPolicies::PolicyID iD, @@ -626,11 +626,11 @@ void cmPolicies::DefinePolicy(cmPolicies::PolicyID iD, { // a policy must be unique and can only be defined once if (this->Policies.find(iD) != this->Policies.end()) - { + { cmSystemTools::Error("Attempt to redefine a CMake policy for policy " "ID ", this->GetPolicyIDString(iD).c_str()); return; - } + } this->Policies[iD] = new cmPolicy(iD, idString, shortDescription, @@ -784,15 +784,15 @@ bool cmPolicies::GetPolicyDefault(cmMakefile* mf, std::string const& policy, bool cmPolicies::GetPolicyID(const char *id, cmPolicies::PolicyID &pid) { if (!id || strlen(id) < 1) - { + { return false; - } + } std::map<std::string,cmPolicies::PolicyID>::iterator pos = this->PolicyStringMap.find(id); if (pos == this->PolicyStringMap.end()) - { + { return false; - } + } pid = pos->second; return true; } @@ -802,9 +802,9 @@ std::string cmPolicies::GetPolicyIDString(cmPolicies::PolicyID pid) std::map<cmPolicies::PolicyID,cmPolicy *>::iterator pos = this->Policies.find(pid); if (pos == this->Policies.end()) - { + { return ""; - } + } return pos->second->IDString; } @@ -815,11 +815,11 @@ std::string cmPolicies::GetPolicyWarning(cmPolicies::PolicyID id) std::map<cmPolicies::PolicyID,cmPolicy *>::iterator pos = this->Policies.find(id); if (pos == this->Policies.end()) - { + { cmSystemTools::Error( "Request for warning text for undefined policy!"); return "Request for warning text for undefined policy!"; - } + } cmOStringStream msg; msg << @@ -839,11 +839,11 @@ std::string cmPolicies::GetRequiredPolicyError(cmPolicies::PolicyID id) std::map<cmPolicies::PolicyID,cmPolicy *>::iterator pos = this->Policies.find(id); if (pos == this->Policies.end()) - { + { cmSystemTools::Error( "Request for error text for undefined policy!"); return "Request for error text for undefined policy!"; - } + } cmOStringStream error; error << @@ -869,10 +869,10 @@ cmPolicies::GetPolicyStatus(cmPolicies::PolicyID id) std::map<cmPolicies::PolicyID,cmPolicy *>::iterator pos = this->Policies.find(id); if (pos == this->Policies.end()) - { + { // TODO is this right? return cmPolicies::WARN; - } + } return pos->second->Status; } @@ -883,7 +883,7 @@ void cmPolicies::GetDocumentation(std::vector<cmDocumentationEntry>& v) std::map<cmPolicies::PolicyID,cmPolicy *>::iterator i = this->Policies.begin(); for (;i != this->Policies.end(); ++i) - { + { cmOStringStream full; full << i->second->LongDescription; full << "\nThis policy was introduced in CMake version "; @@ -920,7 +920,7 @@ void cmPolicies::GetDocumentation(std::vector<cmDocumentationEntry>& v) i->second->ShortDescription.c_str(), full.str().c_str()); v.push_back(e); - } + } } //---------------------------------------------------------------------------- diff --git a/Source/cmQtAutomoc.cxx b/Source/cmQtAutomoc.cxx index 93e39ab..651e0ad 100644 --- a/Source/cmQtAutomoc.cxx +++ b/Source/cmQtAutomoc.cxx @@ -32,16 +32,28 @@ #include "cmQtAutomoc.h" -static bool containsQ_OBJECT(const std::string& text) +static bool requiresMocing(const std::string& text, std::string ¯oName) { // this simple check is much much faster than the regexp - if (strstr(text.c_str(), "Q_OBJECT") == NULL) + if (strstr(text.c_str(), "Q_OBJECT") == NULL + && strstr(text.c_str(), "Q_GADGET") == NULL) { return false; } cmsys::RegularExpression qObjectRegExp("[\n][ \t]*Q_OBJECT[^a-zA-Z0-9_]"); - return qObjectRegExp.find(text); + if (qObjectRegExp.find(text)) + { + macroName = "Q_OBJECT"; + return true; + } + cmsys::RegularExpression qGadgetRegExp("[\n][ \t]*Q_GADGET[^a-zA-Z0-9_]"); + if (qGadgetRegExp.find(text)) + { + macroName = "Q_GADGET"; + return true; + } + return false; } @@ -436,7 +448,7 @@ void cmQtAutomoc::SetupAutomocTarget(cmTarget* target) it = configDefines.begin(), end = configDefines.end(); it != end; ++it) { - infoFile << "SET(AM_MOC_COMPILE_DEFINITIONS_" << it->first << + infoFile << "set(AM_MOC_COMPILE_DEFINITIONS_" << it->first << " " << it->second << ")\n"; } } @@ -446,7 +458,7 @@ void cmQtAutomoc::SetupAutomocTarget(cmTarget* target) it = configIncludes.begin(), end = configIncludes.end(); it != end; ++it) { - infoFile << "SET(AM_MOC_INCLUDES_" << it->first << + infoFile << "set(AM_MOC_INCLUDES_" << it->first << " " << it->second << ")\n"; } } @@ -837,7 +849,8 @@ void cmQtAutomoc::ParseCppFile(const std::string& absFilename, cmsys::SystemTools::GetRealPath(absFilename.c_str())) + '/'; const std::string scannedFileBasename = cmsys::SystemTools:: GetFilenameWithoutLastExtension(absFilename); - const bool cppContainsQ_OBJECT = containsQ_OBJECT(contentsString); + std::string macroName; + const bool requiresMoc = requiresMocing(contentsString, macroName); bool dotMocIncluded = false; bool mocUnderscoreIncluded = false; std::string ownMocUnderscoreFile; @@ -908,7 +921,7 @@ void cmQtAutomoc::ParseCppFile(const std::string& absFilename, else { std::string fileToMoc = absFilename; - if ((basename != scannedFileBasename) || (cppContainsQ_OBJECT==false)) + if ((basename != scannedFileBasename) || (requiresMoc==false)) { std::string mocSubDir = extractSubDir(absPath, currentMoc); std::string headerToMoc = findMatchingHeader( @@ -917,12 +930,12 @@ void cmQtAutomoc::ParseCppFile(const std::string& absFilename, { // this is for KDE4 compatibility: fileToMoc = headerToMoc; - if ((cppContainsQ_OBJECT==false) &&(basename==scannedFileBasename)) + if ((requiresMoc==false) &&(basename==scannedFileBasename)) { std::cerr << "AUTOMOC: warning: " << absFilename << ": The file " "includes the moc file \"" << currentMoc << - "\", but does not contain a Q_OBJECT macro. " - "Running moc on " + "\", but does not contain a " << macroName + << " macro. Running moc on " << "\"" << headerToMoc << "\" ! Include \"moc_" << basename << ".cpp\" for a compatiblity with " "strict mode (see CMAKE_AUTOMOC_RELAXED_MODE).\n" @@ -965,13 +978,14 @@ void cmQtAutomoc::ParseCppFile(const std::string& absFilename, // If this is the case, the moc_foo.cpp should probably be generated from // foo.cpp instead of foo.h, because otherwise it won't build. // But warn, since this is not how it is supposed to be used. - if ((dotMocIncluded == false) && (cppContainsQ_OBJECT == true)) + if ((dotMocIncluded == false) && (requiresMoc == true)) { if (mocUnderscoreIncluded == true) { // this is for KDE4 compatibility: std::cerr << "AUTOMOC: warning: " << absFilename << ": The file " - << "contains a Q_OBJECT macro, but does not include " + << "contains a " << macroName << " macro, but does not " + "include " << "\"" << scannedFileBasename << ".moc\", but instead " "includes " << "\"" << ownMocUnderscoreFile << "\". Running moc on " @@ -986,7 +1000,8 @@ void cmQtAutomoc::ParseCppFile(const std::string& absFilename, { // otherwise always error out since it will not compile: std::cerr << "AUTOMOC: error: " << absFilename << ": The file " - << "contains a Q_OBJECT macro, but does not include " + << "contains a " << macroName << " macro, but does not " + "include " << "\"" << scannedFileBasename << ".moc\" !\n" << std::endl; ::exit(EXIT_FAILURE); @@ -1094,11 +1109,13 @@ void cmQtAutomoc::StrictParseCppFile(const std::string& absFilename, // If this is the case, the moc_foo.cpp should probably be generated from // foo.cpp instead of foo.h, because otherwise it won't build. // But warn, since this is not how it is supposed to be used. - if ((dotMocIncluded == false) && (containsQ_OBJECT(contentsString))) + std::string macroName; + if ((dotMocIncluded == false) && (requiresMocing(contentsString, + macroName))) { // otherwise always error out since it will not compile: std::cerr << "AUTOMOC: error: " << absFilename << ": The file " - << "contains a Q_OBJECT macro, but does not include " + << "contains a " << macroName << " macro, but does not include " << "\"" << scannedFileBasename << ".moc\" !\n" << std::endl; ::exit(EXIT_FAILURE); @@ -1165,7 +1182,8 @@ void cmQtAutomoc::ParseHeaders(const std::set<std::string>& absHeaders, const std::string currentMoc = "moc_" + basename + ".cpp"; const std::string contents = this->ReadAll(headerName); - if (containsQ_OBJECT(contents)) + std::string macroName; + if (requiresMocing(contents, macroName)) { //std::cout << "header contains Q_OBJECT macro"; notIncludedMocs[headerName] = currentMoc; diff --git a/Source/cmScriptGenerator.cxx b/Source/cmScriptGenerator.cxx index cabe98a..3b6a49b 100644 --- a/Source/cmScriptGenerator.cxx +++ b/Source/cmScriptGenerator.cxx @@ -185,9 +185,9 @@ void cmScriptGenerator::GenerateScriptActionsOnce(std::ostream& os, { // Generate a per-configuration block. std::string config_test = this->CreateConfigTest(this->Configurations); - os << indent << "IF(" << config_test << ")\n"; + os << indent << "if(" << config_test << ")\n"; this->GenerateScriptActions(os, indent.Next()); - os << indent << "ENDIF(" << config_test << ")\n"; + os << indent << "endif(" << config_test << ")\n"; } } @@ -219,7 +219,7 @@ void cmScriptGenerator::GenerateScriptActionsPerConfig(std::ostream& os, { // Generate a per-configuration block. std::string config_test = this->CreateConfigTest(config); - os << indent << (first? "IF(" : "ELSEIF(") << config_test << ")\n"; + os << indent << (first? "if(" : "elseif(") << config_test << ")\n"; this->GenerateScriptForConfig(os, config, indent.Next()); first = false; } @@ -228,10 +228,10 @@ void cmScriptGenerator::GenerateScriptActionsPerConfig(std::ostream& os, { if(this->NeedsScriptNoConfig()) { - os << indent << "ELSE()\n"; + os << indent << "else()\n"; this->GenerateScriptNoConfig(os, indent.Next()); } - os << indent << "ENDIF()\n"; + os << indent << "endif()\n"; } } } diff --git a/Source/cmSetTestsPropertiesCommand.h b/Source/cmSetTestsPropertiesCommand.h index 3a59218..f2f2611 100644 --- a/Source/cmSetTestsPropertiesCommand.h +++ b/Source/cmSetTestsPropertiesCommand.h @@ -51,7 +51,8 @@ public: " set_tests_properties(test1 [test2...] PROPERTIES prop1 value1 prop2" " value2)\n" "Set a property for the tests. If the property is not found, CMake " - "will report an error. The properties include:\n" + "will report an error. Generator expressions will be expanded the same " + "as supported by the test's add_test call. The properties include:\n" "WILL_FAIL: If set to true, this will invert the pass/fail flag of the" " test.\n" "PASS_REGULAR_EXPRESSION: If set, the test output will be checked " diff --git a/Source/cmTarget.cxx b/Source/cmTarget.cxx index ac655da..66f37b8 100644 --- a/Source/cmTarget.cxx +++ b/Source/cmTarget.cxx @@ -924,7 +924,10 @@ void cmTarget::DefineProperties(cmake *cm) "The first configuration in the list found to be provided by the " "imported target is selected. If this property is set and no matching " "configurations are available, then the imported target is considered " - "to be not found. This property is ignored for non-imported targets.", + "to be not found. This property is ignored for non-imported targets.\n" + "This property is initialized by the value of the variable " + "CMAKE_MAP_IMPORTED_CONFIG_<CONFIG> if it is set when a target is " + "created.", false /* TODO: make this chained */ ); cm->DefineProperty @@ -1649,6 +1652,7 @@ void cmTarget::SetMakefile(cmMakefile* mf) "LIBRARY_OUTPUT_DIRECTORY_", "RUNTIME_OUTPUT_DIRECTORY_", "PDB_OUTPUT_DIRECTORY_", + "MAP_IMPORTED_CONFIG_", 0}; for(std::vector<std::string>::iterator ci = configNames.begin(); ci != configNames.end(); ++ci) @@ -2657,6 +2661,11 @@ void cmTarget::FinalizeSystemIncludeDirectories() end = this->Internal->LinkInterfacePropertyEntries.end(); it != end; ++it) { + if (!cmGeneratorExpression::IsValidTargetName(it->Value) + && cmGeneratorExpression::Find(it->Value) == std::string::npos) + { + continue; + } { cmListFileBacktrace lfbt; cmGeneratorExpression ge(lfbt); @@ -3033,15 +3042,11 @@ void cmTarget::SetProperty(const char* prop, const char* value) if (strcmp(prop, "LINK_LIBRARIES") == 0) { this->Internal->LinkInterfacePropertyEntries.clear(); - if (cmGeneratorExpression::IsValidTargetName(value) - || cmGeneratorExpression::Find(value) != std::string::npos) - { - cmListFileBacktrace lfbt; - this->Makefile->GetBacktrace(lfbt); - cmValueWithOrigin entry(value, lfbt); - this->Internal->LinkInterfacePropertyEntries.push_back(entry); - } - // Fall through + cmListFileBacktrace lfbt; + this->Makefile->GetBacktrace(lfbt); + cmValueWithOrigin entry(value, lfbt); + this->Internal->LinkInterfacePropertyEntries.push_back(entry); + return; } this->Properties.SetProperty(prop, value, cmProperty::TARGET); this->MaybeInvalidatePropertyCache(prop); @@ -3099,15 +3104,11 @@ void cmTarget::AppendProperty(const char* prop, const char* value, } if (strcmp(prop, "LINK_LIBRARIES") == 0) { - if (cmGeneratorExpression::IsValidTargetName(value) - || cmGeneratorExpression::Find(value) != std::string::npos) - { - cmListFileBacktrace lfbt; - this->Makefile->GetBacktrace(lfbt); - cmValueWithOrigin entry(value, lfbt); - this->Internal->LinkInterfacePropertyEntries.push_back(entry); - } - // Fall through + cmListFileBacktrace lfbt; + this->Makefile->GetBacktrace(lfbt); + cmValueWithOrigin entry(value, lfbt); + this->Internal->LinkInterfacePropertyEntries.push_back(entry); + return; } this->Properties.AppendProperty(prop, value, cmProperty::TARGET, asString); this->MaybeInvalidatePropertyCache(prop); @@ -3387,6 +3388,11 @@ std::vector<std::string> cmTarget::GetIncludeDirectories(const char *config) end = this->Internal->LinkInterfacePropertyEntries.end(); it != end; ++it) { + if (!cmGeneratorExpression::IsValidTargetName(it->Value) + && cmGeneratorExpression::Find(it->Value) == std::string::npos) + { + continue; + } { cmGeneratorExpression ge(lfbt); cmsys::auto_ptr<cmCompiledGeneratorExpression> cge = @@ -3585,6 +3591,11 @@ void cmTarget::GetCompileOptions(std::vector<std::string> &result, end = this->Internal->LinkInterfacePropertyEntries.end(); it != end; ++it) { + if (!cmGeneratorExpression::IsValidTargetName(it->Value) + && cmGeneratorExpression::Find(it->Value) == std::string::npos) + { + continue; + } { cmGeneratorExpression ge(lfbt); cmsys::auto_ptr<cmCompiledGeneratorExpression> cge = @@ -3693,6 +3704,11 @@ void cmTarget::GetCompileDefinitions(std::vector<std::string> &list, end = this->Internal->LinkInterfacePropertyEntries.end(); it != end; ++it) { + if (!cmGeneratorExpression::IsValidTargetName(it->Value) + && cmGeneratorExpression::Find(it->Value) == std::string::npos) + { + continue; + } { cmGeneratorExpression ge(lfbt); cmsys::auto_ptr<cmCompiledGeneratorExpression> cge = @@ -4115,7 +4131,7 @@ const char *cmTarget::GetProperty(const char* prop, } else { - // Support "<CONFIG>_LOCATION" for compatiblity. + // Support "<CONFIG>_LOCATION" for compatibility. int len = static_cast<int>(strlen(prop)); if(len > 9 && strcmp(prop+len-9, "_LOCATION") == 0) { @@ -4181,6 +4197,22 @@ const char *cmTarget::GetProperty(const char* prop, } return output.c_str(); } + if(strcmp(prop,"LINK_LIBRARIES") == 0) + { + static std::string output; + output = ""; + std::string sep; + for (std::vector<cmValueWithOrigin>::const_iterator + it = this->Internal->LinkInterfacePropertyEntries.begin(), + end = this->Internal->LinkInterfacePropertyEntries.end(); + it != end; ++it) + { + output += sep; + output += it->Value; + sep = ";"; + } + return output.c_str(); + } if (strcmp(prop,"IMPORTED") == 0) { @@ -6823,7 +6855,7 @@ void checkPropertyConsistency(cmTarget *depender, cmTarget *dependee, pi != props.end(); ++pi) { if (depender->GetMakefile()->GetCMakeInstance() - ->GetIsPropertyDefined(pi->c_str(), + ->IsPropertyDefined(pi->c_str(), cmProperty::TARGET)) { cmOStringStream e; diff --git a/Source/cmTestGenerator.cxx b/Source/cmTestGenerator.cxx index 42f511e..d962fb2 100644 --- a/Source/cmTestGenerator.cxx +++ b/Source/cmTestGenerator.cxx @@ -39,29 +39,8 @@ cmTestGenerator void cmTestGenerator::GenerateScriptConfigs(std::ostream& os, Indent const& indent) { - // First create the tests. + // Create the tests. this->cmScriptGenerator::GenerateScriptConfigs(os, indent); - - // Now generate the test properties. - if(this->TestGenerated) - { - cmTest* test = this->Test; - cmMakefile* mf = test->GetMakefile(); - cmLocalGenerator* lg = mf->GetLocalGenerator(); - std::ostream& fout = os; - cmPropertyMap::const_iterator pit; - cmPropertyMap* mpit = &test->GetProperties(); - if ( mpit->size() ) - { - fout << "SET_TESTS_PROPERTIES(" << test->GetName() << " PROPERTIES "; - for ( pit = mpit->begin(); pit != mpit->end(); ++ pit ) - { - fout << " " << pit->first - << " " << lg->EscapeForCMake(pit->second.GetValue()); - } - fout << ")" << std::endl; - } - } } //---------------------------------------------------------------------------- @@ -94,7 +73,7 @@ void cmTestGenerator::GenerateScriptForConfig(std::ostream& os, cmGeneratorExpression ge(this->Test->GetBacktrace()); // Start the test command. - os << indent << "ADD_TEST(" << this->Test->GetName() << " "; + os << indent << "add_test(" << this->Test->GetName() << " "; // Get the test command line to be executed. std::vector<std::string> const& command = this->Test->GetCommand(); @@ -127,13 +106,29 @@ void cmTestGenerator::GenerateScriptForConfig(std::ostream& os, // Finish the test command. os << ")\n"; + + // Output properties for the test. + cmPropertyMap& pm = this->Test->GetProperties(); + if(!pm.empty()) + { + os << indent << "set_tests_properties(" << this->Test->GetName() + << " PROPERTIES "; + for(cmPropertyMap::const_iterator i = pm.begin(); + i != pm.end(); ++i) + { + os << " " << i->first + << " " << lg->EscapeForCMake( + ge.Parse(i->second.GetValue())->Evaluate(mf, config)); + } + os << ")" << std::endl; + } } //---------------------------------------------------------------------------- void cmTestGenerator::GenerateScriptNoConfig(std::ostream& os, Indent const& indent) { - os << indent << "ADD_TEST(" << this->Test->GetName() << " NOT_AVAILABLE)\n"; + os << indent << "add_test(" << this->Test->GetName() << " NOT_AVAILABLE)\n"; } //---------------------------------------------------------------------------- @@ -157,7 +152,7 @@ void cmTestGenerator::GenerateOldStyle(std::ostream& fout, std::string exe = command[0]; cmSystemTools::ConvertToUnixSlashes(exe); fout << indent; - fout << "ADD_TEST("; + fout << "add_test("; fout << this->Test->GetName() << " \"" << exe << "\""; for(std::vector<std::string>::const_iterator argit = command.begin()+1; @@ -181,4 +176,21 @@ void cmTestGenerator::GenerateOldStyle(std::ostream& fout, fout << "\""; } fout << ")" << std::endl; + + // Output properties for the test. + cmMakefile* mf = this->Test->GetMakefile(); + cmLocalGenerator* lg = mf->GetLocalGenerator(); + cmPropertyMap& pm = this->Test->GetProperties(); + if(!pm.empty()) + { + fout << indent << "set_tests_properties(" << this->Test->GetName() + << " PROPERTIES "; + for(cmPropertyMap::const_iterator i = pm.begin(); + i != pm.end(); ++i) + { + fout << " " << i->first + << " " << lg->EscapeForCMake(i->second.GetValue()); + } + fout << ")" << std::endl; + } } diff --git a/Source/cmTryRunCommand.cxx b/Source/cmTryRunCommand.cxx index 4fc0b13..879d4fd 100644 --- a/Source/cmTryRunCommand.cxx +++ b/Source/cmTryRunCommand.cxx @@ -353,13 +353,13 @@ void cmTryRunCommand::DoNotRunExecutable(const std::string& runArgs, cmsys::SystemTools::ReplaceString(comment, "\n", "\n# "); file << comment << "\n\n"; - file << "SET( " << this->RunResultVariable << " \n \"" + file << "set( " << this->RunResultVariable << " \n \"" << this->Makefile->GetDefinition(this->RunResultVariable.c_str()) << "\"\n CACHE STRING \"Result from TRY_RUN\" FORCE)\n\n"; if (out!=0) { - file << "SET( " << internalRunOutputName << " \n \"" + file << "set( " << internalRunOutputName << " \n \"" << this->Makefile->GetDefinition(internalRunOutputName.c_str()) << "\"\n CACHE STRING \"Output from TRY_RUN\" FORCE)\n\n"; } diff --git a/Source/cmake.cxx b/Source/cmake.cxx index 290aff0..267ce35 100644 --- a/Source/cmake.cxx +++ b/Source/cmake.cxx @@ -2437,11 +2437,6 @@ int cmake::ActualConfigure() { this->CacheManager->SaveCache(this->GetHomeOutputDirectory()); } - if ( !this->GraphVizFile.empty() ) - { - std::cout << "Generate graphviz: " << this->GraphVizFile << std::endl; - this->GenerateGraphViz(this->GraphVizFile.c_str()); - } if(cmSystemTools::GetErrorOccuredFlag()) { return -1; @@ -2604,6 +2599,11 @@ int cmake::Generate() return -1; } this->GlobalGenerator->Generate(); + if ( !this->GraphVizFile.empty() ) + { + std::cout << "Generate graphviz: " << this->GraphVizFile << std::endl; + this->GenerateGraphViz(this->GraphVizFile.c_str()); + } if(this->WarnUnusedCli) { this->RunCheckForUnusedVariables(); @@ -3640,13 +3640,6 @@ void cmake::DefineProperty(const char *name, cmProperty::ScopeType scope, chained); } -bool cmake::GetIsPropertyDefined(const char *name, - cmProperty::ScopeType scope) -{ - return this->PropertyDefinitions[scope].find(name) != - this->PropertyDefinitions[scope].end(); -} - cmPropertyDefinition *cmake ::GetPropertyDefinition(const char *name, cmProperty::ScopeType scope) diff --git a/Source/cmake.h b/Source/cmake.h index a50c1ed..a3872d7 100644 --- a/Source/cmake.h +++ b/Source/cmake.h @@ -349,8 +349,6 @@ class cmake bool chain = false, const char *variableGroup = 0); - bool GetIsPropertyDefined(const char *name, cmProperty::ScopeType scope); - // get property definition cmPropertyDefinition *GetPropertyDefinition (const char *name, cmProperty::ScopeType scope); |