diff options
author | Morné Chamberlain <thefreeman.za@gmail.com> | 2012-11-24 18:23:55 (GMT) |
---|---|---|
committer | Morné Chamberlain <thefreeman.za@gmail.com> | 2012-11-24 18:23:55 (GMT) |
commit | b3ae61f8338fd3b2308de0173c34a329ba46d191 (patch) | |
tree | 72c3a159ba5f430a920ebe04057e383f8b155ec1 /Source | |
parent | 089d9ccdce530ebd08dfc4681833cefeff4a7eb9 (diff) | |
parent | 79357448ceac5a8657c5be25bd3f02cd3345b934 (diff) | |
download | CMake-b3ae61f8338fd3b2308de0173c34a329ba46d191.zip CMake-b3ae61f8338fd3b2308de0173c34a329ba46d191.tar.gz CMake-b3ae61f8338fd3b2308de0173c34a329ba46d191.tar.bz2 |
Merge branch 'master' into sublime-text-2-generator
Diffstat (limited to 'Source')
87 files changed, 889 insertions, 982 deletions
diff --git a/Source/CMakeLists.txt b/Source/CMakeLists.txt index 8e842a9..66f7c42 100644 --- a/Source/CMakeLists.txt +++ b/Source/CMakeLists.txt @@ -203,6 +203,7 @@ set(SRCS cmGeneratorTarget.h cmGlobalGenerator.cxx cmGlobalGenerator.h + cmGlobalGeneratorFactory.h cmGlobalUnixMakefileGenerator3.cxx cmGlobalUnixMakefileGenerator3.h cmGraphAdjacencyList.h @@ -332,12 +333,6 @@ if (WIN32) cmGlobalVisualStudio8Generator.h cmGlobalVisualStudio9Generator.cxx cmGlobalVisualStudio9Generator.h - cmGlobalVisualStudio8Win64Generator.cxx - cmGlobalVisualStudio8Win64Generator.h - cmGlobalVisualStudio9Win64Generator.cxx - cmGlobalVisualStudio9Win64Generator.h - cmGlobalVisualStudio9IA64Generator.cxx - cmGlobalVisualStudio9IA64Generator.h cmVisualStudioGeneratorOptions.h cmVisualStudioGeneratorOptions.cxx cmVisualStudio10TargetGenerator.h @@ -346,16 +341,8 @@ if (WIN32) cmLocalVisualStudio10Generator.h cmGlobalVisualStudio10Generator.h cmGlobalVisualStudio10Generator.cxx - cmGlobalVisualStudio10Win64Generator.h - cmGlobalVisualStudio10Win64Generator.cxx - cmGlobalVisualStudio10IA64Generator.h - cmGlobalVisualStudio10IA64Generator.cxx cmGlobalVisualStudio11Generator.h cmGlobalVisualStudio11Generator.cxx - cmGlobalVisualStudio11Win64Generator.h - cmGlobalVisualStudio11Win64Generator.cxx - cmGlobalVisualStudio11ARMGenerator.h - cmGlobalVisualStudio11ARMGenerator.cxx cmGlobalVisualStudioGenerator.cxx cmGlobalVisualStudioGenerator.h cmGlobalWatcomWMakeGenerator.cxx diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake index 9009d44..60514b7 100644 --- a/Source/CMakeVersion.cmake +++ b/Source/CMakeVersion.cmake @@ -2,5 +2,5 @@ set(CMake_VERSION_MAJOR 2) set(CMake_VERSION_MINOR 8) set(CMake_VERSION_PATCH 10) -set(CMake_VERSION_TWEAK 20121111) +set(CMake_VERSION_TWEAK 20121124) #set(CMake_VERSION_RC 1) diff --git a/Source/CPack/cmCPackGenerator.cxx b/Source/CPack/cmCPackGenerator.cxx index e964696..6317fa0 100644 --- a/Source/CPack/cmCPackGenerator.cxx +++ b/Source/CPack/cmCPackGenerator.cxx @@ -97,7 +97,6 @@ int cmCPackGenerator::PrepareNames() } tempDirectory += this->GetOption("CPACK_GENERATOR"); std::string topDirectory = tempDirectory; - this->GetOption("CPACK_PACKAGE_FILE_NAME"); const char* pfname = this->GetOption("CPACK_PACKAGE_FILE_NAME"); if(!pfname) { @@ -208,7 +207,7 @@ int cmCPackGenerator::InstallProject() { cmCPackLogger(cmCPackLog::LOG_ERROR, "Problem creating temporary directory: " - << (tempInstallDirectory ? tempInstallDirectory : "(NULL}") + << (tempInstallDirectory ? tempInstallDirectory : "(NULL)") << std::endl); return 0; } diff --git a/Source/CursesDialog/cmCursesStringWidget.cxx b/Source/CursesDialog/cmCursesStringWidget.cxx index 5c7414f..bd1ff71 100644 --- a/Source/CursesDialog/cmCursesStringWidget.cxx +++ b/Source/CursesDialog/cmCursesStringWidget.cxx @@ -175,7 +175,7 @@ bool cmCursesStringWidget::HandleInput(int& key, cmCursesMainForm* fm, } else if ( key == ctrl('d') ||key == KEY_DC ) { - if ( form->curcol > 0 ) + if ( form->curcol >= 0 ) { form_driver(form, REQ_DEL_CHAR); } diff --git a/Source/cmComputeLinkInformation.cxx b/Source/cmComputeLinkInformation.cxx index cd3ef59..d8ffb5e 100644 --- a/Source/cmComputeLinkInformation.cxx +++ b/Source/cmComputeLinkInformation.cxx @@ -277,6 +277,10 @@ cmComputeLinkInformation this->UseImportLibrary = this->Makefile->GetDefinition("CMAKE_IMPORT_LIBRARY_SUFFIX")?true:false; + // Check whether we should skip dependencies on shared library files. + this->LinkDependsNoShared = + this->Target->GetPropertyAsBool("LINK_DEPENDS_NO_SHARED"); + // On platforms without import libraries there may be a special flag // to use when creating a plugin (module) that obtains symbols from // the program that will load it. @@ -650,7 +654,11 @@ void cmComputeLinkInformation::AddItem(std::string const& item, cmTarget* tgt) // Pass the full path to the target file. std::string lib = tgt->GetFullPath(config, implib, true); - this->Depends.push_back(lib); + if(!this->LinkDependsNoShared || + tgt->GetType() != cmTarget::SHARED_LIBRARY) + { + this->Depends.push_back(lib); + } this->AddTargetItem(lib, tgt); this->AddLibraryRuntimeInfo(lib, tgt); diff --git a/Source/cmComputeLinkInformation.h b/Source/cmComputeLinkInformation.h index f60f8d3..e0078af 100644 --- a/Source/cmComputeLinkInformation.h +++ b/Source/cmComputeLinkInformation.h @@ -82,6 +82,7 @@ private: // Configuration information. const char* Config; const char* LinkLanguage; + bool LinkDependsNoShared; // Modes for dealing with dependent shared libraries. enum SharedDepMode diff --git a/Source/cmConfigureFileCommand.h b/Source/cmConfigureFileCommand.h index 347174a..0393ecf 100644 --- a/Source/cmConfigureFileCommand.h +++ b/Source/cmConfigureFileCommand.h @@ -68,6 +68,9 @@ public: "If <output> names an existing directory the input file is placed " "in that directory with its original name. " "\n" + "If the <input> file is modified the build system will re-run CMake " + "to re-configure the file and generate the build system again." + "\n" "This command replaces any variables in the input file referenced as " "${VAR} or @VAR@ with their values as determined by CMake. If a " "variable is not defined, it will be replaced with nothing. " @@ -76,13 +79,18 @@ public: "will be C-style escaped. " "The file will be configured with the current values of CMake " "variables. If @ONLY is specified, only variables " - "of the form @VAR@ will be replaces and ${VAR} will be ignored. " - "This is useful for configuring scripts that use ${VAR}. " - "Any occurrences of #cmakedefine VAR will be replaced with " - "either #define VAR or /* #undef VAR */ depending on " - "the setting of VAR in CMake. Any occurrences of #cmakedefine01 VAR " - "will be replaced with either #define VAR 1 or #define VAR 0 " - "depending on whether VAR evaluates to TRUE or FALSE in CMake.\n" + "of the form @VAR@ will be replaced and ${VAR} will be ignored. " + "This is useful for configuring scripts that use ${VAR}." + "\n" + "Input file lines of the form \"#cmakedefine VAR ...\" " + "will be replaced with either \"#define VAR ...\" or " + "\"/* #undef VAR */\" depending on whether VAR is set in CMake to " + "any value not considered a false constant by the if() command. " + "(Content of \"...\", if any, is processed as above.) " + "Input file lines of the form \"#cmakedefine01 VAR\" " + "will be replaced with either \"#define VAR 1\" or " + "\"#define VAR 0\" similarly." + "\n" "With NEWLINE_STYLE the line ending could be adjusted: \n" " 'UNIX' or 'LF' for \\n, 'DOS', 'WIN32' or 'CRLF' for \\r\\n.\n" "COPYONLY must not be used with NEWLINE_STYLE.\n"; diff --git a/Source/cmDocumentVariables.cxx b/Source/cmDocumentVariables.cxx index 6232162..d855bd2 100644 --- a/Source/cmDocumentVariables.cxx +++ b/Source/cmDocumentVariables.cxx @@ -1231,6 +1231,15 @@ void cmDocumentVariables::DefineVariables(cmake* cm) "Variables that Control the Build"); cm->DefineProperty + ("CMAKE_LINK_DEPENDS_NO_SHARED", cmProperty::VARIABLE, + "Whether to skip link dependencies on shared library files.", + "This variable initializes the LINK_DEPENDS_NO_SHARED " + "property on targets when they are created. " + "See that target property for additional information.", + false, + "Variables that Control the Build"); + + cm->DefineProperty ("CMAKE_AUTOMOC", cmProperty::VARIABLE, "Whether to handle moc automatically for Qt targets.", "This variable is used to initialize the " diff --git a/Source/cmFileCommand.h b/Source/cmFileCommand.h index b4aa903..a0862ec 100644 --- a/Source/cmFileCommand.h +++ b/Source/cmFileCommand.h @@ -89,7 +89,8 @@ public: " [TIMEOUT timeout] [STATUS status] [LOG log] [SHOW_PROGRESS])\n" "WRITE will write a message into a file called 'filename'. It " "overwrites the file if it already exists, and creates the file " - "if it does not exist.\n" + "if it does not exist. (If the file is a build input, use " + "configure_file to update the file only when its content changes.)\n" "APPEND will write a message into a file same as WRITE, except " "it will append it to the end of the file\n" "READ will read the content of a file and store it into the " diff --git a/Source/cmFunctionCommand.h b/Source/cmFunctionCommand.h index 730a7a7..0a029dc 100644 --- a/Source/cmFunctionCommand.h +++ b/Source/cmFunctionCommand.h @@ -90,7 +90,9 @@ public: "will have the actual values of the arguments passed in. This " "facilitates creating functions with optional arguments. Additionally " "ARGV holds the list of all arguments given to the function and ARGN " - "holds the list of argument past the last expected argument." + "holds the list of arguments past the last expected argument." + "\n" + "A function opens a new scope: see set(var PARENT_SCOPE) for details." "\n" "See the cmake_policy() command documentation for the behavior of " "policies inside functions." diff --git a/Source/cmGlobalBorlandMakefileGenerator.cxx b/Source/cmGlobalBorlandMakefileGenerator.cxx index 8c6787a..2a7d61d 100644 --- a/Source/cmGlobalBorlandMakefileGenerator.cxx +++ b/Source/cmGlobalBorlandMakefileGenerator.cxx @@ -55,9 +55,9 @@ cmLocalGenerator *cmGlobalBorlandMakefileGenerator::CreateLocalGenerator() //---------------------------------------------------------------------------- void cmGlobalBorlandMakefileGenerator -::GetDocumentation(cmDocumentationEntry& entry) const +::GetDocumentation(cmDocumentationEntry& entry) { - entry.Name = this->GetName(); + entry.Name = cmGlobalBorlandMakefileGenerator::GetActualName(); entry.Brief = "Generates Borland makefiles."; entry.Full = ""; } diff --git a/Source/cmGlobalBorlandMakefileGenerator.h b/Source/cmGlobalBorlandMakefileGenerator.h index c0cb8a6..bd3db3e 100644 --- a/Source/cmGlobalBorlandMakefileGenerator.h +++ b/Source/cmGlobalBorlandMakefileGenerator.h @@ -23,8 +23,9 @@ class cmGlobalBorlandMakefileGenerator : public cmGlobalNMakeMakefileGenerator { public: cmGlobalBorlandMakefileGenerator(); - static cmGlobalGenerator* New() - { return new cmGlobalBorlandMakefileGenerator; } + static cmGlobalGeneratorFactory* NewFactory() { + return new cmGlobalGeneratorSimpleFactory + <cmGlobalBorlandMakefileGenerator>(); } ///! Get the name for the generator. virtual const char* GetName() const { @@ -32,7 +33,7 @@ public: static const char* GetActualName() {return "Borland Makefiles";} /** Get the documentation entry for this generator. */ - virtual void GetDocumentation(cmDocumentationEntry& entry) const; + static void GetDocumentation(cmDocumentationEntry& entry); ///! Create a local generator appropriate to this Global Generator virtual cmLocalGenerator *CreateLocalGenerator(); diff --git a/Source/cmGlobalGenerator.cxx b/Source/cmGlobalGenerator.cxx index b9de4d8..154e629 100644 --- a/Source/cmGlobalGenerator.cxx +++ b/Source/cmGlobalGenerator.cxx @@ -828,6 +828,7 @@ void cmGlobalGenerator::Configure() this->LocalGenerators.clear(); this->TargetDependencies.clear(); this->TotalTargets.clear(); + this->ImportedTargets.clear(); this->LocalGeneratorToTargetMap.clear(); this->ProjectMap.clear(); this->RuleHashes.clear(); @@ -1555,14 +1556,6 @@ void cmGlobalGenerator::SetConfiguredFilesPath(cmGlobalGenerator* gen) } } -//---------------------------------------------------------------------------- -void cmGlobalGenerator::GetDocumentation(cmDocumentationEntry& entry) const -{ - entry.Name = this->GetName(); - entry.Brief = ""; - entry.Full = ""; -} - bool cmGlobalGenerator::IsExcluded(cmLocalGenerator* root, cmLocalGenerator* gen) { diff --git a/Source/cmGlobalGenerator.h b/Source/cmGlobalGenerator.h index 0aab2d6..bb805d9 100644 --- a/Source/cmGlobalGenerator.h +++ b/Source/cmGlobalGenerator.h @@ -49,9 +49,6 @@ public: ///! Get the name for this generator virtual const char *GetName() const { return "Generic"; }; - /** Get the documentation entry for this generator. */ - virtual void GetDocumentation(cmDocumentationEntry& entry) const; - /** * Create LocalGenerators and process the CMakeLists files. This does not * actually produce any makefiles, DSPs, etc. diff --git a/Source/cmGlobalGeneratorFactory.h b/Source/cmGlobalGeneratorFactory.h new file mode 100644 index 0000000..fd1d65f --- /dev/null +++ b/Source/cmGlobalGeneratorFactory.h @@ -0,0 +1,59 @@ +/*============================================================================ + CMake - Cross Platform Makefile Generator + Copyright 2000-2012 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 cmGlobalGeneratorFactory_h +#define cmGlobalGeneratorFactory_h + +#include "cmStandardIncludes.h" + +class cmGlobalGenerator; +struct cmDocumentationEntry; + +/** \class cmGlobalGeneratorFactory + * \brief Responable for creating cmGlobalGenerator instances + * + * Subclasses of this class generate instances of cmGlobalGenerator. + */ +class cmGlobalGeneratorFactory +{ +public: + virtual ~cmGlobalGeneratorFactory() {} + + /** Create a GlobalGenerator */ + virtual cmGlobalGenerator* CreateGlobalGenerator(const char* n) const = 0; + + /** Get the documentation entry for this factory */ + virtual void GetDocumentation(cmDocumentationEntry& entry) const = 0; + + /** Get the names of the current registered generators */ + virtual void GetGenerators(std::vector<std::string>& names) const = 0; +}; + +template<class T> +class cmGlobalGeneratorSimpleFactory : public cmGlobalGeneratorFactory +{ +public: + /** Create a GlobalGenerator */ + virtual cmGlobalGenerator* CreateGlobalGenerator(const char* name) const { + if (strcmp(name, T::GetActualName())) return 0; + return new T; } + + /** Get the documentation entry for this factory */ + virtual void GetDocumentation(cmDocumentationEntry& entry) const { + T::GetDocumentation(entry); } + + /** Get the names of the current registered generators */ + virtual void GetGenerators(std::vector<std::string>& names) const { + names.push_back(T::GetActualName()); } +}; + +#endif diff --git a/Source/cmGlobalJOMMakefileGenerator.cxx b/Source/cmGlobalJOMMakefileGenerator.cxx index ef42bd4..4af0607 100644 --- a/Source/cmGlobalJOMMakefileGenerator.cxx +++ b/Source/cmGlobalJOMMakefileGenerator.cxx @@ -61,9 +61,9 @@ cmLocalGenerator *cmGlobalJOMMakefileGenerator::CreateLocalGenerator() //---------------------------------------------------------------------------- void cmGlobalJOMMakefileGenerator -::GetDocumentation(cmDocumentationEntry& entry) const +::GetDocumentation(cmDocumentationEntry& entry) { - entry.Name = this->GetName(); + entry.Name = cmGlobalJOMMakefileGenerator::GetActualName(); entry.Brief = "Generates JOM makefiles."; entry.Full = ""; } diff --git a/Source/cmGlobalJOMMakefileGenerator.h b/Source/cmGlobalJOMMakefileGenerator.h index 691ebdb..28893bf 100644 --- a/Source/cmGlobalJOMMakefileGenerator.h +++ b/Source/cmGlobalJOMMakefileGenerator.h @@ -23,8 +23,9 @@ class cmGlobalJOMMakefileGenerator : public cmGlobalUnixMakefileGenerator3 { public: cmGlobalJOMMakefileGenerator(); - static cmGlobalGenerator* New() { - return new cmGlobalJOMMakefileGenerator; } + static cmGlobalGeneratorFactory* NewFactory() { + return new cmGlobalGeneratorSimpleFactory + <cmGlobalJOMMakefileGenerator>(); } ///! Get the name for the generator. virtual const char* GetName() const { return cmGlobalJOMMakefileGenerator::GetActualName();} @@ -33,7 +34,7 @@ public: static const char* GetActualName() {return "NMake Makefiles JOM";} /** Get the documentation entry for this generator. */ - virtual void GetDocumentation(cmDocumentationEntry& entry) const; + static void GetDocumentation(cmDocumentationEntry& entry); ///! Create a local generator appropriate to this Global Generator virtual cmLocalGenerator *CreateLocalGenerator(); diff --git a/Source/cmGlobalMSYSMakefileGenerator.cxx b/Source/cmGlobalMSYSMakefileGenerator.cxx index 80526aa..d49639b 100644 --- a/Source/cmGlobalMSYSMakefileGenerator.cxx +++ b/Source/cmGlobalMSYSMakefileGenerator.cxx @@ -106,9 +106,9 @@ cmLocalGenerator *cmGlobalMSYSMakefileGenerator::CreateLocalGenerator() //---------------------------------------------------------------------------- void cmGlobalMSYSMakefileGenerator -::GetDocumentation(cmDocumentationEntry& entry) const +::GetDocumentation(cmDocumentationEntry& entry) { - entry.Name = this->GetName(); + entry.Name = cmGlobalMSYSMakefileGenerator::GetActualName(); entry.Brief = "Generates MSYS makefiles."; entry.Full = "The makefiles use /bin/sh as the shell. " "They require msys to be installed on the machine."; diff --git a/Source/cmGlobalMSYSMakefileGenerator.h b/Source/cmGlobalMSYSMakefileGenerator.h index b76a5bf..659de11 100644 --- a/Source/cmGlobalMSYSMakefileGenerator.h +++ b/Source/cmGlobalMSYSMakefileGenerator.h @@ -23,8 +23,9 @@ class cmGlobalMSYSMakefileGenerator : public cmGlobalUnixMakefileGenerator3 { public: cmGlobalMSYSMakefileGenerator(); - static cmGlobalGenerator* New() { - return new cmGlobalMSYSMakefileGenerator; } + static cmGlobalGeneratorFactory* NewFactory() { + return new cmGlobalGeneratorSimpleFactory + <cmGlobalMSYSMakefileGenerator>(); } ///! Get the name for the generator. virtual const char* GetName() const { @@ -32,7 +33,7 @@ public: static const char* GetActualName() {return "MSYS Makefiles";} /** Get the documentation entry for this generator. */ - virtual void GetDocumentation(cmDocumentationEntry& entry) const; + static void GetDocumentation(cmDocumentationEntry& entry); ///! Create a local generator appropriate to this Global Generator virtual cmLocalGenerator *CreateLocalGenerator(); diff --git a/Source/cmGlobalMinGWMakefileGenerator.cxx b/Source/cmGlobalMinGWMakefileGenerator.cxx index d6045c8..e202b02 100644 --- a/Source/cmGlobalMinGWMakefileGenerator.cxx +++ b/Source/cmGlobalMinGWMakefileGenerator.cxx @@ -71,9 +71,9 @@ cmLocalGenerator *cmGlobalMinGWMakefileGenerator::CreateLocalGenerator() //---------------------------------------------------------------------------- void cmGlobalMinGWMakefileGenerator -::GetDocumentation(cmDocumentationEntry& entry) const +::GetDocumentation(cmDocumentationEntry& entry) { - entry.Name = this->GetName(); + entry.Name = cmGlobalMinGWMakefileGenerator::GetActualName(); entry.Brief = "Generates a make file for use with mingw32-make."; entry.Full = "The makefiles generated use cmd.exe as the shell. " "They do not require msys or a unix shell."; diff --git a/Source/cmGlobalMinGWMakefileGenerator.h b/Source/cmGlobalMinGWMakefileGenerator.h index 9a6a513..7951e98 100644 --- a/Source/cmGlobalMinGWMakefileGenerator.h +++ b/Source/cmGlobalMinGWMakefileGenerator.h @@ -23,15 +23,16 @@ class cmGlobalMinGWMakefileGenerator : public cmGlobalUnixMakefileGenerator3 { public: cmGlobalMinGWMakefileGenerator(); - static cmGlobalGenerator* New() { - return new cmGlobalMinGWMakefileGenerator; } + static cmGlobalGeneratorFactory* NewFactory() { + return new cmGlobalGeneratorSimpleFactory + <cmGlobalMinGWMakefileGenerator>(); } ///! Get the name for the generator. virtual const char* GetName() const { return cmGlobalMinGWMakefileGenerator::GetActualName();} static const char* GetActualName() {return "MinGW Makefiles";} /** Get the documentation entry for this generator. */ - virtual void GetDocumentation(cmDocumentationEntry& entry) const; + static void GetDocumentation(cmDocumentationEntry& entry); ///! Create a local generator appropriate to this Global Generator virtual cmLocalGenerator *CreateLocalGenerator(); diff --git a/Source/cmGlobalNMakeMakefileGenerator.cxx b/Source/cmGlobalNMakeMakefileGenerator.cxx index 57a26c8..7af4ee3 100644 --- a/Source/cmGlobalNMakeMakefileGenerator.cxx +++ b/Source/cmGlobalNMakeMakefileGenerator.cxx @@ -61,9 +61,9 @@ cmLocalGenerator *cmGlobalNMakeMakefileGenerator::CreateLocalGenerator() //---------------------------------------------------------------------------- void cmGlobalNMakeMakefileGenerator -::GetDocumentation(cmDocumentationEntry& entry) const +::GetDocumentation(cmDocumentationEntry& entry) { - entry.Name = this->GetName(); + entry.Name = cmGlobalNMakeMakefileGenerator::GetActualName(); entry.Brief = "Generates NMake makefiles."; entry.Full = ""; } diff --git a/Source/cmGlobalNMakeMakefileGenerator.h b/Source/cmGlobalNMakeMakefileGenerator.h index de33b8f..5756fbd 100644 --- a/Source/cmGlobalNMakeMakefileGenerator.h +++ b/Source/cmGlobalNMakeMakefileGenerator.h @@ -23,15 +23,16 @@ class cmGlobalNMakeMakefileGenerator : public cmGlobalUnixMakefileGenerator3 { public: cmGlobalNMakeMakefileGenerator(); - static cmGlobalGenerator* New() { - return new cmGlobalNMakeMakefileGenerator; } + static cmGlobalGeneratorFactory* NewFactory() { + return new cmGlobalGeneratorSimpleFactory + <cmGlobalNMakeMakefileGenerator>(); } ///! Get the name for the generator. virtual const char* GetName() const { return cmGlobalNMakeMakefileGenerator::GetActualName();} static const char* GetActualName() {return "NMake Makefiles";} /** Get the documentation entry for this generator. */ - virtual void GetDocumentation(cmDocumentationEntry& entry) const; + static void GetDocumentation(cmDocumentationEntry& entry); ///! Create a local generator appropriate to this Global Generator virtual cmLocalGenerator *CreateLocalGenerator(); diff --git a/Source/cmGlobalNinjaGenerator.cxx b/Source/cmGlobalNinjaGenerator.cxx index 05f5b4c..60f5a47 100644 --- a/Source/cmGlobalNinjaGenerator.cxx +++ b/Source/cmGlobalNinjaGenerator.cxx @@ -452,9 +452,9 @@ cmLocalGenerator* cmGlobalNinjaGenerator::CreateLocalGenerator() } void cmGlobalNinjaGenerator -::GetDocumentation(cmDocumentationEntry& entry) const +::GetDocumentation(cmDocumentationEntry& entry) { - entry.Name = this->GetName(); + entry.Name = cmGlobalNinjaGenerator::GetActualName(); entry.Brief = "Generates build.ninja files (experimental)."; entry.Full = "A build.ninja file is generated into the build tree. Recent " diff --git a/Source/cmGlobalNinjaGenerator.h b/Source/cmGlobalNinjaGenerator.h index 24c3916..c3df7d9 100644 --- a/Source/cmGlobalNinjaGenerator.h +++ b/Source/cmGlobalNinjaGenerator.h @@ -14,6 +14,7 @@ # define cmGlobalNinjaGenerator_h # include "cmGlobalGenerator.h" +# include "cmGlobalGeneratorFactory.h" # include "cmNinjaTypes.h" //#define NINJA_GEN_VERBOSE_FILES @@ -160,8 +161,8 @@ public: cmGlobalNinjaGenerator(); /// Convenience method for creating an instance of this class. - static cmGlobalGenerator* New() { - return new cmGlobalNinjaGenerator; } + static cmGlobalGeneratorFactory* NewFactory() { + return new cmGlobalGeneratorSimpleFactory<cmGlobalNinjaGenerator>(); } /// Destructor. virtual ~cmGlobalNinjaGenerator() { } @@ -177,7 +178,7 @@ public: static const char* GetActualName() { return "Ninja"; } /// Overloaded methods. @see cmGlobalGenerator::GetDocumentation() - virtual void GetDocumentation(cmDocumentationEntry& entry) const; + static void GetDocumentation(cmDocumentationEntry& entry); /// Overloaded methods. @see cmGlobalGenerator::Generate() virtual void Generate(); diff --git a/Source/cmGlobalUnixMakefileGenerator3.cxx b/Source/cmGlobalUnixMakefileGenerator3.cxx index ebd8219..e26cca9 100644 --- a/Source/cmGlobalUnixMakefileGenerator3.cxx +++ b/Source/cmGlobalUnixMakefileGenerator3.cxx @@ -61,9 +61,9 @@ cmLocalGenerator *cmGlobalUnixMakefileGenerator3::CreateLocalGenerator() //---------------------------------------------------------------------------- void cmGlobalUnixMakefileGenerator3 -::GetDocumentation(cmDocumentationEntry& entry) const +::GetDocumentation(cmDocumentationEntry& entry) { - entry.Name = this->GetName(); + entry.Name = cmGlobalUnixMakefileGenerator3::GetActualName(); entry.Brief = "Generates standard UNIX makefiles."; entry.Full = "A hierarchy of UNIX makefiles is generated into the build tree. Any " diff --git a/Source/cmGlobalUnixMakefileGenerator3.h b/Source/cmGlobalUnixMakefileGenerator3.h index e6dd09d..385cdc4 100644 --- a/Source/cmGlobalUnixMakefileGenerator3.h +++ b/Source/cmGlobalUnixMakefileGenerator3.h @@ -13,6 +13,7 @@ #define cmGlobalUnixMakefileGenerator3_h #include "cmGlobalGenerator.h" +#include "cmGlobalGeneratorFactory.h" class cmGeneratedFileStream; class cmMakefileTargetGenerator; @@ -54,8 +55,9 @@ class cmGlobalUnixMakefileGenerator3 : public cmGlobalGenerator { public: cmGlobalUnixMakefileGenerator3(); - static cmGlobalGenerator* New() { - return new cmGlobalUnixMakefileGenerator3; } + static cmGlobalGeneratorFactory* NewFactory() { + return new cmGlobalGeneratorSimpleFactory + <cmGlobalUnixMakefileGenerator3>(); } ///! Get the name for the generator. virtual const char* GetName() const { @@ -63,7 +65,7 @@ public: static const char* GetActualName() {return "Unix Makefiles";} /** Get the documentation entry for this generator. */ - virtual void GetDocumentation(cmDocumentationEntry& entry) const; + static void GetDocumentation(cmDocumentationEntry& entry); ///! Create a local generator appropriate to this Global Generator3 virtual cmLocalGenerator *CreateLocalGenerator(); diff --git a/Source/cmGlobalVisualStudio10Generator.cxx b/Source/cmGlobalVisualStudio10Generator.cxx index 480c577..c218c97 100644 --- a/Source/cmGlobalVisualStudio10Generator.cxx +++ b/Source/cmGlobalVisualStudio10Generator.cxx @@ -16,8 +16,61 @@ #include "cmSourceFile.h" #include "cmake.h" +static const char vs10Win32generatorName[] = "Visual Studio 10"; +static const char vs10Win64generatorName[] = "Visual Studio 10 Win64"; +static const char vs10IA64generatorName[] = "Visual Studio 10 IA64"; -cmGlobalVisualStudio10Generator::cmGlobalVisualStudio10Generator() +class cmGlobalVisualStudio10Generator::Factory + : public cmGlobalGeneratorFactory +{ +public: + virtual cmGlobalGenerator* CreateGlobalGenerator(const char* name) const { + if(!strcmp(name, vs10Win32generatorName)) + { + return new cmGlobalVisualStudio10Generator( + vs10Win32generatorName, NULL, NULL); + } + if(!strcmp(name, vs10Win64generatorName)) + { + return new cmGlobalVisualStudio10Generator( + vs10Win64generatorName, "x64", "CMAKE_FORCE_WIN64"); + } + if(!strcmp(name, vs10IA64generatorName)) + { + return new cmGlobalVisualStudio10Generator( + vs10IA64generatorName, "Itanium", "CMAKE_FORCE_IA64"); + } + return 0; + } + + virtual void GetDocumentation(cmDocumentationEntry& entry) const { + entry.Name = "Visual Studio 10"; + entry.Brief = "Generates Visual Studio 10 project files."; + entry.Full = + "It is possible to append a space followed by the platform name " + "to create project files for a specific target platform. E.g. " + "\"Visual Studio 10 Win64\" will create project files for " + "the x64 processor; \"Visual Studio 10 IA64\" for Itanium."; + } + + virtual void GetGenerators(std::vector<std::string>& names) const { + names.push_back(vs10Win32generatorName); + names.push_back(vs10Win64generatorName); + names.push_back(vs10IA64generatorName); } +}; + +//---------------------------------------------------------------------------- +cmGlobalGeneratorFactory* cmGlobalVisualStudio10Generator::NewFactory() +{ + return new Factory; +} + +//---------------------------------------------------------------------------- +cmGlobalVisualStudio10Generator::cmGlobalVisualStudio10Generator( + const char* name, const char* architectureId, + const char* additionalPlatformDefinition) + : cmGlobalVisualStudio8Generator(name, architectureId, + additionalPlatformDefinition) { this->FindMakeProgramFile = "CMakeVS10FindMake.cmake"; std::string vc10Express; @@ -88,18 +141,17 @@ void cmGlobalVisualStudio10Generator::Generate() //---------------------------------------------------------------------------- void cmGlobalVisualStudio10Generator -::GetDocumentation(cmDocumentationEntry& entry) const -{ - entry.Name = this->GetName(); - entry.Brief = "Generates Visual Studio 10 project files."; - entry.Full = ""; -} - -//---------------------------------------------------------------------------- -void cmGlobalVisualStudio10Generator ::EnableLanguage(std::vector<std::string>const & lang, cmMakefile *mf, bool optional) { + if(!strcmp(this->ArchitectureId, "Itanium") || + !strcmp(this->ArchitectureId, "x64")) + { + if(this->IsExpressEdition() && !this->Find64BitTools(mf)) + { + return; + } + } cmGlobalVisualStudio8Generator::EnableLanguage(lang, mf, optional); } diff --git a/Source/cmGlobalVisualStudio10Generator.h b/Source/cmGlobalVisualStudio10Generator.h index 47ce790..b377a20 100644 --- a/Source/cmGlobalVisualStudio10Generator.h +++ b/Source/cmGlobalVisualStudio10Generator.h @@ -24,9 +24,9 @@ class cmGlobalVisualStudio10Generator : public cmGlobalVisualStudio8Generator { public: - cmGlobalVisualStudio10Generator(); - static cmGlobalGenerator* New() { - return new cmGlobalVisualStudio10Generator; } + cmGlobalVisualStudio10Generator(const char* name, + const char* architectureId, const char* additionalPlatformDefinition); + static cmGlobalGeneratorFactory* NewFactory(); virtual std::string GenerateBuildCommand(const char* makeProgram, @@ -34,15 +34,8 @@ public: const char* additionalOptions, const char *targetName, const char* config, bool ignoreErrors, bool); - ///! Get the name for the generator. - virtual const char* GetName() const { - return cmGlobalVisualStudio10Generator::GetActualName();} - static const char* GetActualName() {return "Visual Studio 10";} virtual void AddPlatformDefinitions(cmMakefile* mf); - /** Get the documentation entry for this generator. */ - virtual void GetDocumentation(cmDocumentationEntry& entry) const; - ///! create the correct local generator virtual cmLocalGenerator *CreateLocalGenerator(); @@ -92,6 +85,7 @@ protected: bool UseFolderProperty(); private: + class Factory; struct LongestSourcePath { LongestSourcePath(): Length(0), Target(0), SourceFile(0) {} diff --git a/Source/cmGlobalVisualStudio10IA64Generator.cxx b/Source/cmGlobalVisualStudio10IA64Generator.cxx deleted file mode 100644 index 25dd88f..0000000 --- a/Source/cmGlobalVisualStudio10IA64Generator.cxx +++ /dev/null @@ -1,50 +0,0 @@ -/*============================================================================ - CMake - Cross Platform Makefile Generator - Copyright 2000-2009 Kitware, Inc., Insight Software Consortium - - Distributed under the OSI-approved BSD License (the "License"); - see accompanying file Copyright.txt for details. - - This software is distributed WITHOUT ANY WARRANTY; without even the - implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. - See the License for more information. -============================================================================*/ -#include "cmGlobalVisualStudio10IA64Generator.h" -#include "cmMakefile.h" -#include "cmake.h" - -//---------------------------------------------------------------------------- -cmGlobalVisualStudio10IA64Generator::cmGlobalVisualStudio10IA64Generator() -{ - this->ArchitectureId = "x64"; -} - -//---------------------------------------------------------------------------- -void cmGlobalVisualStudio10IA64Generator -::GetDocumentation(cmDocumentationEntry& entry) const -{ - entry.Name = this->GetName(); - entry.Brief = "Generates Visual Studio 10 Itanium project files."; - entry.Full = ""; -} - -//---------------------------------------------------------------------------- -void cmGlobalVisualStudio10IA64Generator -::AddPlatformDefinitions(cmMakefile* mf) -{ - this->cmGlobalVisualStudio10Generator::AddPlatformDefinitions(mf); - mf->AddDefinition("CMAKE_FORCE_IA64", "TRUE"); -} - -//---------------------------------------------------------------------------- -void cmGlobalVisualStudio10IA64Generator -::EnableLanguage(std::vector<std::string> const& languages, - cmMakefile* mf, bool optional) -{ - if(this->IsExpressEdition() && !this->Find64BitTools(mf)) - { - return; - } - this->cmGlobalVisualStudio10Generator - ::EnableLanguage(languages, mf, optional); -} diff --git a/Source/cmGlobalVisualStudio10IA64Generator.h b/Source/cmGlobalVisualStudio10IA64Generator.h deleted file mode 100644 index a088272..0000000 --- a/Source/cmGlobalVisualStudio10IA64Generator.h +++ /dev/null @@ -1,40 +0,0 @@ -/*============================================================================ - CMake - Cross Platform Makefile Generator - Copyright 2000-2009 Kitware, Inc., Insight Software Consortium - - Distributed under the OSI-approved BSD License (the "License"); - see accompanying file Copyright.txt for details. - - This software is distributed WITHOUT ANY WARRANTY; without even the - implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. - See the License for more information. -============================================================================*/ -#ifndef cmGlobalVisualStudio10IA64Generator_h -#define cmGlobalVisualStudio10IA64Generator_h - -#include "cmGlobalVisualStudio10Generator.h" - -class cmGlobalVisualStudio10IA64Generator : - public cmGlobalVisualStudio10Generator -{ -public: - cmGlobalVisualStudio10IA64Generator(); - static cmGlobalGenerator* New() { - return new cmGlobalVisualStudio10IA64Generator; } - - ///! Get the name for the generator. - virtual const char* GetName() const { - return cmGlobalVisualStudio10IA64Generator::GetActualName();} - static const char* GetActualName() {return "Visual Studio 10 IA64";} - - virtual const char* GetPlatformName() const {return "Itanium";} - - /** Get the documentation entry for this generator. */ - virtual void GetDocumentation(cmDocumentationEntry& entry) const; - - virtual void AddPlatformDefinitions(cmMakefile* mf); - - virtual void EnableLanguage(std::vector<std::string>const& languages, - cmMakefile *, bool optional); -}; -#endif diff --git a/Source/cmGlobalVisualStudio10Win64Generator.cxx b/Source/cmGlobalVisualStudio10Win64Generator.cxx deleted file mode 100644 index d0a0c49..0000000 --- a/Source/cmGlobalVisualStudio10Win64Generator.cxx +++ /dev/null @@ -1,50 +0,0 @@ -/*============================================================================ - 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 "cmGlobalVisualStudio10Win64Generator.h" -#include "cmMakefile.h" -#include "cmake.h" - -//---------------------------------------------------------------------------- -cmGlobalVisualStudio10Win64Generator::cmGlobalVisualStudio10Win64Generator() -{ - this->ArchitectureId = "x64"; -} - -//---------------------------------------------------------------------------- -void cmGlobalVisualStudio10Win64Generator -::GetDocumentation(cmDocumentationEntry& entry) const -{ - entry.Name = this->GetName(); - entry.Brief = "Generates Visual Studio 10 Win64 project files."; - entry.Full = ""; -} - -//---------------------------------------------------------------------------- -void cmGlobalVisualStudio10Win64Generator -::AddPlatformDefinitions(cmMakefile* mf) -{ - this->cmGlobalVisualStudio10Generator::AddPlatformDefinitions(mf); - mf->AddDefinition("CMAKE_FORCE_WIN64", "TRUE"); -} - -//---------------------------------------------------------------------------- -void cmGlobalVisualStudio10Win64Generator -::EnableLanguage(std::vector<std::string> const& languages, - cmMakefile* mf, bool optional) -{ - if(this->IsExpressEdition() && !this->Find64BitTools(mf)) - { - return; - } - this->cmGlobalVisualStudio10Generator - ::EnableLanguage(languages, mf, optional); -} diff --git a/Source/cmGlobalVisualStudio10Win64Generator.h b/Source/cmGlobalVisualStudio10Win64Generator.h deleted file mode 100644 index 8a2de4c..0000000 --- a/Source/cmGlobalVisualStudio10Win64Generator.h +++ /dev/null @@ -1,40 +0,0 @@ -/*============================================================================ - 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 cmGlobalVisualStudio10Win64Generator_h -#define cmGlobalVisualStudio10Win64Generator_h - -#include "cmGlobalVisualStudio10Generator.h" - -class cmGlobalVisualStudio10Win64Generator : - public cmGlobalVisualStudio10Generator -{ -public: - cmGlobalVisualStudio10Win64Generator(); - static cmGlobalGenerator* New() { - return new cmGlobalVisualStudio10Win64Generator; } - - ///! Get the name for the generator. - virtual const char* GetName() const { - return cmGlobalVisualStudio10Win64Generator::GetActualName();} - static const char* GetActualName() {return "Visual Studio 10 Win64";} - - virtual const char* GetPlatformName() const {return "x64";} - - /** Get the documentation entry for this generator. */ - virtual void GetDocumentation(cmDocumentationEntry& entry) const; - - virtual void AddPlatformDefinitions(cmMakefile* mf); - - virtual void EnableLanguage(std::vector<std::string>const& languages, - cmMakefile *, bool optional); -}; -#endif diff --git a/Source/cmGlobalVisualStudio11ARMGenerator.cxx b/Source/cmGlobalVisualStudio11ARMGenerator.cxx deleted file mode 100644 index efd71c6..0000000 --- a/Source/cmGlobalVisualStudio11ARMGenerator.cxx +++ /dev/null @@ -1,29 +0,0 @@ -/*============================================================================ - CMake - Cross Platform Makefile Generator - Copyright 2000-2011 Kitware, Inc., Insight Software Consortium - - Distributed under the OSI-approved BSD License (the "License"); - see accompanying file Copyright.txt for details. - - This software is distributed WITHOUT ANY WARRANTY; without even the - implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. - See the License for more information. -============================================================================*/ -#include "cmGlobalVisualStudio11ARMGenerator.h" -#include "cmMakefile.h" -#include "cmake.h" - -//---------------------------------------------------------------------------- -cmGlobalVisualStudio11ARMGenerator::cmGlobalVisualStudio11ARMGenerator() -{ - this->ArchitectureId = "ARM"; -} - -//---------------------------------------------------------------------------- -void cmGlobalVisualStudio11ARMGenerator -::GetDocumentation(cmDocumentationEntry& entry) const -{ - entry.Name = this->GetName(); - entry.Brief = "Generates Visual Studio 11 ARM project files."; - entry.Full = ""; -} diff --git a/Source/cmGlobalVisualStudio11ARMGenerator.h b/Source/cmGlobalVisualStudio11ARMGenerator.h deleted file mode 100644 index 71dbf2e..0000000 --- a/Source/cmGlobalVisualStudio11ARMGenerator.h +++ /dev/null @@ -1,35 +0,0 @@ -/*============================================================================ - CMake - Cross Platform Makefile Generator - Copyright 2000-2011 Kitware, Inc., Insight Software Consortium - - Distributed under the OSI-approved BSD License (the "License"); - see accompanying file Copyright.txt for details. - - This software is distributed WITHOUT ANY WARRANTY; without even the - implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. - See the License for more information. -============================================================================*/ -#ifndef cmGlobalVisualStudio11ARMGenerator_h -#define cmGlobalVisualStudio11ARMGenerator_h - -#include "cmGlobalVisualStudio11Generator.h" - -class cmGlobalVisualStudio11ARMGenerator : - public cmGlobalVisualStudio11Generator -{ -public: - cmGlobalVisualStudio11ARMGenerator(); - static cmGlobalGenerator* New() { - return new cmGlobalVisualStudio11ARMGenerator; } - - ///! Get the name for the generator. - virtual const char* GetName() const { - return cmGlobalVisualStudio11ARMGenerator::GetActualName();} - static const char* GetActualName() {return "Visual Studio 11 ARM";} - - virtual const char* GetPlatformName() const {return "ARM";} - - /** Get the documentation entry for this generator. */ - virtual void GetDocumentation(cmDocumentationEntry& entry) const; -}; -#endif diff --git a/Source/cmGlobalVisualStudio11Generator.cxx b/Source/cmGlobalVisualStudio11Generator.cxx index 23a1204..ba30e18 100644 --- a/Source/cmGlobalVisualStudio11Generator.cxx +++ b/Source/cmGlobalVisualStudio11Generator.cxx @@ -13,8 +13,61 @@ #include "cmLocalVisualStudio10Generator.h" #include "cmMakefile.h" +static const char vs11Win32generatorName[] = "Visual Studio 11"; +static const char vs11Win64generatorName[] = "Visual Studio 11 Win64"; +static const char vs11ARMgeneratorName[] = "Visual Studio 11 ARM"; + +class cmGlobalVisualStudio11Generator::Factory + : public cmGlobalGeneratorFactory +{ +public: + virtual cmGlobalGenerator* CreateGlobalGenerator(const char* name) const { + if(!strcmp(name, vs11Win32generatorName)) + { + return new cmGlobalVisualStudio11Generator( + vs11Win32generatorName, NULL, NULL); + } + if(!strcmp(name, vs11Win64generatorName)) + { + return new cmGlobalVisualStudio11Generator( + vs11Win64generatorName, "x64", "CMAKE_FORCE_WIN64"); + } + if(!strcmp(name, vs11ARMgeneratorName)) + { + return new cmGlobalVisualStudio11Generator( + vs11ARMgeneratorName, "ARM", NULL); + } + return 0; + } + + virtual void GetDocumentation(cmDocumentationEntry& entry) const { + entry.Name = "Visual Studio 11"; + entry.Brief = "Generates Visual Studio 11 project files."; + entry.Full = + "It is possible to append a space followed by the platform name " + "to create project files for a specific target platform. E.g. " + "\"Visual Studio 11 Win64\" will create project files for " + "the x64 processor; \"Visual Studio 11 ARM\" for ARM."; + } + + virtual void GetGenerators(std::vector<std::string>& names) const { + names.push_back(vs11Win32generatorName); + names.push_back(vs11Win64generatorName); + names.push_back(vs11ARMgeneratorName); } +}; + //---------------------------------------------------------------------------- -cmGlobalVisualStudio11Generator::cmGlobalVisualStudio11Generator() +cmGlobalGeneratorFactory* cmGlobalVisualStudio11Generator::NewFactory() +{ + return new Factory; +} + +//---------------------------------------------------------------------------- +cmGlobalVisualStudio11Generator::cmGlobalVisualStudio11Generator( + const char* name, const char* architectureId, + const char* additionalPlatformDefinition) + : cmGlobalVisualStudio10Generator(name, architectureId, + additionalPlatformDefinition) { this->FindMakeProgramFile = "CMakeVS11FindMake.cmake"; std::string vc11Express; @@ -40,12 +93,3 @@ cmLocalGenerator *cmGlobalVisualStudio11Generator::CreateLocalGenerator() lg->SetGlobalGenerator(this); return lg; } - -//---------------------------------------------------------------------------- -void cmGlobalVisualStudio11Generator -::GetDocumentation(cmDocumentationEntry& entry) const -{ - entry.Name = this->GetName(); - entry.Brief = "Generates Visual Studio 11 project files."; - entry.Full = ""; -} diff --git a/Source/cmGlobalVisualStudio11Generator.h b/Source/cmGlobalVisualStudio11Generator.h index 56337a4..8898c5d 100644 --- a/Source/cmGlobalVisualStudio11Generator.h +++ b/Source/cmGlobalVisualStudio11Generator.h @@ -20,20 +20,12 @@ class cmGlobalVisualStudio11Generator: public cmGlobalVisualStudio10Generator { public: - cmGlobalVisualStudio11Generator(); - static cmGlobalGenerator* New() { - return new cmGlobalVisualStudio11Generator; } - - ///! Get the name for the generator. - virtual const char* GetName() const { - return cmGlobalVisualStudio11Generator::GetActualName();} - static const char* GetActualName() {return "Visual Studio 11";} + cmGlobalVisualStudio11Generator(const char* name, + const char* architectureId, const char* additionalPlatformDefinition); + static cmGlobalGeneratorFactory* NewFactory(); virtual void WriteSLNHeader(std::ostream& fout); - /** Get the documentation entry for this generator. */ - virtual void GetDocumentation(cmDocumentationEntry& entry) const; - ///! create the correct local generator virtual cmLocalGenerator *CreateLocalGenerator(); @@ -41,5 +33,7 @@ public: virtual std::string GetUserMacrosDirectory() { return ""; } protected: virtual const char* GetIDEVersion() { return "11.0"; } +private: + class Factory; }; #endif diff --git a/Source/cmGlobalVisualStudio11Win64Generator.cxx b/Source/cmGlobalVisualStudio11Win64Generator.cxx deleted file mode 100644 index 94e07bf..0000000 --- a/Source/cmGlobalVisualStudio11Win64Generator.cxx +++ /dev/null @@ -1,37 +0,0 @@ -/*============================================================================ - CMake - Cross Platform Makefile Generator - Copyright 2000-2011 Kitware, Inc., Insight Software Consortium - - Distributed under the OSI-approved BSD License (the "License"); - see accompanying file Copyright.txt for details. - - This software is distributed WITHOUT ANY WARRANTY; without even the - implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. - See the License for more information. -============================================================================*/ -#include "cmGlobalVisualStudio11Win64Generator.h" -#include "cmMakefile.h" -#include "cmake.h" - -//---------------------------------------------------------------------------- -cmGlobalVisualStudio11Win64Generator::cmGlobalVisualStudio11Win64Generator() -{ - this->ArchitectureId = "x64"; -} - -//---------------------------------------------------------------------------- -void cmGlobalVisualStudio11Win64Generator -::GetDocumentation(cmDocumentationEntry& entry) const -{ - entry.Name = this->GetName(); - entry.Brief = "Generates Visual Studio 11 Win64 project files."; - entry.Full = ""; -} - -//---------------------------------------------------------------------------- -void cmGlobalVisualStudio11Win64Generator -::AddPlatformDefinitions(cmMakefile* mf) -{ - this->cmGlobalVisualStudio11Generator::AddPlatformDefinitions(mf); - mf->AddDefinition("CMAKE_FORCE_WIN64", "TRUE"); -} diff --git a/Source/cmGlobalVisualStudio11Win64Generator.h b/Source/cmGlobalVisualStudio11Win64Generator.h deleted file mode 100644 index 9445d15..0000000 --- a/Source/cmGlobalVisualStudio11Win64Generator.h +++ /dev/null @@ -1,37 +0,0 @@ -/*============================================================================ - CMake - Cross Platform Makefile Generator - Copyright 2000-2011 Kitware, Inc., Insight Software Consortium - - Distributed under the OSI-approved BSD License (the "License"); - see accompanying file Copyright.txt for details. - - This software is distributed WITHOUT ANY WARRANTY; without even the - implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. - See the License for more information. -============================================================================*/ -#ifndef cmGlobalVisualStudio11Win64Generator_h -#define cmGlobalVisualStudio11Win64Generator_h - -#include "cmGlobalVisualStudio11Generator.h" - -class cmGlobalVisualStudio11Win64Generator : - public cmGlobalVisualStudio11Generator -{ -public: - cmGlobalVisualStudio11Win64Generator(); - static cmGlobalGenerator* New() { - return new cmGlobalVisualStudio11Win64Generator; } - - ///! Get the name for the generator. - virtual const char* GetName() const { - return cmGlobalVisualStudio11Win64Generator::GetActualName();} - static const char* GetActualName() {return "Visual Studio 11 Win64";} - - virtual const char* GetPlatformName() const {return "x64";} - - /** Get the documentation entry for this generator. */ - virtual void GetDocumentation(cmDocumentationEntry& entry) const; - - virtual void AddPlatformDefinitions(cmMakefile* mf); -}; -#endif diff --git a/Source/cmGlobalVisualStudio6Generator.cxx b/Source/cmGlobalVisualStudio6Generator.cxx index e8ca788..cb15c30 100644 --- a/Source/cmGlobalVisualStudio6Generator.cxx +++ b/Source/cmGlobalVisualStudio6Generator.cxx @@ -200,7 +200,6 @@ void cmGlobalVisualStudio6Generator tt != orderedProjectTargets.end(); ++tt) { cmTarget* target = *tt; - cmMakefile* mf = target->GetMakefile(); // Write the project into the DSW file const char* expath = target->GetProperty("EXTERNAL_MSPROJECT"); if(expath) @@ -398,9 +397,9 @@ cmGlobalVisualStudio6Generator::WriteUtilityDepend(cmTarget* target) //---------------------------------------------------------------------------- void cmGlobalVisualStudio6Generator -::GetDocumentation(cmDocumentationEntry& entry) const +::GetDocumentation(cmDocumentationEntry& entry) { - entry.Name = this->GetName(); + entry.Name = cmGlobalVisualStudio6Generator::GetActualName(); entry.Brief = "Generates Visual Studio 6 project files."; entry.Full = ""; } diff --git a/Source/cmGlobalVisualStudio6Generator.h b/Source/cmGlobalVisualStudio6Generator.h index 259aa8d..40149e9 100644 --- a/Source/cmGlobalVisualStudio6Generator.h +++ b/Source/cmGlobalVisualStudio6Generator.h @@ -13,6 +13,7 @@ #define cmGlobalVisualStudio6Generator_h #include "cmGlobalVisualStudioGenerator.h" +#include "cmGlobalGeneratorFactory.h" class cmTarget; @@ -25,8 +26,9 @@ class cmGlobalVisualStudio6Generator : public cmGlobalVisualStudioGenerator { public: cmGlobalVisualStudio6Generator(); - static cmGlobalGenerator* New() { - return new cmGlobalVisualStudio6Generator; } + static cmGlobalGeneratorFactory* NewFactory() { + return new cmGlobalGeneratorSimpleFactory + <cmGlobalVisualStudio6Generator>(); } ///! Get the name for the generator. virtual const char* GetName() const { @@ -34,7 +36,7 @@ public: static const char* GetActualName() {return "Visual Studio 6";} /** Get the documentation entry for this generator. */ - virtual void GetDocumentation(cmDocumentationEntry& entry) const; + static void GetDocumentation(cmDocumentationEntry& entry); ///! Create a local generator appropriate to this Global Generator virtual cmLocalGenerator *CreateLocalGenerator(); diff --git a/Source/cmGlobalVisualStudio71Generator.cxx b/Source/cmGlobalVisualStudio71Generator.cxx index ab2308f..db584b8 100644 --- a/Source/cmGlobalVisualStudio71Generator.cxx +++ b/Source/cmGlobalVisualStudio71Generator.cxx @@ -128,6 +128,9 @@ void cmGlobalVisualStudio71Generator fout << "\tEndGlobalSection\n"; } + // Write out global sections + this->WriteSLNGlobalSections(fout, root); + // Write the footer for the SLN file this->WriteSLNFooter(fout); } @@ -273,9 +276,10 @@ void cmGlobalVisualStudio71Generator // Write a dsp file into the SLN file, Note, that dependencies from // executables to the libraries it uses are also done here void cmGlobalVisualStudio71Generator -::WriteProjectConfigurations(std::ostream& fout, const char* name, - bool partOfDefaultBuild, - const char* platformMapping) +::WriteProjectConfigurations( + std::ostream& fout, const char* name, + const std::set<std::string>& configsPartOfDefaultBuild, + const char* platformMapping) { std::string guid = this->GetGUID(name); for(std::vector<std::string>::iterator i = this->Configurations.begin(); @@ -284,7 +288,9 @@ void cmGlobalVisualStudio71Generator fout << "\t\t{" << guid << "}." << *i << ".ActiveCfg = " << *i << "|" << (platformMapping ? platformMapping : "Win32") << std::endl; - if(partOfDefaultBuild) + std::set<std::string>::const_iterator + ci = configsPartOfDefaultBuild.find(*i); + if(!(ci == configsPartOfDefaultBuild.end())) { fout << "\t\t{" << guid << "}." << *i << ".Build.0 = " << *i << "|" @@ -294,17 +300,6 @@ void cmGlobalVisualStudio71Generator } //---------------------------------------------------------------------------- -// Standard end of dsw file -void cmGlobalVisualStudio71Generator::WriteSLNFooter(std::ostream& fout) -{ - fout << "\tGlobalSection(ExtensibilityGlobals) = postSolution\n" - << "\tEndGlobalSection\n" - << "\tGlobalSection(ExtensibilityAddIns) = postSolution\n" - << "\tEndGlobalSection\n" - << "EndGlobal\n"; -} - -//---------------------------------------------------------------------------- // ouput standard header for dsw file void cmGlobalVisualStudio71Generator::WriteSLNHeader(std::ostream& fout) { @@ -313,9 +308,9 @@ void cmGlobalVisualStudio71Generator::WriteSLNHeader(std::ostream& fout) //---------------------------------------------------------------------------- void cmGlobalVisualStudio71Generator -::GetDocumentation(cmDocumentationEntry& entry) const +::GetDocumentation(cmDocumentationEntry& entry) { - entry.Name = this->GetName(); + entry.Name = cmGlobalVisualStudio71Generator::GetActualName(); entry.Brief = "Generates Visual Studio .NET 2003 project files."; entry.Full = ""; } diff --git a/Source/cmGlobalVisualStudio71Generator.h b/Source/cmGlobalVisualStudio71Generator.h index a8daad6..e9cab06 100644 --- a/Source/cmGlobalVisualStudio71Generator.h +++ b/Source/cmGlobalVisualStudio71Generator.h @@ -24,8 +24,9 @@ class cmGlobalVisualStudio71Generator : public cmGlobalVisualStudio7Generator { public: cmGlobalVisualStudio71Generator(); - static cmGlobalGenerator* New() - { return new cmGlobalVisualStudio71Generator; } + static cmGlobalGeneratorFactory* NewFactory() { + return new cmGlobalGeneratorSimpleFactory + <cmGlobalVisualStudio71Generator>(); } ///! Get the name for the generator. virtual const char* GetName() const { @@ -33,7 +34,7 @@ public: static const char* GetActualName() {return "Visual Studio 7 .NET 2003";} /** Get the documentation entry for this generator. */ - virtual void GetDocumentation(cmDocumentationEntry& entry) const; + static void GetDocumentation(cmDocumentationEntry& entry); ///! Create a local generator appropriate to this Global Generator virtual cmLocalGenerator *CreateLocalGenerator(); @@ -61,16 +62,15 @@ protected: const char* name, const char* path, cmTarget &t); virtual void WriteProjectDepends(std::ostream& fout, const char* name, const char* path, cmTarget &t); - virtual void WriteProjectConfigurations(std::ostream& fout, - const char* name, - bool partOfDefaultBuild, - const char* platformMapping = NULL); + virtual void WriteProjectConfigurations( + std::ostream& fout, const char* name, + const std::set<std::string>& configsPartOfDefaultBuild, + const char* platformMapping = NULL); virtual void WriteExternalProject(std::ostream& fout, const char* name, const char* path, const char* typeGuid, const std::set<cmStdString>& depends); - virtual void WriteSLNFooter(std::ostream& fout); virtual void WriteSLNHeader(std::ostream& fout); std::string ProjectConfigurationSectionName; diff --git a/Source/cmGlobalVisualStudio7Generator.cxx b/Source/cmGlobalVisualStudio7Generator.cxx index 15ef738..b82a4f4 100644 --- a/Source/cmGlobalVisualStudio7Generator.cxx +++ b/Source/cmGlobalVisualStudio7Generator.cxx @@ -10,6 +10,7 @@ See the License for more information. ============================================================================*/ #include "windows.h" // this must be first to define GetCurrentDirectory +#include <assert.h> #include "cmGlobalVisualStudio7Generator.h" #include "cmGeneratedFileStream.h" #include "cmLocalVisualStudio7Generator.h" @@ -243,20 +244,23 @@ void cmGlobalVisualStudio7Generator::WriteTargetConfigurations( const char* expath = target->GetProperty("EXTERNAL_MSPROJECT"); if(expath) { + std::set<std::string> allConfigurations(this->Configurations.begin(), + this->Configurations.end()); this->WriteProjectConfigurations( fout, target->GetName(), - true, target->GetProperty("VS_PLATFORM_MAPPING")); + allConfigurations, target->GetProperty("VS_PLATFORM_MAPPING")); } else { - bool partOfDefaultBuild = this->IsPartOfDefaultBuild( - root->GetMakefile()->GetProjectName(), target); + const std::set<std::string>& configsPartOfDefaultBuild = + this->IsPartOfDefaultBuild(root->GetMakefile()->GetProjectName(), + target); const char *vcprojName = target->GetProperty("GENERATOR_FILE_NAME"); if (vcprojName) { this->WriteProjectConfigurations(fout, vcprojName, - partOfDefaultBuild); + configsPartOfDefaultBuild); } } } @@ -431,6 +435,9 @@ void cmGlobalVisualStudio7Generator this->WriteTargetConfigurations(fout, root, orderedProjectTargets); fout << "\tEndGlobalSection\n"; + // Write out global sections + this->WriteSLNGlobalSections(fout, root); + // Write the footer for the SLN file this->WriteSLNFooter(fout); } @@ -579,9 +586,10 @@ cmGlobalVisualStudio7Generator // Write a dsp file into the SLN file, Note, that dependencies from // executables to the libraries it uses are also done here void cmGlobalVisualStudio7Generator -::WriteProjectConfigurations(std::ostream& fout, const char* name, - bool partOfDefaultBuild, - const char* platformMapping) +::WriteProjectConfigurations( + std::ostream& fout, const char* name, + const std::set<std::string>& configsPartOfDefaultBuild, + const char* platformMapping) { std::string guid = this->GetGUID(name); for(std::vector<std::string>::iterator i = this->Configurations.begin(); @@ -590,7 +598,9 @@ void cmGlobalVisualStudio7Generator fout << "\t\t{" << guid << "}." << *i << ".ActiveCfg = " << *i << "|" << (platformMapping ? platformMapping : "Win32") << "\n"; - if(partOfDefaultBuild) + std::set<std::string>::const_iterator + ci = configsPartOfDefaultBuild.find(*i); + if(!(ci == configsPartOfDefaultBuild.end())) { fout << "\t\t{" << guid << "}." << *i << ".Build.0 = " << *i << "|" @@ -624,14 +634,73 @@ void cmGlobalVisualStudio7Generator::WriteExternalProject(std::ostream& fout, +void cmGlobalVisualStudio7Generator +::WriteSLNGlobalSections(std::ostream& fout, + cmLocalGenerator* root) +{ + bool extensibilityGlobalsOverridden = false; + bool extensibilityAddInsOverridden = false; + const cmPropertyMap& props = root->GetMakefile()->GetProperties(); + for(cmPropertyMap::const_iterator itProp = props.begin(); + itProp != props.end(); ++itProp) + { + if(itProp->first.find("VS_GLOBAL_SECTION_") == 0) + { + std::string sectionType; + std::string name = itProp->first.substr(18); + if(name.find("PRE_") == 0) + { + name = name.substr(4); + sectionType = "preSolution"; + } + else if(name.find("POST_") == 0) + { + name = name.substr(5); + sectionType = "postSolution"; + } + else + continue; + if(!name.empty()) + { + if(name == "ExtensibilityGlobals" && sectionType == "postSolution") + extensibilityGlobalsOverridden = true; + else if(name == "ExtensibilityAddIns" && sectionType == "postSolution") + extensibilityAddInsOverridden = true; + fout << "\tGlobalSection(" << name << ") = " << sectionType << "\n"; + std::vector<std::string> keyValuePairs; + cmSystemTools::ExpandListArgument(itProp->second.GetValue(), + keyValuePairs); + for(std::vector<std::string>::const_iterator itPair = + keyValuePairs.begin(); itPair != keyValuePairs.end(); ++itPair) + { + const std::string::size_type posEqual = itPair->find('='); + if(posEqual != std::string::npos) + { + const std::string key = + cmSystemTools::TrimWhitespace(itPair->substr(0, posEqual)); + const std::string value = + cmSystemTools::TrimWhitespace(itPair->substr(posEqual + 1)); + fout << "\t\t" << key << " = " << value << "\n"; + } + } + fout << "\tEndGlobalSection\n"; + } + } + } + if(!extensibilityGlobalsOverridden) + fout << "\tGlobalSection(ExtensibilityGlobals) = postSolution\n" + << "\tEndGlobalSection\n"; + if(!extensibilityAddInsOverridden) + fout << "\tGlobalSection(ExtensibilityAddIns) = postSolution\n" + << "\tEndGlobalSection\n"; +} + + + // Standard end of dsw file void cmGlobalVisualStudio7Generator::WriteSLNFooter(std::ostream& fout) { - fout << "\tGlobalSection(ExtensibilityGlobals) = postSolution\n" - << "\tEndGlobalSection\n" - << "\tGlobalSection(ExtensibilityAddIns) = postSolution\n" - << "\tEndGlobalSection\n" - << "EndGlobal\n"; + fout << "EndGlobal\n"; } @@ -740,9 +809,9 @@ std::vector<std::string> *cmGlobalVisualStudio7Generator::GetConfigurations() //---------------------------------------------------------------------------- void cmGlobalVisualStudio7Generator -::GetDocumentation(cmDocumentationEntry& entry) const +::GetDocumentation(cmDocumentationEntry& entry) { - entry.Name = this->GetName(); + entry.Name = cmGlobalVisualStudio7Generator::GetActualName(); entry.Brief = "Generates Visual Studio .NET 2002 project files."; entry.Full = ""; } @@ -763,26 +832,34 @@ cmGlobalVisualStudio7Generator } } -bool cmGlobalVisualStudio7Generator::IsPartOfDefaultBuild(const char* project, - cmTarget* target) +std::set<std::string> +cmGlobalVisualStudio7Generator::IsPartOfDefaultBuild(const char* project, + cmTarget* target) { - if(target->GetPropertyAsBool("EXCLUDE_FROM_DEFAULT_BUILD")) - { - return false; - } + std::set<std::string> activeConfigs; // if it is a utilitiy target then only make it part of the // default build if another target depends on it int type = target->GetType(); if (type == cmTarget::GLOBAL_TARGET) { - return false; + return activeConfigs; } - if(type == cmTarget::UTILITY) + if(type == cmTarget::UTILITY && !this->IsDependedOn(project, target)) { - return this->IsDependedOn(project, target); + return activeConfigs; + } + // inspect EXCLUDE_FROM_DEFAULT_BUILD[_<CONFIG>] properties + for(std::vector<std::string>::iterator i = this->Configurations.begin(); + i != this->Configurations.end(); ++i) + { + const char* propertyValue = + target->GetFeature("EXCLUDE_FROM_DEFAULT_BUILD", i->c_str()); + if(cmSystemTools::IsOff(propertyValue)) + { + activeConfigs.insert(*i); + } } - // default is to be part of the build - return true; + return activeConfigs; } //---------------------------------------------------------------------------- diff --git a/Source/cmGlobalVisualStudio7Generator.h b/Source/cmGlobalVisualStudio7Generator.h index 1df58f9..9eb9687 100644 --- a/Source/cmGlobalVisualStudio7Generator.h +++ b/Source/cmGlobalVisualStudio7Generator.h @@ -13,6 +13,7 @@ #define cmGlobalVisualStudio7Generator_h #include "cmGlobalVisualStudioGenerator.h" +#include "cmGlobalGeneratorFactory.h" class cmTarget; struct cmIDEFlagTable; @@ -26,8 +27,9 @@ class cmGlobalVisualStudio7Generator : public cmGlobalVisualStudioGenerator { public: cmGlobalVisualStudio7Generator(); - static cmGlobalGenerator* New() { - return new cmGlobalVisualStudio7Generator; } + static cmGlobalGeneratorFactory* NewFactory() { + return new cmGlobalGeneratorSimpleFactory + <cmGlobalVisualStudio7Generator>(); } ///! Get the name for the generator. virtual const char* GetName() const { @@ -38,7 +40,7 @@ public: virtual cmLocalGenerator *CreateLocalGenerator(); /** Get the documentation entry for this generator. */ - virtual void GetDocumentation(cmDocumentationEntry& entry) const; + static void GetDocumentation(cmDocumentationEntry& entry); /** * Try to determine system infomation such as shared library @@ -105,10 +107,12 @@ protected: const char* name, const char* path, cmTarget &t); virtual void WriteProjectDepends(std::ostream& fout, const char* name, const char* path, cmTarget &t); - virtual void WriteProjectConfigurations(std::ostream& fout, - const char* name, - bool partOfDefaultBuild, - const char* platformMapping = NULL); + virtual void WriteProjectConfigurations( + std::ostream& fout, const char* name, + const std::set<std::string>& configsPartOfDefaultBuild, + const char* platformMapping = NULL); + virtual void WriteSLNGlobalSections(std::ostream& fout, + cmLocalGenerator* root); virtual void WriteSLNFooter(std::ostream& fout); virtual void WriteSLNHeader(std::ostream& fout); virtual std::string WriteUtilityDepend(cmTarget* target); @@ -136,8 +140,8 @@ protected: std::string ConvertToSolutionPath(const char* path); - bool IsPartOfDefaultBuild(const char* project, - cmTarget* target); + std::set<std::string> IsPartOfDefaultBuild(const char* project, + cmTarget* target); std::vector<std::string> Configurations; std::map<cmStdString, cmStdString> GUIDMap; diff --git a/Source/cmGlobalVisualStudio8Generator.cxx b/Source/cmGlobalVisualStudio8Generator.cxx index bca1754..855727b 100644 --- a/Source/cmGlobalVisualStudio8Generator.cxx +++ b/Source/cmGlobalVisualStudio8Generator.cxx @@ -16,11 +16,74 @@ #include "cmake.h" #include "cmGeneratedFileStream.h" +static const char vs8Win32generatorName[] = "Visual Studio 8 2005"; +static const char vs8Win64generatorName[] = "Visual Studio 8 2005 Win64"; + +class cmGlobalVisualStudio8Generator::Factory + : public cmGlobalGeneratorFactory +{ +public: + virtual cmGlobalGenerator* CreateGlobalGenerator(const char* name) const { + if(!strcmp(name, vs8Win32generatorName)) + { + return new cmGlobalVisualStudio8Generator( + vs8Win32generatorName, NULL, NULL); + } + if(!strcmp(name, vs8Win64generatorName)) + { + return new cmGlobalVisualStudio8Generator( + vs8Win64generatorName, "x64", "CMAKE_FORCE_WIN64"); + } + return 0; + } + + virtual void GetDocumentation(cmDocumentationEntry& entry) const { + entry.Name = "Visual Studio 8 2005"; + entry.Brief = "Generates Visual Studio 8 2005 project files."; + entry.Full = + "It is possible to append a space followed by the platform name " + "to create project files for a specific target platform. E.g. " + "\"Visual Studio 8 2005 Win64\" will create project files for " + "the x64 processor."; + } + + virtual void GetGenerators(std::vector<std::string>& names) const { + names.push_back(vs8Win32generatorName); + names.push_back(vs8Win64generatorName); } +}; + //---------------------------------------------------------------------------- -cmGlobalVisualStudio8Generator::cmGlobalVisualStudio8Generator() +cmGlobalGeneratorFactory* cmGlobalVisualStudio8Generator::NewFactory() +{ + return new Factory; +} + +//---------------------------------------------------------------------------- +cmGlobalVisualStudio8Generator::cmGlobalVisualStudio8Generator( + const char* name, const char* architectureId, + const char* additionalPlatformDefinition) { this->FindMakeProgramFile = "CMakeVS8FindMake.cmake"; this->ProjectConfigurationSectionName = "ProjectConfigurationPlatforms"; + this->Name = name; + if (architectureId) + { + this->ArchitectureId = architectureId; + } + if (additionalPlatformDefinition) + { + this->AdditionalPlatformDefinition = additionalPlatformDefinition; + } +} + +//---------------------------------------------------------------------------- +const char* cmGlobalVisualStudio8Generator::GetPlatformName() const +{ + if (!strcmp(this->ArchitectureId, "X86")) + { + return "Win32"; + } + return this->ArchitectureId; } //---------------------------------------------------------------------------- @@ -45,9 +108,9 @@ void cmGlobalVisualStudio8Generator::WriteSLNHeader(std::ostream& fout) //---------------------------------------------------------------------------- void cmGlobalVisualStudio8Generator -::GetDocumentation(cmDocumentationEntry& entry) const +::GetDocumentation(cmDocumentationEntry& entry) { - entry.Name = this->GetName(); + entry.Name = cmGlobalVisualStudio8Generator::GetActualName(); entry.Brief = "Generates Visual Studio 8 2005 project files."; entry.Full = ""; } @@ -204,7 +267,6 @@ void cmGlobalVisualStudio8Generator::AddCheckTarget() // overwritten by the CreateVCProjBuildRule. // (this could be avoided with per-target source files) const char* no_main_dependency = 0; - const char* no_working_directory = 0; if(cmSourceFile* file = mf->AddCustomCommandToOutput( stamps, listFiles, @@ -258,9 +320,10 @@ cmGlobalVisualStudio8Generator //---------------------------------------------------------------------------- void cmGlobalVisualStudio8Generator -::WriteProjectConfigurations(std::ostream& fout, const char* name, - bool partOfDefaultBuild, - const char* platformMapping) +::WriteProjectConfigurations( + std::ostream& fout, const char* name, + const std::set<std::string>& configsPartOfDefaultBuild, + const char* platformMapping) { std::string guid = this->GetGUID(name); for(std::vector<std::string>::iterator i = this->Configurations.begin(); @@ -270,7 +333,9 @@ cmGlobalVisualStudio8Generator << "|" << this->GetPlatformName() << ".ActiveCfg = " << *i << "|" << (platformMapping ? platformMapping : this->GetPlatformName()) << "\n"; - if(partOfDefaultBuild) + std::set<std::string>::const_iterator + ci = configsPartOfDefaultBuild.find(*i); + if(!(ci == configsPartOfDefaultBuild.end())) { fout << "\t\t{" << guid << "}." << *i << "|" << this->GetPlatformName() << ".Build.0 = " << *i << "|" diff --git a/Source/cmGlobalVisualStudio8Generator.h b/Source/cmGlobalVisualStudio8Generator.h index 5009f29..f68bb9e 100644 --- a/Source/cmGlobalVisualStudio8Generator.h +++ b/Source/cmGlobalVisualStudio8Generator.h @@ -23,19 +23,17 @@ class cmGlobalVisualStudio8Generator : public cmGlobalVisualStudio71Generator { public: - cmGlobalVisualStudio8Generator(); - static cmGlobalGenerator* New() { - return new cmGlobalVisualStudio8Generator; } + cmGlobalVisualStudio8Generator(const char* name, + const char* architectureId, const char* additionalPlatformDefinition); + static cmGlobalGeneratorFactory* NewFactory(); ///! Get the name for the generator. - virtual const char* GetName() const { - return cmGlobalVisualStudio8Generator::GetActualName();} - static const char* GetActualName() {return "Visual Studio 8 2005";} + virtual const char* GetName() const {return this->Name;} - virtual const char* GetPlatformName() const {return "Win32";} + const char* GetPlatformName() const; /** Get the documentation entry for this generator. */ - virtual void GetDocumentation(cmDocumentationEntry& entry) const; + static void GetDocumentation(cmDocumentationEntry& entry); ///! Create a local generator appropriate to this Global Generator virtual cmLocalGenerator *CreateLocalGenerator(); @@ -74,12 +72,17 @@ protected: static cmIDEFlagTable const* GetExtraFlagTableVS8(); virtual void WriteSLNHeader(std::ostream& fout); virtual void WriteSolutionConfigurations(std::ostream& fout); - virtual void WriteProjectConfigurations(std::ostream& fout, - const char* name, - bool partOfDefaultBuild, - const char* platformMapping = NULL); + virtual void WriteProjectConfigurations( + std::ostream& fout, const char* name, + const std::set<std::string>& configsPartOfDefaultBuild, + const char* platformMapping = NULL); virtual bool ComputeTargetDepends(); virtual void WriteProjectDepends(std::ostream& fout, const char* name, const char* path, cmTarget &t); + + const char* Name; + +private: + class Factory; }; #endif diff --git a/Source/cmGlobalVisualStudio8Win64Generator.cxx b/Source/cmGlobalVisualStudio8Win64Generator.cxx deleted file mode 100644 index 4cbc275..0000000 --- a/Source/cmGlobalVisualStudio8Win64Generator.cxx +++ /dev/null @@ -1,40 +0,0 @@ -/*============================================================================ - 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 "windows.h" // this must be first to define GetCurrentDirectory -#include "cmGlobalVisualStudio8Win64Generator.h" -#include "cmLocalVisualStudio7Generator.h" -#include "cmMakefile.h" -#include "cmake.h" - - - -cmGlobalVisualStudio8Win64Generator::cmGlobalVisualStudio8Win64Generator() -{ - this->ArchitectureId = "x64"; -} - -//---------------------------------------------------------------------------- -void cmGlobalVisualStudio8Win64Generator -::GetDocumentation(cmDocumentationEntry& entry) const -{ - entry.Name = this->GetName(); - entry.Brief = "Generates Visual Studio 8 2005 Win64 project files."; - entry.Full = ""; -} - -//---------------------------------------------------------------------------- -void cmGlobalVisualStudio8Win64Generator -::AddPlatformDefinitions(cmMakefile* mf) -{ - this->cmGlobalVisualStudio8Generator::AddPlatformDefinitions(mf); - mf->AddDefinition("CMAKE_FORCE_WIN64", "TRUE"); -} diff --git a/Source/cmGlobalVisualStudio8Win64Generator.h b/Source/cmGlobalVisualStudio8Win64Generator.h deleted file mode 100644 index 12f8012..0000000 --- a/Source/cmGlobalVisualStudio8Win64Generator.h +++ /dev/null @@ -1,47 +0,0 @@ -/*============================================================================ - 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 cmGlobalVisualStudio8Win64Generator_h -#define cmGlobalVisualStudio8Win64Generator_h - -#include "cmGlobalVisualStudio8Generator.h" - - -/** \class cmGlobalVisualStudio8Win64Generator - * \brief Write a Unix makefiles. - * - * cmGlobalVisualStudio8Win64Generator manages UNIX build process for a tree - */ -class cmGlobalVisualStudio8Win64Generator : - public cmGlobalVisualStudio8Generator -{ -public: - cmGlobalVisualStudio8Win64Generator(); - static cmGlobalGenerator* New() { - return new cmGlobalVisualStudio8Win64Generator; } - - ///! Get the name for the generator. - virtual const char* GetName() const { - return cmGlobalVisualStudio8Win64Generator::GetActualName();} - static const char* GetActualName() {return "Visual Studio 8 2005 Win64";} - - virtual const char* GetPlatformName() const {return "x64";} - - /** Get the documentation entry for this generator. */ - virtual void GetDocumentation(cmDocumentationEntry& entry) const; - - /** - * Try to determine system infomation such as shared library - * extension, pthreads, byte order etc. - */ - virtual void AddPlatformDefinitions(cmMakefile *); -}; -#endif diff --git a/Source/cmGlobalVisualStudio9Generator.cxx b/Source/cmGlobalVisualStudio9Generator.cxx index 70af50d..87599ef 100644 --- a/Source/cmGlobalVisualStudio9Generator.cxx +++ b/Source/cmGlobalVisualStudio9Generator.cxx @@ -15,9 +15,61 @@ #include "cmMakefile.h" #include "cmake.h" +static const char vs9Win32generatorName[] = "Visual Studio 9 2008"; +static const char vs9Win64generatorName[] = "Visual Studio 8 2005 Win64"; +static const char vs9IA64generatorName[] = "Visual Studio 9 2008 IA64"; +class cmGlobalVisualStudio9Generator::Factory + : public cmGlobalGeneratorFactory +{ +public: + virtual cmGlobalGenerator* CreateGlobalGenerator(const char* name) const { + if(!strcmp(name, vs9Win32generatorName)) + { + return new cmGlobalVisualStudio9Generator( + vs9Win32generatorName, NULL, NULL); + } + if(!strcmp(name, vs9Win64generatorName)) + { + return new cmGlobalVisualStudio9Generator( + vs9Win64generatorName, "x64", "CMAKE_FORCE_WIN64"); + } + if(!strcmp(name, vs9IA64generatorName)) + { + return new cmGlobalVisualStudio9Generator( + vs9IA64generatorName, "Itanium", "CMAKE_FORCE_IA64"); + } + return 0; + } + + virtual void GetDocumentation(cmDocumentationEntry& entry) const { + entry.Name = "Visual Studio 9 2008"; + entry.Brief = "Generates Visual Studio 9 2008 project files."; + entry.Full = + "It is possible to append a space followed by the platform name " + "to create project files for a specific target platform. E.g. " + "\"Visual Studio 9 2008 Win64\" will create project files for " + "the x64 processor; \"Visual Studio 9 2008 IA64\" for Itanium."; + } -cmGlobalVisualStudio9Generator::cmGlobalVisualStudio9Generator() + virtual void GetGenerators(std::vector<std::string>& names) const { + names.push_back(vs9Win32generatorName); + names.push_back(vs9Win64generatorName); + names.push_back(vs9IA64generatorName); } +}; + +//---------------------------------------------------------------------------- +cmGlobalGeneratorFactory* cmGlobalVisualStudio9Generator::NewFactory() +{ + return new Factory; +} + +//---------------------------------------------------------------------------- +cmGlobalVisualStudio9Generator::cmGlobalVisualStudio9Generator( + const char* name, const char* architectureId, + const char* additionalPlatformDefinition) + : cmGlobalVisualStudio8Generator(name, architectureId, + additionalPlatformDefinition) { this->FindMakeProgramFile = "CMakeVS9FindMake.cmake"; } @@ -42,15 +94,6 @@ cmLocalGenerator *cmGlobalVisualStudio9Generator::CreateLocalGenerator() //---------------------------------------------------------------------------- void cmGlobalVisualStudio9Generator -::GetDocumentation(cmDocumentationEntry& entry) const -{ - entry.Name = this->GetName(); - entry.Brief = "Generates Visual Studio 9 2008 project files."; - entry.Full = ""; -} - -//---------------------------------------------------------------------------- -void cmGlobalVisualStudio9Generator ::EnableLanguage(std::vector<std::string>const & lang, cmMakefile *mf, bool optional) { diff --git a/Source/cmGlobalVisualStudio9Generator.h b/Source/cmGlobalVisualStudio9Generator.h index 0b0d143..f05d377 100644 --- a/Source/cmGlobalVisualStudio9Generator.h +++ b/Source/cmGlobalVisualStudio9Generator.h @@ -24,17 +24,9 @@ class cmGlobalVisualStudio9Generator : public cmGlobalVisualStudio8Generator { public: - cmGlobalVisualStudio9Generator(); - static cmGlobalGenerator* New() { - return new cmGlobalVisualStudio9Generator; } - - ///! Get the name for the generator. - virtual const char* GetName() const { - return cmGlobalVisualStudio9Generator::GetActualName();} - static const char* GetActualName() {return "Visual Studio 9 2008";} - - /** Get the documentation entry for this generator. */ - virtual void GetDocumentation(cmDocumentationEntry& entry) const; + cmGlobalVisualStudio9Generator(const char* name, + const char* architectureId, const char* additionalPlatformDefinition); + static cmGlobalGeneratorFactory* NewFactory(); ///! create the correct local generator virtual cmLocalGenerator *CreateLocalGenerator(); @@ -61,5 +53,7 @@ public: virtual std::string GetUserMacrosRegKeyBase(); protected: virtual const char* GetIDEVersion() { return "9.0"; } +private: + class Factory; }; #endif diff --git a/Source/cmGlobalVisualStudio9IA64Generator.cxx b/Source/cmGlobalVisualStudio9IA64Generator.cxx deleted file mode 100644 index 38dbfac..0000000 --- a/Source/cmGlobalVisualStudio9IA64Generator.cxx +++ /dev/null @@ -1,37 +0,0 @@ -/*============================================================================ - CMake - Cross Platform Makefile Generator - Copyright 2000-2009 Kitware, Inc., Insight Software Consortium - - Distributed under the OSI-approved BSD License (the "License"); - see accompanying file Copyright.txt for details. - - This software is distributed WITHOUT ANY WARRANTY; without even the - implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. - See the License for more information. -============================================================================*/ -#include "cmGlobalVisualStudio9IA64Generator.h" -#include "cmLocalVisualStudio7Generator.h" -#include "cmMakefile.h" - - -cmGlobalVisualStudio9IA64Generator::cmGlobalVisualStudio9IA64Generator() -{ - this->ArchitectureId = "Itanium"; -} - -//---------------------------------------------------------------------------- -void cmGlobalVisualStudio9IA64Generator -::GetDocumentation(cmDocumentationEntry& entry) const -{ - entry.Name = this->GetName(); - entry.Brief = "Generates Visual Studio 9 2008 Itanium project files."; - entry.Full = ""; -} - -//---------------------------------------------------------------------------- -void cmGlobalVisualStudio9IA64Generator -::AddPlatformDefinitions(cmMakefile* mf) -{ - cmGlobalVisualStudio9Generator::AddPlatformDefinitions(mf); - mf->AddDefinition("CMAKE_FORCE_IA64", "TRUE"); -} diff --git a/Source/cmGlobalVisualStudio9IA64Generator.h b/Source/cmGlobalVisualStudio9IA64Generator.h deleted file mode 100644 index 989b0d1..0000000 --- a/Source/cmGlobalVisualStudio9IA64Generator.h +++ /dev/null @@ -1,47 +0,0 @@ -/*============================================================================ - CMake - Cross Platform Makefile Generator - Copyright 2000-2009 Kitware, Inc., Insight Software Consortium - - Distributed under the OSI-approved BSD License (the "License"); - see accompanying file Copyright.txt for details. - - This software is distributed WITHOUT ANY WARRANTY; without even the - implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. - See the License for more information. -============================================================================*/ -#ifndef cmGlobalVisualStudio9IA64Generator_h -#define cmGlobalVisualStudio9IA64Generator_h - -#include "cmGlobalVisualStudio9Generator.h" - - -/** \class cmGlobalVisualStudio8IA64Generator - * \brief Write a Unix makefiles. - * - * cmGlobalVisualStudio8IA64Generator manages UNIX build process for a tree - */ -class cmGlobalVisualStudio9IA64Generator : - public cmGlobalVisualStudio9Generator -{ -public: - cmGlobalVisualStudio9IA64Generator(); - static cmGlobalGenerator* New() { - return new cmGlobalVisualStudio9IA64Generator; } - - ///! Get the name for the generator. - virtual const char* GetName() const { - return cmGlobalVisualStudio9IA64Generator::GetActualName();} - static const char* GetActualName() {return "Visual Studio 9 2008 IA64";} - - virtual const char* GetPlatformName() const {return "Itanium";} - - /** Get the documentation entry for this generator. */ - virtual void GetDocumentation(cmDocumentationEntry& entry) const; - - /** - * Try to determine system infomation such as shared library - * extension, pthreads, byte order etc. - */ - virtual void AddPlatformDefinitions(cmMakefile *); -}; -#endif diff --git a/Source/cmGlobalVisualStudio9Win64Generator.cxx b/Source/cmGlobalVisualStudio9Win64Generator.cxx deleted file mode 100644 index 4d8a646..0000000 --- a/Source/cmGlobalVisualStudio9Win64Generator.cxx +++ /dev/null @@ -1,37 +0,0 @@ -/*============================================================================ - 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 "cmGlobalVisualStudio9Win64Generator.h" -#include "cmLocalVisualStudio7Generator.h" -#include "cmMakefile.h" - - -cmGlobalVisualStudio9Win64Generator::cmGlobalVisualStudio9Win64Generator() -{ - this->ArchitectureId = "x64"; -} - -//---------------------------------------------------------------------------- -void cmGlobalVisualStudio9Win64Generator -::GetDocumentation(cmDocumentationEntry& entry) const -{ - entry.Name = this->GetName(); - entry.Brief = "Generates Visual Studio 9 2008 Win64 project files."; - entry.Full = ""; -} - -//---------------------------------------------------------------------------- -void cmGlobalVisualStudio9Win64Generator -::AddPlatformDefinitions(cmMakefile* mf) -{ - cmGlobalVisualStudio9Generator::AddPlatformDefinitions(mf); - mf->AddDefinition("CMAKE_FORCE_WIN64", "TRUE"); -} diff --git a/Source/cmGlobalVisualStudio9Win64Generator.h b/Source/cmGlobalVisualStudio9Win64Generator.h deleted file mode 100644 index 7c20cf4..0000000 --- a/Source/cmGlobalVisualStudio9Win64Generator.h +++ /dev/null @@ -1,47 +0,0 @@ -/*============================================================================ - 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 cmGlobalVisualStudio9Win64Generator_h -#define cmGlobalVisualStudio9Win64Generator_h - -#include "cmGlobalVisualStudio9Generator.h" - - -/** \class cmGlobalVisualStudio8Win64Generator - * \brief Write a Unix makefiles. - * - * cmGlobalVisualStudio8Win64Generator manages UNIX build process for a tree - */ -class cmGlobalVisualStudio9Win64Generator : - public cmGlobalVisualStudio9Generator -{ -public: - cmGlobalVisualStudio9Win64Generator(); - static cmGlobalGenerator* New() { - return new cmGlobalVisualStudio9Win64Generator; } - - ///! Get the name for the generator. - virtual const char* GetName() const { - return cmGlobalVisualStudio9Win64Generator::GetActualName();} - static const char* GetActualName() {return "Visual Studio 9 2008 Win64";} - - virtual const char* GetPlatformName() const {return "x64";} - - /** Get the documentation entry for this generator. */ - virtual void GetDocumentation(cmDocumentationEntry& entry) const; - - /** - * Try to determine system infomation such as shared library - * extension, pthreads, byte order etc. - */ - virtual void AddPlatformDefinitions(cmMakefile *); -}; -#endif diff --git a/Source/cmGlobalVisualStudioGenerator.cxx b/Source/cmGlobalVisualStudioGenerator.cxx index 0968b77..a517351 100644 --- a/Source/cmGlobalVisualStudioGenerator.cxx +++ b/Source/cmGlobalVisualStudioGenerator.cxx @@ -22,6 +22,7 @@ cmGlobalVisualStudioGenerator::cmGlobalVisualStudioGenerator() { this->ArchitectureId = "X86"; + this->AdditionalPlatformDefinition = NULL; } //---------------------------------------------------------------------------- @@ -75,7 +76,6 @@ void cmGlobalVisualStudioGenerator::Generate() #endif // Now make all targets depend on the ALL_BUILD target - cmTargets targets; for(std::vector<cmLocalGenerator*>::iterator i = gen.begin(); i != gen.end(); ++i) { @@ -494,6 +494,11 @@ void cmGlobalVisualStudioGenerator::AddPlatformDefinitions(cmMakefile* mf) { mf->AddDefinition("MSVC_C_ARCHITECTURE_ID", this->ArchitectureId); mf->AddDefinition("MSVC_CXX_ARCHITECTURE_ID", this->ArchitectureId); + + if(this->AdditionalPlatformDefinition) + { + mf->AddDefinition(this->AdditionalPlatformDefinition, "TRUE"); + } } //---------------------------------------------------------------------------- diff --git a/Source/cmGlobalVisualStudioGenerator.h b/Source/cmGlobalVisualStudioGenerator.h index cebf7d7..7258e31 100644 --- a/Source/cmGlobalVisualStudioGenerator.h +++ b/Source/cmGlobalVisualStudioGenerator.h @@ -99,6 +99,7 @@ protected: typedef std::map<cmTarget*, cmStdString> UtilityDependsMap; UtilityDependsMap UtilityDepends; const char* ArchitectureId; + const char* AdditionalPlatformDefinition; private: void ComputeTargetObjects(cmGeneratorTarget* gt) const; diff --git a/Source/cmGlobalWatcomWMakeGenerator.cxx b/Source/cmGlobalWatcomWMakeGenerator.cxx index 45b171f..e3cebc4 100644 --- a/Source/cmGlobalWatcomWMakeGenerator.cxx +++ b/Source/cmGlobalWatcomWMakeGenerator.cxx @@ -58,9 +58,9 @@ cmLocalGenerator *cmGlobalWatcomWMakeGenerator::CreateLocalGenerator() //---------------------------------------------------------------------------- void cmGlobalWatcomWMakeGenerator -::GetDocumentation(cmDocumentationEntry& entry) const +::GetDocumentation(cmDocumentationEntry& entry) { - entry.Name = this->GetName(); + entry.Name = cmGlobalWatcomWMakeGenerator::GetActualName(); entry.Brief = "Generates Watcom WMake makefiles."; entry.Full = ""; } diff --git a/Source/cmGlobalWatcomWMakeGenerator.h b/Source/cmGlobalWatcomWMakeGenerator.h index ee16eae..23e60a1 100644 --- a/Source/cmGlobalWatcomWMakeGenerator.h +++ b/Source/cmGlobalWatcomWMakeGenerator.h @@ -23,14 +23,16 @@ class cmGlobalWatcomWMakeGenerator : public cmGlobalUnixMakefileGenerator3 { public: cmGlobalWatcomWMakeGenerator(); - static cmGlobalGenerator* New() { return new cmGlobalWatcomWMakeGenerator; } + static cmGlobalGeneratorFactory* NewFactory() { + return new cmGlobalGeneratorSimpleFactory + <cmGlobalWatcomWMakeGenerator>(); } ///! Get the name for the generator. virtual const char* GetName() const { return cmGlobalWatcomWMakeGenerator::GetActualName();} static const char* GetActualName() {return "Watcom WMake";} /** Get the documentation entry for this generator. */ - virtual void GetDocumentation(cmDocumentationEntry& entry) const; + static void GetDocumentation(cmDocumentationEntry& entry); ///! Create a local generator appropriate to this Global Generator virtual cmLocalGenerator *CreateLocalGenerator(); diff --git a/Source/cmGlobalXCodeGenerator.cxx b/Source/cmGlobalXCodeGenerator.cxx index 5b2ddd8..4ef2f57 100644 --- a/Source/cmGlobalXCodeGenerator.cxx +++ b/Source/cmGlobalXCodeGenerator.cxx @@ -20,6 +20,7 @@ #include "cmSourceFile.h" #include "cmCustomCommandGenerator.h" #include "cmGeneratorTarget.h" +#include "cmGlobalGeneratorFactory.h" #include <cmsys/auto_ptr.hxx> @@ -112,6 +113,18 @@ public: } }; +class cmGlobalXCodeGenerator::Factory : public cmGlobalGeneratorFactory +{ +public: + virtual cmGlobalGenerator* CreateGlobalGenerator(const char* name) const; + + virtual void GetDocumentation(cmDocumentationEntry& entry) const { + cmGlobalXCodeGenerator::GetDocumentation(entry); } + + virtual void GetGenerators(std::vector<std::string>& names) const { + names.push_back(cmGlobalXCodeGenerator::GetActualName()); } +}; + //---------------------------------------------------------------------------- cmGlobalXCodeGenerator::cmGlobalXCodeGenerator(std::string const& version) { @@ -132,8 +145,17 @@ cmGlobalXCodeGenerator::cmGlobalXCodeGenerator(std::string const& version) } //---------------------------------------------------------------------------- -cmGlobalGenerator* cmGlobalXCodeGenerator::New() +cmGlobalGeneratorFactory* cmGlobalXCodeGenerator::NewFactory() { + return new Factory; +} + +//---------------------------------------------------------------------------- +cmGlobalGenerator* cmGlobalXCodeGenerator::Factory +::CreateGlobalGenerator(const char* name) const +{ + if (strcmp(name, GetActualName())) + return 0; #if defined(CMAKE_BUILD_WITH_CMAKE) cmXcodeVersionParser parser; std::string versionFile; @@ -3474,9 +3496,8 @@ const char* cmGlobalXCodeGenerator::GetCMakeCFGIntDir() const //---------------------------------------------------------------------------- void cmGlobalXCodeGenerator::GetDocumentation(cmDocumentationEntry& entry) - const { - entry.Name = this->GetName(); + entry.Name = cmGlobalXCodeGenerator::GetActualName(); entry.Brief = "Generate Xcode project files."; entry.Full = ""; } diff --git a/Source/cmGlobalXCodeGenerator.h b/Source/cmGlobalXCodeGenerator.h index afa1ca2..c98652f 100644 --- a/Source/cmGlobalXCodeGenerator.h +++ b/Source/cmGlobalXCodeGenerator.h @@ -15,6 +15,7 @@ #include "cmGlobalGenerator.h" #include "cmXCodeObject.h" #include "cmCustomCommand.h" +class cmGlobalGeneratorFactory; class cmTarget; class cmSourceFile; class cmSourceGroup; @@ -29,7 +30,7 @@ class cmGlobalXCodeGenerator : public cmGlobalGenerator { public: cmGlobalXCodeGenerator(std::string const& version); - static cmGlobalGenerator* New(); + static cmGlobalGeneratorFactory* NewFactory(); ///! Get the name for the generator. virtual const char* GetName() const { @@ -37,7 +38,7 @@ public: static const char* GetActualName() {return "Xcode";} /** Get the documentation entry for this generator. */ - virtual void GetDocumentation(cmDocumentationEntry& entry) const; + static void GetDocumentation(cmDocumentationEntry& entry); ///! Create a local generator appropriate to this Global Generator virtual cmLocalGenerator *CreateLocalGenerator(); @@ -186,6 +187,7 @@ private: const char* varNameSuffix, const char* default_flags); + class Factory; class BuildObjectListOrString; friend class BuildObjectListOrString; diff --git a/Source/cmIncludeDirectoryCommand.h b/Source/cmIncludeDirectoryCommand.h index 6751fc0..dd37b82 100644 --- a/Source/cmIncludeDirectoryCommand.h +++ b/Source/cmIncludeDirectoryCommand.h @@ -72,9 +72,12 @@ public: "CMAKE_INCLUDE_DIRECTORIES_BEFORE to ON. " "By using AFTER or BEFORE explicitly, you can select between " "appending and prepending, independent of the default. " + "\n" "If the SYSTEM option is given, the compiler will be told the " "directories are meant as system include directories on some " - "platforms."; + "platforms (signalling this setting might achieve effects such as " + "the compiler skipping warnings, or these fixed-install system files " + "not being considered in dependency calculations - see compiler docs)."; } cmTypeMacro(cmIncludeDirectoryCommand, cmCommand); diff --git a/Source/cmLoadCommandCommand.cxx b/Source/cmLoadCommandCommand.cxx index b2acf06..181b922 100644 --- a/Source/cmLoadCommandCommand.cxx +++ b/Source/cmLoadCommandCommand.cxx @@ -224,6 +224,10 @@ cmLoadedCommand::~cmLoadedCommand() bool cmLoadCommandCommand ::InitialPass(std::vector<std::string> const& args, cmExecutionStatus &) { + this->Makefile->IssueMessage( + cmake::AUTHOR_WARNING, + "The \"load_command\" command will be removed in CMake 3.0. " + "See command documentation for details."); if(args.size() < 1 ) { return true; diff --git a/Source/cmLoadCommandCommand.h b/Source/cmLoadCommandCommand.h index f0b34ee..bcd1831 100644 --- a/Source/cmLoadCommandCommand.h +++ b/Source/cmLoadCommandCommand.h @@ -47,7 +47,7 @@ public: */ virtual const char* GetTerseDocumentation() const { - return "Load a command into a running CMake."; + return "Deprecated. Use macro() or function() instead."; } /** @@ -56,6 +56,13 @@ public: virtual const char* GetFullDocumentation() const { return + "This command will be removed in CMake 3.0. " + "It works only when the target architecture matches the " + "running CMake binary. " + "Use macro() or function() to add commands. " + "Use execute_process() to run advanced computations " + "in external processes." + "\n" " load_command(COMMAND_NAME <loc1> [loc2 ...])\n" "The given locations are searched for a library whose name is " "cmCOMMAND_NAME. If found, it is loaded as a module and the command " @@ -67,6 +74,12 @@ public: "Otherwise the variable will not be set."; } + /** This command is kept for compatibility with older CMake versions. */ + virtual bool IsDiscouraged() const + { + return true; + } + cmTypeMacro(cmLoadCommandCommand, cmCommand); }; diff --git a/Source/cmLocalVisualStudio6Generator.cxx b/Source/cmLocalVisualStudio6Generator.cxx index f15322b..9497e31 100644 --- a/Source/cmLocalVisualStudio6Generator.cxx +++ b/Source/cmLocalVisualStudio6Generator.cxx @@ -326,18 +326,18 @@ void cmLocalVisualStudio6Generator::WriteDSPFile(std::ostream& fout, { cmSystemTools::ReplaceString(source, "$(IntDir)/", ""); #if defined(_WIN32) || defined(__CYGWIN__) - std::ofstream fout(source.c_str(), + std::ofstream sourceFout(source.c_str(), std::ios::binary | std::ios::out | std::ios::trunc); #else - std::ofstream fout(source.c_str(), + std::ofstream sourceFout(source.c_str(), std::ios::out | std::ios::trunc); #endif - if(fout) + if(sourceFout) { - fout.write("# generated from CMake",22); - fout.flush(); - fout.close(); + sourceFout.write("# generated from CMake",22); + sourceFout.flush(); + sourceFout.close(); } } } @@ -710,6 +710,8 @@ void cmLocalVisualStudio6Generator::SetBuildType(BuildType b, switch(b) { + case WIN32_EXECUTABLE: + break; case STATIC_LIBRARY: this->DSPHeaderTemplate = root; this->DSPHeaderTemplate += "/staticLibHeader.dsptemplate"; diff --git a/Source/cmLocalVisualStudio7Generator.cxx b/Source/cmLocalVisualStudio7Generator.cxx index f9a2d32..d954a52 100644 --- a/Source/cmLocalVisualStudio7Generator.cxx +++ b/Source/cmLocalVisualStudio7Generator.cxx @@ -914,12 +914,12 @@ void cmLocalVisualStudio7Generator::WriteConfiguration(std::ostream& fout, // for FAT32 file systems, which can cause an empty manifest // to be embedded into the resulting executable. See CMake // bug #2617. - const char* tool = "VCManifestTool"; + const char* manifestTool = "VCManifestTool"; if(this->FortranProject) { - tool = "VFManifestTool"; + manifestTool = "VFManifestTool"; } - fout << "\t\t\t<Tool\n\t\t\t\tName=\"" << tool << "\"\n" + fout << "\t\t\t<Tool\n\t\t\t\tName=\"" << manifestTool << "\"\n" << "\t\t\t\tUseFAT32Workaround=\"true\"\n" << "\t\t\t/>\n"; } @@ -1003,6 +1003,8 @@ void cmLocalVisualStudio7Generator::OutputBuildTool(std::ostream& fout, } switch(target.GetType()) { + case cmTarget::UNKNOWN_LIBRARY: + break; case cmTarget::OBJECT_LIBRARY: { std::string libpath = this->GetTargetDirectory(target); diff --git a/Source/cmLocalVisualStudioGenerator.cxx b/Source/cmLocalVisualStudioGenerator.cxx index 4bcf4de..ef2bb1d 100644 --- a/Source/cmLocalVisualStudioGenerator.cxx +++ b/Source/cmLocalVisualStudioGenerator.cxx @@ -84,7 +84,6 @@ cmLocalVisualStudioGenerator const char* newline_text) { bool useLocal = this->CustomCommandUseLocal(); - const cmCustomCommandLines& commandLines = cc.GetCommandLines(); const char* workingDirectory = cc.GetWorkingDirectory(); cmCustomCommandGenerator ccg(cc, configName, this->Makefile); RelativeRoot relativeRoot = workingDirectory? NONE : START_OUTPUT; diff --git a/Source/cmMacroCommand.h b/Source/cmMacroCommand.h index f8c40c0..aedbb4d 100644 --- a/Source/cmMacroCommand.h +++ b/Source/cmMacroCommand.h @@ -92,12 +92,12 @@ public: "facilitates creating macros with optional arguments. Additionally " "${ARGV} holds the list of all arguments given to the macro and " "${ARGN} " - "holds the list of argument past the last expected argument. " + "holds the list of arguments past the last expected argument. " "Note that the parameters to a macro and values such as ARGN " "are not variables in the usual CMake sense. They are string " - "replacements much like the c preprocessor would do with a " - "macro. If you want true CMake variables you should look at " - "the function command." + "replacements much like the C preprocessor would do with a macro. " + "If you want true CMake variables and/or better CMake scope control " + "you should look at the function command." "\n" "See the cmake_policy() command documentation for the behavior of " "policies inside macros." diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx index f067da4..8498d72 100644 --- a/Source/cmMakefile.cxx +++ b/Source/cmMakefile.cxx @@ -3937,6 +3937,46 @@ void cmMakefile::DefineProperties(cmake *cm) "See the global property of the same name for details. " "This overrides the global property for a directory.", true); + + cm->DefineProperty + ("VS_GLOBAL_SECTION_PRE_<section>", cmProperty::DIRECTORY, + "Specify a preSolution global section in Visual Studio.", + "Setting a property like this generates an entry of the following form " + "in the solution file:\n" + " GlobalSection(<section>) = preSolution\n" + " <contents based on property value>\n" + " EndGlobalSection\n" + "The property must be set to a semicolon-separated list of key=value " + "pairs. Each such pair will be transformed into an entry in the solution " + "global section. Whitespace around key and value is ignored. List " + "elements which do not contain an equal sign are skipped." + "\n" + "This property only works for Visual Studio 7 and above; it is ignored " + "on other generators. The property only applies when set on a directory " + "whose CMakeLists.txt conatins a project() command."); + cm->DefineProperty + ("VS_GLOBAL_SECTION_POST_<section>", cmProperty::DIRECTORY, + "Specify a postSolution global section in Visual Studio.", + "Setting a property like this generates an entry of the following form " + "in the solution file:\n" + " GlobalSection(<section>) = postSolution\n" + " <contents based on property value>\n" + " EndGlobalSection\n" + "The property must be set to a semicolon-separated list of key=value " + "pairs. Each such pair will be transformed into an entry in the solution " + "global section. Whitespace around key and value is ignored. List " + "elements which do not contain an equal sign are skipped." + "\n" + "This property only works for Visual Studio 7 and above; it is ignored " + "on other generators. The property only applies when set on a directory " + "whose CMakeLists.txt conatins a project() command." + "\n" + "Note that CMake generates postSolution sections ExtensibilityGlobals " + "and ExtensibilityAddIns by default. If you set the corresponding " + "property, it will override the default section. For example, setting " + "VS_GLOBAL_SECTION_POST_ExtensibilityGlobals will override the default " + "contents of the ExtensibilityGlobals section, while keeping " + "ExtensibilityAddIns on its default."); } //---------------------------------------------------------------------------- diff --git a/Source/cmMathCommand.h b/Source/cmMathCommand.h index 27c5b6a..dc0ceb3 100644 --- a/Source/cmMathCommand.h +++ b/Source/cmMathCommand.h @@ -58,11 +58,11 @@ public: { return " math(EXPR <output variable> <math expression>)\n" - "EXPR evaluates mathematical expression and return result in the " + "EXPR evaluates mathematical expression and returns result in the " "output variable. Example mathematical expression is " "'5 * ( 10 + 13 )'. Supported operators are " "+ - * / % | & ^ ~ << >> * / %. They have the same meaning " - " as they do in c code."; + " as they do in C code."; } cmTypeMacro(cmMathCommand, cmCommand); diff --git a/Source/cmMessageCommand.h b/Source/cmMessageCommand.h index 9f01eaf..fc61810 100644 --- a/Source/cmMessageCommand.h +++ b/Source/cmMessageCommand.h @@ -67,8 +67,9 @@ public: " STATUS = Incidental information\n" " WARNING = CMake Warning, continue processing\n" " AUTHOR_WARNING = CMake Warning (dev), continue processing\n" - " SEND_ERROR = CMake Error, continue but skip generation\n" - " FATAL_ERROR = CMake Error, stop all processing\n" + " SEND_ERROR = CMake Error, continue processing,\n" + " but skip generation\n" + " FATAL_ERROR = CMake Error, stop processing and generation\n" "The CMake command-line tool displays STATUS messages on stdout " "and all other message types on stderr. " "The CMake GUI displays all messages in its log area. " diff --git a/Source/cmNinjaNormalTargetGenerator.cxx b/Source/cmNinjaNormalTargetGenerator.cxx index 6c54ced..853bc12 100644 --- a/Source/cmNinjaNormalTargetGenerator.cxx +++ b/Source/cmNinjaNormalTargetGenerator.cxx @@ -564,6 +564,7 @@ void cmNinjaNormalTargetGenerator::WriteLinkStatement() // for instance ARG_MAX is 2096152 on Ubuntu or 262144 on Mac commandLineLengthLimit = ((int)sysconf(_SC_ARG_MAX))-linkRuleLength-1000; #else + (void)linkRuleLength; commandLineLengthLimit = -1; #endif } diff --git a/Source/cmPolicies.cxx b/Source/cmPolicies.cxx index 79af4d7..6aef502 100644 --- a/Source/cmPolicies.cxx +++ b/Source/cmPolicies.cxx @@ -457,7 +457,7 @@ cmPolicies::cmPolicies() "This makes sure that the modules belonging to " "CMake always get those files included which they expect, and against " "which they were developed and tested. " - "In call other cases, the files found in " + "In all other cases, the files found in " "CMAKE_MODULE_PATH still take precedence over the ones in " "the CMake module directory. " "The OLD behaviour is to always prefer files from CMAKE_MODULE_PATH over " diff --git a/Source/cmQtAutomoc.cxx b/Source/cmQtAutomoc.cxx index 942c7ab..83688dd 100644 --- a/Source/cmQtAutomoc.cxx +++ b/Source/cmQtAutomoc.cxx @@ -85,6 +85,18 @@ static std::string extractSubDir(const std::string& absPath, } +static void copyTargetProperty(cmTarget* destinationTarget, + cmTarget* sourceTarget, + const char* propertyName) +{ + const char* propertyValue = sourceTarget->GetProperty(propertyName); + if (propertyValue) + { + destinationTarget->SetProperty(propertyName, propertyValue); + } +} + + cmQtAutomoc::cmQtAutomoc() :Verbose(cmsys::SystemTools::GetEnv("VERBOSE") != 0) ,ColorOutput(true) @@ -152,9 +164,13 @@ void cmQtAutomoc::SetupAutomocTarget(cmTarget* target) std::string automocComment = "Automoc for target "; automocComment += targetName; - makefile->AddUtilityCommand(automocTargetName.c_str(), true, + cmTarget* automocTarget = makefile->AddUtilityCommand( + automocTargetName.c_str(), true, workingDirectory.c_str(), depends, commandLines, false, automocComment.c_str()); + // inherit FOLDER property from target (#13688) + copyTargetProperty(automocTarget, target, "FOLDER"); + target->AddUtility(automocTargetName.c_str()); // configure a file to get all information to automoc at buildtime: @@ -195,6 +211,34 @@ void cmQtAutomoc::SetupAutomocTarget(cmTarget* target) } } + + const char* qtIncDir = 0; + const char* qtCoreIncDir = 0; + + // check whether ${QT_INCLUDE_DIR} is part of the implicit include dirs, + // see http://public.kitware.com/Bug/view.php?id=13667 + bool qtIncludeDirMayHaveBeenRemoved = false; + if (makefile->IsSet("QT_INCLUDE_DIR")) + { + qtIncDir = makefile->GetDefinition("QT_INCLUDE_DIR"); + std::string s = + makefile->GetSafeDefinition("CMAKE_CXX_IMPLICIT_INCLUDE_DIRECTORIES"); + std::vector<std::string> implIncDirs; + cmSystemTools::ExpandListArgument(s, implIncDirs); + if (std::find(implIncDirs.begin(), implIncDirs.end(),std::string(qtIncDir)) + != implIncDirs.end()) + { + qtIncludeDirMayHaveBeenRemoved = true; + if (makefile->IsSet("QT_QTCORE_INCLUDE_DIR")) + { + qtCoreIncDir = makefile->GetDefinition("QT_QTCORE_INCLUDE_DIR"); + } + } + } + + bool haveQtCoreIncDir = false; + bool haveQtIncDir = false; + std::vector<std::string> includeDirs; cmGeneratorTarget gtgt(target); localGen->GetIncludeDirectories(includeDirs, >gt, "CXX"); @@ -207,6 +251,37 @@ void cmQtAutomoc::SetupAutomocTarget(cmTarget* target) _moc_incs += sep; sep = ";"; _moc_incs += *incDirIt; + + if (qtIncludeDirMayHaveBeenRemoved && qtCoreIncDir && qtIncDir) // #13667 + { + if (*incDirIt == qtIncDir) + { + haveQtIncDir = true; + qtIncludeDirMayHaveBeenRemoved = false; // it's here, i.e. not removed + } + if (*incDirIt == qtCoreIncDir) + { + haveQtCoreIncDir = true; + } + } + } + + // Some projects (kdelibs, phonon) query the compiler for its default + // include search dirs, and add those to + // CMAKE_CXX_IMPLICIT_INCLUDE_DIRECTORIES. + // These may include e.g./usr/lib/qt/include . This is typically also part + // of ${QT_INCLUDES}. If this directory is then contained in the implicit + // include dirs, it is removed from the include dirs returned from the + // target above. So we add ${QT_INCLUDE_DIR} manually for moc if we detected + // that ${QT_QTCORE_INCLUDE_DIR} is among the include dirs (there shouldn't + // be a way to use Qt4 without using ${QT_QTCORE_INCLUDE_DIR} I think. + // See #13646 and #13667. + if (qtIncludeDirMayHaveBeenRemoved && qtCoreIncDir && qtIncDir + && (haveQtCoreIncDir == true) && (haveQtIncDir == false)) + { + _moc_incs += sep; + sep = ";"; + _moc_incs += qtIncDir; } const char* tmp = target->GetProperty("COMPILE_DEFINITIONS"); diff --git a/Source/cmSetTargetPropertiesCommand.h b/Source/cmSetTargetPropertiesCommand.h index 65c89fa..9dd7848 100644 --- a/Source/cmSetTargetPropertiesCommand.h +++ b/Source/cmSetTargetPropertiesCommand.h @@ -156,7 +156,9 @@ public: "\n" "The EXCLUDE_FROM_DEFAULT_BUILD property is used by the visual " "studio generators. If it is set to 1 the target will not be " - "part of the default build when you select \"Build Solution\"." + "part of the default build when you select \"Build Solution\". " + "This can also be set on a per-configuration basis using " + "EXCLUDE_FROM_DEFAULT_BUILD_<CONFIG>." ; } diff --git a/Source/cmSourceFile.cxx b/Source/cmSourceFile.cxx index cc3b6d6..1d4b0c8 100644 --- a/Source/cmSourceFile.cxx +++ b/Source/cmSourceFile.cxx @@ -458,7 +458,7 @@ void cmSourceFile::DefineProperties(cmake *cm) "A property on a source file that indicates if the source file " "is a header file with no associated implementation. This is " "set automatically based on the file extension and is used by " - "CMake to determine is certain dependency information should be " + "CMake to determine if certain dependency information should be " "computed."); cm->DefineProperty diff --git a/Source/cmSourceGroupCommand.h b/Source/cmSourceGroupCommand.h index 6c87b71..9f6b7e4 100644 --- a/Source/cmSourceGroupCommand.h +++ b/Source/cmSourceGroupCommand.h @@ -68,7 +68,7 @@ public: "expression matches the file will be favored.\n" "The name of the group may contain backslashes to specify subgroups:\n" " source_group(outer\\\\inner ...)\n" - "For backwards compatibility, this command is also supports the " + "For backwards compatibility, this command also supports the " "format:\n" " source_group(name regex)"; } diff --git a/Source/cmTarget.cxx b/Source/cmTarget.cxx index f3eb52b..7c62ea8 100644 --- a/Source/cmTarget.cxx +++ b/Source/cmTarget.cxx @@ -266,6 +266,21 @@ void cmTarget::DefineProperties(cmake *cm) "bundle."); cm->DefineProperty + ("EXCLUDE_FROM_DEFAULT_BUILD", cmProperty::TARGET, + "Exclude target from \"Build Solution\".", + "This property is only used by Visual Studio generators 7 and above. " + "When set to TRUE, the target will not be built when you press " + "\"Build Solution\"."); + + cm->DefineProperty + ("EXCLUDE_FROM_DEFAULT_BUILD_<CONFIG>", cmProperty::TARGET, + "Per-configuration version of target exclusion from \"Build Solution\". ", + "This is the configuration-specific version of " + "EXCLUDE_FROM_DEFAULT_BUILD. If the generic EXCLUDE_FROM_DEFAULT_BUILD " + "is also set on a target, EXCLUDE_FROM_DEFAULT_BUILD_<CONFIG> takes " + "precedence in configurations for which it has a value."); + + cm->DefineProperty ("FRAMEWORK", cmProperty::TARGET, "This target is a framework on the Mac.", "If a shared library target has this property set to true it will " @@ -651,6 +666,22 @@ void cmTarget::DefineProperties(cmake *cm) "custom Makefile link rules."); cm->DefineProperty + ("LINK_DEPENDS_NO_SHARED", cmProperty::TARGET, + "Do not depend on linked shared library files.", + "Set this property to true to tell CMake generators not to add " + "file-level dependencies on the shared library files linked by " + "this target. " + "Modification to the shared libraries will not be sufficient to " + "re-link this target. " + "Logical target-level dependencies will not be affected so the " + "linked shared libraries will still be brought up to date before " + "this target is built." + "\n" + "This property is initialized by the value of the variable " + "CMAKE_LINK_DEPENDS_NO_SHARED if it is set when a target is " + "created."); + + cm->DefineProperty ("LINK_INTERFACE_LIBRARIES", cmProperty::TARGET, "List public interface libraries for a shared library or executable.", "By default linking to a shared library target transitively " @@ -1314,6 +1345,7 @@ void cmTarget::SetMakefile(cmMakefile* mf) this->SetPropertyDefault("OSX_ARCHITECTURES", 0); this->SetPropertyDefault("AUTOMOC", 0); this->SetPropertyDefault("AUTOMOC_MOC_OPTIONS", 0); + this->SetPropertyDefault("LINK_DEPENDS_NO_SHARED", 0); this->SetPropertyDefault("LINK_INTERFACE_LIBRARIES", 0); this->SetPropertyDefault("WIN32_EXECUTABLE", 0); this->SetPropertyDefault("MACOSX_BUNDLE", 0); diff --git a/Source/cmTargetLinkLibrariesCommand.h b/Source/cmTargetLinkLibrariesCommand.h index 63114d2..8e5823c 100644 --- a/Source/cmTargetLinkLibrariesCommand.h +++ b/Source/cmTargetLinkLibrariesCommand.h @@ -100,11 +100,11 @@ public: "to the LINK_INTERFACE_LIBRARIES and its per-configuration equivalent " "target properties instead of using them for linking. " "Libraries specified as \"debug\" are appended to the " - "the LINK_INTERFACE_LIBRARIES_DEBUG property (or to the properties " + "LINK_INTERFACE_LIBRARIES_DEBUG property (or to the properties " "corresponding to configurations listed in the DEBUG_CONFIGURATIONS " "global property if it is set). " "Libraries specified as \"optimized\" are appended to the " - "the LINK_INTERFACE_LIBRARIES property. " + "LINK_INTERFACE_LIBRARIES property. " "Libraries specified as \"general\" (or without any keyword) are " "treated as if specified for both \"debug\" and \"optimized\"." "\n" diff --git a/Source/cmTryRunCommand.h b/Source/cmTryRunCommand.h index 7878729..13b9973 100644 --- a/Source/cmTryRunCommand.h +++ b/Source/cmTryRunCommand.h @@ -81,7 +81,7 @@ public: "the executable, but it will not try to run the executable. Instead it " "will create cache variables which must be filled by the user or by " "presetting them in some CMake script file to the values the " - "executable would have produced if it would have been run on its actual " + "executable would have produced if it had been run on its actual " "target platform. These variables are RUN_RESULT_VAR (explanation see " "above) and if RUN_OUTPUT_VARIABLE (or OUTPUT_VARIABLE) was used, an " "additional cache variable " diff --git a/Source/cmVisualStudio10TargetGenerator.cxx b/Source/cmVisualStudio10TargetGenerator.cxx index def4133..d3b3950 100644 --- a/Source/cmVisualStudio10TargetGenerator.cxx +++ b/Source/cmVisualStudio10TargetGenerator.cxx @@ -404,6 +404,9 @@ void cmVisualStudio10TargetGenerator::WriteProjectConfigurationValues() case cmTarget::UTILITY: configType += "Utility"; break; + case cmTarget::GLOBAL_TARGET: + case cmTarget::UNKNOWN_LIBRARY: + break; } configType += "</ConfigurationType>\n"; this->WriteString(configType.c_str(), 2); @@ -425,8 +428,8 @@ void cmVisualStudio10TargetGenerator::WriteProjectConfigurationValues() mfcLine += useOfMfcValue + "</UseOfMfc>\n"; this->WriteString(mfcLine.c_str(), 2); - if(this->Target->GetType() <= cmTarget::OBJECT_LIBRARY && - this->ClOptions[*i]->UsingUnicode() || + if((this->Target->GetType() <= cmTarget::OBJECT_LIBRARY && + this->ClOptions[*i]->UsingUnicode()) || this->Target->GetPropertyAsBool("VS_WINRT_EXTENSIONS")) { this->WriteString("<CharacterSet>Unicode</CharacterSet>\n", 2); @@ -907,7 +910,6 @@ bool cmVisualStudio10TargetGenerator::OutputSourceSpecificFlags( cmSourceFile* source) { cmSourceFile& sf = *source; - cmLocalVisualStudio7Generator* lg = this->LocalGenerator; std::string objectName; if(this->GeneratorTarget->ExplicitObjectName.find(&sf) diff --git a/Source/cmWin32ProcessExecution.cxx b/Source/cmWin32ProcessExecution.cxx index 9a536c1..5752ab6 100644 --- a/Source/cmWin32ProcessExecution.cxx +++ b/Source/cmWin32ProcessExecution.cxx @@ -271,13 +271,6 @@ bool cmWin32ProcessExecution::Wait(int timeout) return this->PrivateClose(timeout); } -/* - * Internal dictionary mapping popen* file pointers to process handles, - * for use when retrieving the process exit code. See _PyPclose() below - * for more information on this dictionary's use. - */ -static void *_PyPopenProcs = NULL; - static BOOL RealPopenCreateProcess(const char *cmdstring, const char *path, const char *szConsoleSpawn, @@ -679,18 +672,6 @@ bool cmWin32ProcessExecution::PrivateOpen(const char *cmdstring, } } - /* - * Insert the files we've created into the process dictionary - * all referencing the list with the process handle and the - * initial number of files (see description below in _PyPclose). - * Since if _PyPclose later tried to wait on a process when all - * handles weren't closed, it could create a deadlock with the - * child, we spend some energy here to try to ensure that we - * either insert all file handles into the dictionary or none - * at all. It's a little clumsy with the various popen modes - * and variable number of files involved. - */ - /* Child is launched. Close the parents copy of those pipe * handles that only the child should have open. You need to * make sure that no handles to the write end of the output pipe @@ -761,43 +742,6 @@ cmWin32ProcessExecution::~cmWin32ProcessExecution() this->CloseHandles(); } -/* - * Wrapper for fclose() to use for popen* files, so we can retrieve the - * exit code for the child process and return as a result of the close. - * - * This function uses the _PyPopenProcs dictionary in order to map the - * input file pointer to information about the process that was - * originally created by the popen* call that created the file pointer. - * The dictionary uses the file pointer as a key (with one entry - * inserted for each file returned by the original popen* call) and a - * single list object as the value for all files from a single call. - * The list object contains the Win32 process handle at [0], and a file - * count at [1], which is initialized to the total number of file - * handles using that list. - * - * This function closes whichever handle it is passed, and decrements - * the file count in the dictionary for the process handle pointed to - * by this file. On the last close (when the file count reaches zero), - * this function will wait for the child process and then return its - * exit code as the result of the close() operation. This permits the - * files to be closed in any order - it is always the close() of the - * final handle that will return the exit code. - */ - - /* RED_FLAG 31-Aug-2000 Tim - * This is always called (today!) between a pair of - * Py_BEGIN_ALLOW_THREADS/ Py_END_ALLOW_THREADS - * macros. So the thread running this has no valid thread state, as - * far as Python is concerned. However, this calls some Python API - * functions that cannot be called safely without a valid thread - * state, in particular PyDict_GetItem. - * As a temporary hack (although it may last for years ...), we - * *rely* on not having a valid thread state in this function, in - * order to create our own "from scratch". - * This will deadlock if _PyPclose is ever called by a thread - * holding the global lock. - */ - bool cmWin32ProcessExecution::PrivateClose(int /* timeout */) { HANDLE hProcess = this->ProcessHandle; diff --git a/Source/cmake.cxx b/Source/cmake.cxx index 3a25605..7bc1411 100644 --- a/Source/cmake.cxx +++ b/Source/cmake.cxx @@ -63,15 +63,8 @@ # include "cmGlobalVisualStudio71Generator.h" # include "cmGlobalVisualStudio8Generator.h" # include "cmGlobalVisualStudio9Generator.h" -# include "cmGlobalVisualStudio9IA64Generator.h" -# include "cmGlobalVisualStudio9Win64Generator.h" # include "cmGlobalVisualStudio10Generator.h" -# include "cmGlobalVisualStudio10IA64Generator.h" -# include "cmGlobalVisualStudio10Win64Generator.h" # include "cmGlobalVisualStudio11Generator.h" -# include "cmGlobalVisualStudio11Win64Generator.h" -# include "cmGlobalVisualStudio11ARMGenerator.h" -# include "cmGlobalVisualStudio8Win64Generator.h" # include "cmGlobalBorlandMakefileGenerator.h" # include "cmGlobalNMakeMakefileGenerator.h" # include "cmGlobalJOMMakefileGenerator.h" @@ -223,6 +216,11 @@ cmake::~cmake() { delete (*j).second; } + for(RegisteredGeneratorsVector::iterator j = this->Generators.begin(); + j != this->Generators.end(); ++j) + { + delete *j; + } #ifdef CMAKE_BUILD_WITH_CMAKE delete this->VariableWatch; #endif @@ -1872,10 +1870,10 @@ void cmake::AddDefaultExtraGenerators() //---------------------------------------------------------------------------- void cmake::GetRegisteredGenerators(std::vector<std::string>& names) { - for(RegisteredGeneratorsMap::const_iterator i = this->Generators.begin(); + for(RegisteredGeneratorsVector::const_iterator i = this->Generators.begin(); i != this->Generators.end(); ++i) { - names.push_back(i->first); + (*i)->GetGenerators(names); } for(RegisteredExtraGeneratorsMap::const_iterator i = this->ExtraGenerators.begin(); @@ -1887,29 +1885,36 @@ void cmake::GetRegisteredGenerators(std::vector<std::string>& names) cmGlobalGenerator* cmake::CreateGlobalGenerator(const char* name) { - cmGlobalGenerator* generator = 0; cmExternalMakefileProjectGenerator* extraGenerator = 0; - RegisteredGeneratorsMap::const_iterator genIt = this->Generators.find(name); - if(genIt == this->Generators.end()) + RegisteredExtraGeneratorsMap::const_iterator extraGenIt = + this->ExtraGenerators.find(name); + if (extraGenIt != this->ExtraGenerators.end()) { - RegisteredExtraGeneratorsMap::const_iterator extraGenIt = - this->ExtraGenerators.find(name); - if (extraGenIt == this->ExtraGenerators.end()) - { - return 0; - } extraGenerator = (extraGenIt->second)(); - genIt=this->Generators.find(extraGenerator->GetGlobalGeneratorName(name)); - if(genIt == this->Generators.end()) + name = extraGenerator->GetGlobalGeneratorName(name); + } + + cmGlobalGenerator* generator = 0; + for (RegisteredGeneratorsVector::const_iterator i = + this->Generators.begin(); i != this->Generators.end(); ++i) + { + generator = (*i)->CreateGlobalGenerator(name); + if (generator) { - delete extraGenerator; - return 0; + break; } - } + } + + if (generator) + { + generator->SetCMakeInstance(this); + generator->SetExternalMakefileProjectGenerator(extraGenerator); + } + else + { + delete extraGenerator; + } - generator = (genIt->second)(); - generator->SetCMakeInstance(this); - generator->SetExternalMakefileProjectGenerator(extraGenerator); return generator; } @@ -2573,55 +2578,41 @@ void cmake::AddDefaultGenerators() { #if defined(_WIN32) && !defined(__CYGWIN__) # if !defined(CMAKE_BOOT_MINGW) - this->Generators[cmGlobalVisualStudio6Generator::GetActualName()] = - &cmGlobalVisualStudio6Generator::New; - this->Generators[cmGlobalVisualStudio7Generator::GetActualName()] = - &cmGlobalVisualStudio7Generator::New; - this->Generators[cmGlobalVisualStudio10Generator::GetActualName()] = - &cmGlobalVisualStudio10Generator::New; - this->Generators[cmGlobalVisualStudio10IA64Generator::GetActualName()] = - &cmGlobalVisualStudio10IA64Generator::New; - this->Generators[cmGlobalVisualStudio10Win64Generator::GetActualName()] = - &cmGlobalVisualStudio10Win64Generator::New; - this->Generators[cmGlobalVisualStudio11Generator::GetActualName()] = - &cmGlobalVisualStudio11Generator::New; - this->Generators[cmGlobalVisualStudio11Win64Generator::GetActualName()] = - &cmGlobalVisualStudio11Win64Generator::New; - this->Generators[cmGlobalVisualStudio11ARMGenerator::GetActualName()] = - &cmGlobalVisualStudio11ARMGenerator::New; - this->Generators[cmGlobalVisualStudio71Generator::GetActualName()] = - &cmGlobalVisualStudio71Generator::New; - this->Generators[cmGlobalVisualStudio8Generator::GetActualName()] = - &cmGlobalVisualStudio8Generator::New; - this->Generators[cmGlobalVisualStudio9Generator::GetActualName()] = - &cmGlobalVisualStudio9Generator::New; - this->Generators[cmGlobalVisualStudio9IA64Generator::GetActualName()] = - &cmGlobalVisualStudio9IA64Generator::New; - this->Generators[cmGlobalVisualStudio9Win64Generator::GetActualName()] = - &cmGlobalVisualStudio9Win64Generator::New; - this->Generators[cmGlobalVisualStudio8Win64Generator::GetActualName()] = - &cmGlobalVisualStudio8Win64Generator::New; - this->Generators[cmGlobalBorlandMakefileGenerator::GetActualName()] = - &cmGlobalBorlandMakefileGenerator::New; - this->Generators[cmGlobalNMakeMakefileGenerator::GetActualName()] = - &cmGlobalNMakeMakefileGenerator::New; - this->Generators[cmGlobalJOMMakefileGenerator::GetActualName()] = - &cmGlobalJOMMakefileGenerator::New; - this->Generators[cmGlobalWatcomWMakeGenerator::GetActualName()] = - &cmGlobalWatcomWMakeGenerator::New; + this->Generators.push_back( + cmGlobalVisualStudio6Generator::NewFactory()); + this->Generators.push_back( + cmGlobalVisualStudio7Generator::NewFactory()); + this->Generators.push_back( + cmGlobalVisualStudio10Generator::NewFactory()); + this->Generators.push_back( + cmGlobalVisualStudio11Generator::NewFactory()); + this->Generators.push_back( + cmGlobalVisualStudio71Generator::NewFactory()); + this->Generators.push_back( + cmGlobalVisualStudio8Generator::NewFactory()); + this->Generators.push_back( + cmGlobalVisualStudio9Generator::NewFactory()); + this->Generators.push_back( + cmGlobalBorlandMakefileGenerator::NewFactory()); + this->Generators.push_back( + cmGlobalNMakeMakefileGenerator::NewFactory()); + this->Generators.push_back( + cmGlobalJOMMakefileGenerator::NewFactory()); + this->Generators.push_back( + cmGlobalWatcomWMakeGenerator::NewFactory()); # endif - this->Generators[cmGlobalMSYSMakefileGenerator::GetActualName()] = - &cmGlobalMSYSMakefileGenerator::New; - this->Generators[cmGlobalMinGWMakefileGenerator::GetActualName()] = - &cmGlobalMinGWMakefileGenerator::New; + this->Generators.push_back( + cmGlobalMSYSMakefileGenerator::NewFactory()); + this->Generators.push_back( + cmGlobalMinGWMakefileGenerator::NewFactory()); #endif - this->Generators[cmGlobalUnixMakefileGenerator3::GetActualName()] = - &cmGlobalUnixMakefileGenerator3::New; - this->Generators[cmGlobalNinjaGenerator::GetActualName()] = - &cmGlobalNinjaGenerator::New; + this->Generators.push_back( + cmGlobalUnixMakefileGenerator3::NewFactory()); + this->Generators.push_back( + cmGlobalNinjaGenerator::NewFactory()); #ifdef CMAKE_USE_XCODE - this->Generators[cmGlobalXCodeGenerator::GetActualName()] = - &cmGlobalXCodeGenerator::New; + this->Generators.push_back( + cmGlobalXCodeGenerator::NewFactory()); #endif } @@ -2715,17 +2706,15 @@ void cmake::GetPropertiesDocumentation(std::map<std::string, void cmake::GetGeneratorDocumentation(std::vector<cmDocumentationEntry>& v) { - for(RegisteredGeneratorsMap::const_iterator i = this->Generators.begin(); - i != this->Generators.end(); ++i) + for(RegisteredGeneratorsVector::const_iterator i = + this->Generators.begin(); i != this->Generators.end(); ++i) { cmDocumentationEntry e; - cmGlobalGenerator* generator = (i->second)(); - generator->GetDocumentation(e); - delete generator; + (*i)->GetDocumentation(e); v.push_back(e); } - for(RegisteredExtraGeneratorsMap::const_iterator - i = this->ExtraGenerators.begin(); i != this->ExtraGenerators.end(); ++i) + for(RegisteredExtraGeneratorsMap::const_iterator i = + this->ExtraGenerators.begin(); i != this->ExtraGenerators.end(); ++i) { cmDocumentationEntry e; cmExternalMakefileProjectGenerator* generator = (i->second)(); diff --git a/Source/cmake.h b/Source/cmake.h index 94c6f12..79e05ca 100644 --- a/Source/cmake.h +++ b/Source/cmake.h @@ -17,6 +17,7 @@ #include "cmPropertyDefinitionMap.h" #include "cmPropertyMap.h" +class cmGlobalGeneratorFactory; class cmGlobalGenerator; class cmLocalGenerator; class cmCacheManager; @@ -396,12 +397,9 @@ protected: cmExternalMakefileProjectGenerator* (*CreateExtraGeneratorFunctionType)(); typedef std::map<cmStdString, CreateExtraGeneratorFunctionType> RegisteredExtraGeneratorsMap; - - typedef cmGlobalGenerator* (*CreateGeneratorFunctionType)(); - typedef std::map<cmStdString, - CreateGeneratorFunctionType> RegisteredGeneratorsMap; + typedef std::vector<cmGlobalGeneratorFactory*> RegisteredGeneratorsVector; RegisteredCommandsMap Commands; - RegisteredGeneratorsMap Generators; + RegisteredGeneratorsVector Generators; RegisteredExtraGeneratorsMap ExtraGenerators; void AddDefaultCommands(); void AddDefaultGenerators(); diff --git a/Source/cmcldeps.cxx b/Source/cmcldeps.cxx index 34350bf..04dab59 100644 --- a/Source/cmcldeps.cxx +++ b/Source/cmcldeps.cxx @@ -237,12 +237,14 @@ int main() { // needed to suppress filename output of msvc tools std::string srcfilename; + { std::string::size_type pos = srcfile.rfind("\\"); if (pos == std::string::npos) { srcfilename = srcfile; } else { srcfilename = srcfile.substr(pos + 1); } + } std::string nol = " /nologo "; std::string show = " /showIncludes "; @@ -266,10 +268,12 @@ int main() { // call cl in object dir so the .i is generated there std::string objdir; + { std::string::size_type pos = objfile.rfind("\\"); if (pos != std::string::npos) { objdir = objfile.substr(0, pos); } + } // extract dependencies with cl.exe int exit_code = process(srcfilename, dfile, objfile, diff --git a/Source/cmw9xcom.cxx b/Source/cmw9xcom.cxx index e6014b3..ab238d5 100644 --- a/Source/cmw9xcom.cxx +++ b/Source/cmw9xcom.cxx @@ -31,14 +31,14 @@ int main (int argc, char *argv[]) int cc; for ( cc = 2; cc < argc; cc ++ ) { - std::string arg = argv[cc]; - if ( (arg.find_first_of(" ") != arg.npos) && - (arg.find_first_of("\"") == arg.npos) ) + std::string nextArg = argv[cc]; + if ( (nextArg.find_first_of(" ") != nextArg.npos) && + (nextArg.find_first_of("\"") == nextArg.npos) ) { - arg = "\"" + arg + "\""; + nextArg = "\"" + nextArg + "\""; } command += " "; - command += arg; + command += nextArg; } return cmWin32ProcessExecution::Windows9xHack(command.c_str()); diff --git a/Source/kwsys/SystemInformation.cxx b/Source/kwsys/SystemInformation.cxx index 6b63b94..6d990a9 100644 --- a/Source/kwsys/SystemInformation.cxx +++ b/Source/kwsys/SystemInformation.cxx @@ -1323,7 +1323,7 @@ int SystemInformationImplementation::GetFullyQualifiedDomainName( for (ifa=ifas; ifa!=NULL; ifa=ifa->ifa_next) { - int fam=ifa->ifa_addr->sa_family; + int fam = ifa->ifa_addr? ifa->ifa_addr->sa_family : -1; if ((fam==AF_INET) || (fam==AF_INET6)) { char host[NI_MAXHOST]={'\0'}; |