diff options
Diffstat (limited to 'Source')
-rw-r--r-- | Source/CMakeVersion.cmake | 2 | ||||
-rw-r--r-- | Source/cmGlobalGenerator.cxx | 1 | ||||
-rw-r--r-- | Source/cmGlobalVisualStudio71Generator.cxx | 25 | ||||
-rw-r--r-- | Source/cmGlobalVisualStudio71Generator.h | 9 | ||||
-rw-r--r-- | Source/cmGlobalVisualStudio7Generator.cxx | 125 | ||||
-rw-r--r-- | Source/cmGlobalVisualStudio7Generator.h | 14 | ||||
-rw-r--r-- | Source/cmGlobalVisualStudio8Generator.cxx | 11 | ||||
-rw-r--r-- | Source/cmGlobalVisualStudio8Generator.h | 8 | ||||
-rw-r--r-- | Source/cmMakefile.cxx | 40 | ||||
-rw-r--r-- | Source/cmQtAutomoc.cxx | 18 | ||||
-rw-r--r-- | Source/cmSetTargetPropertiesCommand.h | 4 | ||||
-rw-r--r-- | Source/cmTarget.cxx | 15 |
12 files changed, 211 insertions, 61 deletions
diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake index a59c501..300abd7 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 20121117) +set(CMake_VERSION_TWEAK 20121120) #set(CMake_VERSION_RC 1) diff --git a/Source/cmGlobalGenerator.cxx b/Source/cmGlobalGenerator.cxx index ee7a9b3..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(); diff --git a/Source/cmGlobalVisualStudio71Generator.cxx b/Source/cmGlobalVisualStudio71Generator.cxx index 67aa8b1..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) { diff --git a/Source/cmGlobalVisualStudio71Generator.h b/Source/cmGlobalVisualStudio71Generator.h index dfbbe43..e9cab06 100644 --- a/Source/cmGlobalVisualStudio71Generator.h +++ b/Source/cmGlobalVisualStudio71Generator.h @@ -62,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 d02dca8..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"; } @@ -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 b59c0b1..9eb9687 100644 --- a/Source/cmGlobalVisualStudio7Generator.h +++ b/Source/cmGlobalVisualStudio7Generator.h @@ -107,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); @@ -138,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 7aad9b2..855727b 100644 --- a/Source/cmGlobalVisualStudio8Generator.cxx +++ b/Source/cmGlobalVisualStudio8Generator.cxx @@ -320,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(); @@ -332,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 7b8f254..f68bb9e 100644 --- a/Source/cmGlobalVisualStudio8Generator.h +++ b/Source/cmGlobalVisualStudio8Generator.h @@ -72,10 +72,10 @@ 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); 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/cmQtAutomoc.cxx b/Source/cmQtAutomoc.cxx index 942c7ab..9423208 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: 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/cmTarget.cxx b/Source/cmTarget.cxx index a81fa3e..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 " |