Merge topic 'cmake-cleanups'

07d44d63 cmake: Remove confusing duplication.
ea819b29 cmMakefile: Remove unused method.
6ad86c7f cmMakefile: Remove bad comment.
fca2b542 cmMakefile: Internalize setting of CMakeInstance on Properties.
7bb4e3db cmMakefile: Out-of-line Home directory accessors.
6241253a cmake: Out-of-line Home and Start directory methods.
0ee3ccb3 cmake: Fix variable name bugs.
57dd094e Use vector, not list for cmCommand storage.
6deb43e6 Remove some files which do not need to be in BootstrapCommands.
ecdb1b3b Add some missing includes.
04b307b9 cmake: Simplify CommandExists method.
0f1f324b cmake: Rename oddly named variables.
275185ac cmake: Constify GetCommand method.
c57f086a cmake: Don't lower-case a string needlessly.
23368c9b cmake: Use make_pair instead of Foo::value_type.
14c70b8c cmake: out-of-line try compile state methods.
...
This commit is contained in:
Brad King 2015-04-13 11:38:20 -04:00 committed by CMake Topic Stage
commit 92d6179893
20 changed files with 185 additions and 157 deletions

View File

@ -221,6 +221,8 @@ set(SRCS
cmExportSet.cxx cmExportSet.cxx
cmExportSetMap.h cmExportSetMap.h
cmExportSetMap.cxx cmExportSetMap.cxx
cmExternalMakefileProjectGenerator.cxx
cmExternalMakefileProjectGenerator.h
cmExtraCodeBlocksGenerator.cxx cmExtraCodeBlocksGenerator.cxx
cmExtraCodeBlocksGenerator.h cmExtraCodeBlocksGenerator.h
cmExtraCodeLiteGenerator.cxx cmExtraCodeLiteGenerator.cxx
@ -246,6 +248,8 @@ set(SRCS
cmGeneratorExpressionContext.h cmGeneratorExpressionContext.h
cmGeneratorExpressionDAGChecker.cxx cmGeneratorExpressionDAGChecker.cxx
cmGeneratorExpressionDAGChecker.h cmGeneratorExpressionDAGChecker.h
cmGeneratorExpressionEvaluationFile.cxx
cmGeneratorExpressionEvaluationFile.h
cmGeneratorExpressionEvaluator.cxx cmGeneratorExpressionEvaluator.cxx
cmGeneratorExpressionEvaluator.h cmGeneratorExpressionEvaluator.h
cmGeneratorExpressionLexer.cxx cmGeneratorExpressionLexer.cxx

View File

@ -42,7 +42,6 @@
#include "cmEndWhileCommand.cxx" #include "cmEndWhileCommand.cxx"
#include "cmExecProgramCommand.cxx" #include "cmExecProgramCommand.cxx"
#include "cmExecuteProcessCommand.cxx" #include "cmExecuteProcessCommand.cxx"
#include "cmExternalMakefileProjectGenerator.cxx"
#include "cmFindBase.cxx" #include "cmFindBase.cxx"
#include "cmFindCommon.cxx" #include "cmFindCommon.cxx"
#include "cmFileCommand.cxx" #include "cmFileCommand.cxx"
@ -56,7 +55,7 @@
#include "cmPathLabel.cxx" #include "cmPathLabel.cxx"
#include "cmSearchPath.cxx" #include "cmSearchPath.cxx"
void GetBootstrapCommands1(std::list<cmCommand*>& commands) void GetBootstrapCommands1(std::vector<cmCommand*>& commands)
{ {
commands.push_back(new cmAddCustomCommandCommand); commands.push_back(new cmAddCustomCommandCommand);
commands.push_back(new cmAddCustomTargetCommand); commands.push_back(new cmAddCustomTargetCommand);

View File

@ -16,7 +16,6 @@
#include "cmCommands.h" #include "cmCommands.h"
#include "cmConditionEvaluator.cxx" #include "cmConditionEvaluator.cxx"
#include "cmExpandedCommandArgument.cxx" #include "cmExpandedCommandArgument.cxx"
#include "cmGeneratorExpressionEvaluationFile.cxx"
#include "cmGetCMakePropertyCommand.cxx" #include "cmGetCMakePropertyCommand.cxx"
#include "cmGetDirectoryPropertyCommand.cxx" #include "cmGetDirectoryPropertyCommand.cxx"
#include "cmGetFilenameComponentCommand.cxx" #include "cmGetFilenameComponentCommand.cxx"
@ -60,7 +59,7 @@
#include "cmUnsetCommand.cxx" #include "cmUnsetCommand.cxx"
#include "cmWhileCommand.cxx" #include "cmWhileCommand.cxx"
void GetBootstrapCommands2(std::list<cmCommand*>& commands) void GetBootstrapCommands2(std::vector<cmCommand*>& commands)
{ {
commands.push_back(new cmGetCMakePropertyCommand); commands.push_back(new cmGetCMakePropertyCommand);
commands.push_back(new cmGetDirectoryPropertyCommand); commands.push_back(new cmGetDirectoryPropertyCommand);

View File

@ -13,7 +13,7 @@
@COMMAND_INCLUDES@ @COMMAND_INCLUDES@
void GetPredefinedCommands(std::list<cmCommand*>& commands) void GetPredefinedCommands(std::vector<cmCommand*>& commands)
{ {
@NEW_COMMANDS@ @NEW_COMMANDS@
} }

View File

@ -13,7 +13,7 @@
#define cmCommands_h #define cmCommands_h
#include "cmStandardIncludes.h" #include "cmStandardIncludes.h"
#include <list> #include <vector>
class cmCommand; class cmCommand;
/** /**
@ -23,9 +23,9 @@ class cmCommand;
* It is up to the caller to delete the commands created by this * It is up to the caller to delete the commands created by this
* call. * call.
*/ */
void GetBootstrapCommands1(std::list<cmCommand*>& commands); void GetBootstrapCommands1(std::vector<cmCommand*>& commands);
void GetBootstrapCommands2(std::list<cmCommand*>& commands); void GetBootstrapCommands2(std::vector<cmCommand*>& commands);
void GetPredefinedCommands(std::list<cmCommand*>& commands); void GetPredefinedCommands(std::vector<cmCommand*>& commands);
#endif #endif

View File

@ -11,6 +11,6 @@
============================================================================*/ ============================================================================*/
#include "cmCommands.h" #include "cmCommands.h"
void GetPredefinedCommands(std::list<cmCommand*>&) void GetPredefinedCommands(std::vector<cmCommand*>&)
{ {
} }

View File

@ -15,6 +15,8 @@
#include "cmHexFileConverter.h" #include "cmHexFileConverter.h"
#include "cmInstallType.h" #include "cmInstallType.h"
#include "cmFileTimeComparison.h" #include "cmFileTimeComparison.h"
#include "cmLocalGenerator.h"
#include "cmGlobalGenerator.h"
#include "cmCryptoHash.h" #include "cmCryptoHash.h"
#include "cmAlgorithms.h" #include "cmAlgorithms.h"

View File

@ -968,7 +968,13 @@ void cmGlobalGenerator::SetLanguageEnabled(const std::string& l,
void cmGlobalGenerator::SetLanguageEnabledFlag(const std::string& l, void cmGlobalGenerator::SetLanguageEnabledFlag(const std::string& l,
cmMakefile* mf) cmMakefile* mf)
{ {
this->LanguageEnabled[l] = true; std::vector<std::string>::iterator it =
std::lower_bound(this->LanguageEnabled.begin(),
this->LanguageEnabled.end(), l);
if (it == this->LanguageEnabled.end() || *it != l)
{
this->LanguageEnabled.insert(it, l);
}
// Fill the language-to-extension map with the current variable // Fill the language-to-extension map with the current variable
// settings to make sure it is available for the try_compile() // settings to make sure it is available for the try_compile()
@ -1079,7 +1085,8 @@ bool cmGlobalGenerator::IgnoreFile(const char* ext) const
bool cmGlobalGenerator::GetLanguageEnabled(const std::string& l) const bool cmGlobalGenerator::GetLanguageEnabled(const std::string& l) const
{ {
return (this->LanguageEnabled.find(l)!= this->LanguageEnabled.end()); return std::binary_search(this->LanguageEnabled.begin(),
this->LanguageEnabled.end(), l);
} }
void cmGlobalGenerator::ClearEnabledLanguages() void cmGlobalGenerator::ClearEnabledLanguages()
@ -1958,11 +1965,7 @@ bool cmGlobalGenerator::IsExcluded(cmLocalGenerator* root,
void void
cmGlobalGenerator::GetEnabledLanguages(std::vector<std::string>& lang) const cmGlobalGenerator::GetEnabledLanguages(std::vector<std::string>& lang) const
{ {
for(std::map<std::string, bool>::const_iterator i = lang = this->LanguageEnabled;
this->LanguageEnabled.begin(); i != this->LanguageEnabled.end(); ++i)
{
lang.push_back(i->first);
}
} }
int cmGlobalGenerator::GetLinkerPreference(const std::string& lang) const int cmGlobalGenerator::GetLinkerPreference(const std::string& lang) const

View File

@ -441,7 +441,7 @@ private:
// If you add a new map here, make sure it is copied // If you add a new map here, make sure it is copied
// in EnableLanguagesFromGenerator // in EnableLanguagesFromGenerator
std::map<std::string, bool> IgnoreExtensions; std::map<std::string, bool> IgnoreExtensions;
std::map<std::string, bool> LanguageEnabled; std::vector<std::string> LanguageEnabled;
std::set<std::string> LanguagesReady; // Ready for try_compile std::set<std::string> LanguagesReady; // Ready for try_compile
std::map<std::string, std::string> OutputExtensions; std::map<std::string, std::string> OutputExtensions;
std::map<std::string, std::string> LanguageToOutputExtension; std::map<std::string, std::string> LanguageToOutputExtension;

View File

@ -252,7 +252,6 @@ void cmLocalGenerator::SetGlobalGenerator(cmGlobalGenerator *gg)
this->Makefile->SetLocalGenerator(this); this->Makefile->SetLocalGenerator(this);
// setup the home directories // setup the home directories
this->Makefile->GetProperties().SetCMakeInstance(gg->GetCMakeInstance());
this->Makefile->SetHomeDirectory( this->Makefile->SetHomeDirectory(
gg->GetCMakeInstance()->GetHomeDirectory()); gg->GetCMakeInstance()->GetHomeDirectory());
this->Makefile->SetHomeOutputDirectory( this->Makefile->SetHomeOutputDirectory(

View File

@ -741,6 +741,7 @@ void cmMakefile::SetLocalGenerator(cmLocalGenerator* lg)
this->AddSourceGroup("Object Files", "\\.(lo|o|obj)$"); this->AddSourceGroup("Object Files", "\\.(lo|o|obj)$");
#endif #endif
this->Properties.SetCMakeInstance(this->GetCMakeInstance());
this->WarnUnused = this->GetCMakeInstance()->GetWarnUnused(); this->WarnUnused = this->GetCMakeInstance()->GetWarnUnused();
this->CheckSystemVars = this->GetCMakeInstance()->GetCheckSystemVars(); this->CheckSystemVars = this->GetCMakeInstance()->GetCheckSystemVars();
} }
@ -1657,7 +1658,6 @@ void cmMakefile::InitializeFromParent()
void cmMakefile::ConfigureSubDirectory(cmLocalGenerator *lg2) void cmMakefile::ConfigureSubDirectory(cmLocalGenerator *lg2)
{ {
// copy our variables from the child makefile
lg2->GetMakefile()->InitializeFromParent(); lg2->GetMakefile()->InitializeFromParent();
lg2->GetMakefile()->MakeStartDirectoriesCurrent(); lg2->GetMakefile()->MakeStartDirectoriesCurrent();
if (this->GetCMakeInstance()->GetDebugOutput()) if (this->GetCMakeInstance()->GetDebugOutput())
@ -1676,33 +1676,6 @@ void cmMakefile::ConfigureSubDirectory(cmLocalGenerator *lg2)
} }
} }
void cmMakefile::AddSubDirectory(const std::string& sub,
bool excludeFromAll)
{
// the source path must be made full if it isn't already
std::string srcPath = sub;
if (!cmSystemTools::FileIsFullPath(srcPath.c_str()))
{
srcPath = this->GetCurrentDirectory();
srcPath += "/";
srcPath += sub;
}
// binary path must be made full if it isn't already
std::string binPath = sub;
if (!cmSystemTools::FileIsFullPath(binPath.c_str()))
{
binPath = this->GetCurrentOutputDirectory();
binPath += "/";
binPath += sub;
}
this->AddSubDirectory(srcPath, binPath,
excludeFromAll, false);
}
void cmMakefile::AddSubDirectory(const std::string& srcPath, void cmMakefile::AddSubDirectory(const std::string& srcPath,
const std::string& binPath, const std::string& binPath,
bool excludeFromAll, bool excludeFromAll,
@ -3461,6 +3434,11 @@ cmMakefile::LexicalPushPop::~LexicalPushPop()
this->Makefile->PopFunctionBlockerBarrier(this->ReportError); this->Makefile->PopFunctionBlockerBarrier(this->ReportError);
} }
const char* cmMakefile::GetHomeDirectory() const
{
return this->cmHomeDirectory.c_str();
}
void cmMakefile::SetHomeDirectory(const std::string& dir) void cmMakefile::SetHomeDirectory(const std::string& dir)
{ {
this->cmHomeDirectory = dir; this->cmHomeDirectory = dir;
@ -3472,6 +3450,11 @@ void cmMakefile::SetHomeDirectory(const std::string& dir)
} }
} }
const char* cmMakefile::GetHomeOutputDirectory() const
{
return this->HomeOutputDirectory.c_str();
}
void cmMakefile::SetHomeOutputDirectory(const std::string& lib) void cmMakefile::SetHomeOutputDirectory(const std::string& lib)
{ {
this->HomeOutputDirectory = lib; this->HomeOutputDirectory = lib;

View File

@ -281,7 +281,6 @@ public:
/** /**
* Add a subdirectory to the build. * Add a subdirectory to the build.
*/ */
void AddSubDirectory(const std::string&, bool excludeFromAll=false);
void AddSubDirectory(const std::string& fullSrcDir, void AddSubDirectory(const std::string& fullSrcDir,
const std::string& fullBinDir, const std::string& fullBinDir,
bool excludeFromAll, bool excludeFromAll,
@ -438,15 +437,9 @@ public:
* and going up until it reaches the HomeDirectory. * and going up until it reaches the HomeDirectory.
*/ */
void SetHomeDirectory(const std::string& dir); void SetHomeDirectory(const std::string& dir);
const char* GetHomeDirectory() const const char* GetHomeDirectory() const;
{
return this->cmHomeDirectory.c_str();
}
void SetHomeOutputDirectory(const std::string& lib); void SetHomeOutputDirectory(const std::string& lib);
const char* GetHomeOutputDirectory() const const char* GetHomeOutputDirectory() const;
{
return this->HomeOutputDirectory.c_str();
}
//@} //@}
/** /**

View File

@ -1157,7 +1157,7 @@ cmTarget::LinkLibraryType cmTarget::ComputeLinkType(
} }
// Get the list of configurations considered to be DEBUG. // Get the list of configurations considered to be DEBUG.
std::vector<std::string> const& debugConfigs = std::vector<std::string> debugConfigs =
this->Makefile->GetCMakeInstance()->GetDebugConfigs(); this->Makefile->GetCMakeInstance()->GetDebugConfigs();
// Check if any entry in the list matches this configuration. // Check if any entry in the list matches this configuration.
@ -1216,7 +1216,7 @@ std::string cmTarget::GetDebugGeneratorExpressions(const std::string &value,
} }
// Get the list of configurations considered to be DEBUG. // Get the list of configurations considered to be DEBUG.
std::vector<std::string> const& debugConfigs = std::vector<std::string> debugConfigs =
this->Makefile->GetCMakeInstance()->GetDebugConfigs(); this->Makefile->GetCMakeInstance()->GetDebugConfigs();
std::string configString = "$<CONFIG:" + debugConfigs[0] + ">"; std::string configString = "$<CONFIG:" + debugConfigs[0] + ">";

View File

@ -467,7 +467,7 @@ cmTargetLinkLibrariesCommand::HandleLibrary(const std::string& lib,
} }
// Get the list of configurations considered to be DEBUG. // Get the list of configurations considered to be DEBUG.
std::vector<std::string> const& debugConfigs = std::vector<std::string> debugConfigs =
this->Makefile->GetCMakeInstance()->GetDebugConfigs(); this->Makefile->GetCMakeInstance()->GetDebugConfigs();
std::string prop; std::string prop;

View File

@ -187,7 +187,6 @@ cmake::~cmake()
void cmake::InitializeProperties() void cmake::InitializeProperties()
{ {
this->Properties.clear(); this->Properties.clear();
this->Properties.SetCMakeInstance(this);
this->PropertyDefinitions.clear(); this->PropertyDefinitions.clear();
// initialize properties // initialize properties
@ -223,20 +222,19 @@ void cmake::CleanupCommandsAndMacros()
bool cmake::CommandExists(const std::string& name) const bool cmake::CommandExists(const std::string& name) const
{ {
std::string sName = cmSystemTools::LowerCase(name); return this->GetCommand(name) ? true : false;
return (this->Commands.find(sName) != this->Commands.end());
} }
cmCommand *cmake::GetCommand(const std::string& name) cmCommand *cmake::GetCommand(const std::string& name) const
{ {
cmCommand* rm = 0; cmCommand* command = 0;
std::string sName = cmSystemTools::LowerCase(name); std::string sName = cmSystemTools::LowerCase(name);
RegisteredCommandsMap::iterator pos = this->Commands.find(sName); RegisteredCommandsMap::const_iterator pos = this->Commands.find(sName);
if (pos != this->Commands.end()) if (pos != this->Commands.end())
{ {
rm = (*pos).second; command = (*pos).second;
} }
return rm; return command;
} }
void cmake::RenameCommand(const std::string& oldName, void cmake::RenameCommand(const std::string& oldName,
@ -244,12 +242,12 @@ void cmake::RenameCommand(const std::string& oldName,
{ {
// if the command already exists, free the old one // if the command already exists, free the old one
std::string sOldName = cmSystemTools::LowerCase(oldName); std::string sOldName = cmSystemTools::LowerCase(oldName);
std::string sNewName = cmSystemTools::LowerCase(newName);
RegisteredCommandsMap::iterator pos = this->Commands.find(sOldName); RegisteredCommandsMap::iterator pos = this->Commands.find(sOldName);
if ( pos == this->Commands.end() ) if ( pos == this->Commands.end() )
{ {
return; return;
} }
std::string sNewName = cmSystemTools::LowerCase(newName);
cmCommand* cmd = pos->second; cmCommand* cmd = pos->second;
pos = this->Commands.find(sNewName); pos = this->Commands.find(sNewName);
@ -258,7 +256,7 @@ void cmake::RenameCommand(const std::string& oldName,
delete pos->second; delete pos->second;
this->Commands.erase(pos); this->Commands.erase(pos);
} }
this->Commands.insert(RegisteredCommandsMap::value_type(sNewName, cmd)); this->Commands.insert(std::make_pair(sNewName, cmd));
pos = this->Commands.find(sOldName); pos = this->Commands.find(sOldName);
this->Commands.erase(pos); this->Commands.erase(pos);
} }
@ -274,9 +272,9 @@ void cmake::RemoveCommand(const std::string& name)
} }
} }
void cmake::AddCommand(cmCommand* wg) void cmake::AddCommand(cmCommand* command)
{ {
std::string name = cmSystemTools::LowerCase(wg->GetName()); std::string name = cmSystemTools::LowerCase(command->GetName());
// if the command already exists, free the old one // if the command already exists, free the old one
RegisteredCommandsMap::iterator pos = this->Commands.find(name); RegisteredCommandsMap::iterator pos = this->Commands.find(name);
if (pos != this->Commands.end()) if (pos != this->Commands.end())
@ -284,16 +282,16 @@ void cmake::AddCommand(cmCommand* wg)
delete pos->second; delete pos->second;
this->Commands.erase(pos); this->Commands.erase(pos);
} }
this->Commands.insert( RegisteredCommandsMap::value_type(name, wg)); this->Commands.insert(std::make_pair(name, command));
} }
void cmake::RemoveUnscriptableCommands() void cmake::RemoveUnscriptableCommands()
{ {
std::vector<std::string> unscriptableCommands; std::vector<std::string> unscriptableCommands;
cmake::RegisteredCommandsMap* commands = this->GetCommands(); for (cmake::RegisteredCommandsMap::const_iterator
for (cmake::RegisteredCommandsMap::const_iterator pos = commands->begin(); pos = this->Commands.begin();
pos != commands->end(); pos != this->Commands.end();
++pos) ++pos)
{ {
if (!pos->second->IsScriptable()) if (!pos->second->IsScriptable())
@ -847,12 +845,8 @@ void cmake::SetArgs(const std::vector<std::string>& args,
{ {
this->SetHomeOutputDirectory this->SetHomeOutputDirectory
(cmSystemTools::GetCurrentWorkingDirectory()); (cmSystemTools::GetCurrentWorkingDirectory());
this->SetStartOutputDirectory
(cmSystemTools::GetCurrentWorkingDirectory());
this->SetHomeDirectory this->SetHomeDirectory
(cmSystemTools::GetCurrentWorkingDirectory()); (cmSystemTools::GetCurrentWorkingDirectory());
this->SetStartDirectory
(cmSystemTools::GetCurrentWorkingDirectory());
} }
this->SetStartDirectory(this->GetHomeDirectory()); this->SetStartDirectory(this->GetHomeDirectory());
@ -1116,12 +1110,44 @@ void cmake::SetHomeDirectory(const std::string& dir)
cmSystemTools::ConvertToUnixSlashes(this->cmHomeDirectory); cmSystemTools::ConvertToUnixSlashes(this->cmHomeDirectory);
} }
void cmake::SetHomeOutputDirectory(const std::string& lib) const char* cmake::GetHomeDirectory() const
{ {
this->HomeOutputDirectory = lib; return this->cmHomeDirectory.c_str();
}
void cmake::SetHomeOutputDirectory(const std::string& dir)
{
this->HomeOutputDirectory = dir;
cmSystemTools::ConvertToUnixSlashes(this->HomeOutputDirectory); cmSystemTools::ConvertToUnixSlashes(this->HomeOutputDirectory);
} }
const char* cmake::GetHomeOutputDirectory() const
{
return this->HomeOutputDirectory.c_str();
}
const char* cmake::GetStartDirectory() const
{
return this->cmStartDirectory.c_str();
}
void cmake::SetStartDirectory(const std::string& dir)
{
this->cmStartDirectory = dir;
cmSystemTools::ConvertToUnixSlashes(this->cmStartDirectory);
}
const char* cmake::GetStartOutputDirectory() const
{
return this->StartOutputDirectory.c_str();
}
void cmake::SetStartOutputDirectory(const std::string& dir)
{
this->StartOutputDirectory = dir;
cmSystemTools::ConvertToUnixSlashes(this->StartOutputDirectory);
}
void cmake::SetGlobalGenerator(cmGlobalGenerator *gg) void cmake::SetGlobalGenerator(cmGlobalGenerator *gg)
{ {
if(!gg) if(!gg)
@ -1533,11 +1559,7 @@ int cmake::ActualConfigure()
if (!this->InTryCompile) if (!this->InTryCompile)
{ {
this->GlobalGenerator->ClearEnabledLanguages(); this->GlobalGenerator->ClearEnabledLanguages();
}
// Truncate log files
if (!this->InTryCompile)
{
this->TruncateOutputLog("CMakeOutput.log"); this->TruncateOutputLog("CMakeOutput.log");
this->TruncateOutputLog("CMakeError.log"); this->TruncateOutputLog("CMakeError.log");
} }
@ -1812,11 +1834,11 @@ const char* cmake::GetCacheDefinition(const std::string& name) const
void cmake::AddDefaultCommands() void cmake::AddDefaultCommands()
{ {
std::list<cmCommand*> commands; std::vector<cmCommand*> commands;
GetBootstrapCommands1(commands); GetBootstrapCommands1(commands);
GetBootstrapCommands2(commands); GetBootstrapCommands2(commands);
GetPredefinedCommands(commands); GetPredefinedCommands(commands);
for(std::list<cmCommand*>::iterator i = commands.begin(); for(std::vector<cmCommand*>::iterator i = commands.begin();
i != commands.end(); ++i) i != commands.end(); ++i)
{ {
this->AddCommand(*i); this->AddCommand(*i);
@ -1942,6 +1964,16 @@ void cmake::UpdateProgress(const char *msg, float prog)
} }
} }
bool cmake::GetIsInTryCompile() const
{
return this->InTryCompile;
}
void cmake::SetIsInTryCompile(bool b)
{
this->InTryCompile = b;
}
void cmake::GetGeneratorDocumentation(std::vector<cmDocumentationEntry>& v) void cmake::GetGeneratorDocumentation(std::vector<cmDocumentationEntry>& v)
{ {
for(RegisteredGeneratorsVector::const_iterator i = for(RegisteredGeneratorsVector::const_iterator i =
@ -2298,24 +2330,12 @@ bool cmake::IsPropertyChained(const std::string& name,
void cmake::SetProperty(const std::string& prop, const char* value) void cmake::SetProperty(const std::string& prop, const char* value)
{ {
// Special hook to invalidate cached value.
if(prop == "DEBUG_CONFIGURATIONS")
{
this->DebugConfigs.clear();
}
this->Properties.SetProperty(prop, value, cmProperty::GLOBAL); this->Properties.SetProperty(prop, value, cmProperty::GLOBAL);
} }
void cmake::AppendProperty(const std::string& prop, void cmake::AppendProperty(const std::string& prop,
const char* value, bool asString) const char* value, bool asString)
{ {
// Special hook to invalidate cached value.
if(prop == "DEBUG_CONFIGURATIONS")
{
this->DebugConfigs.clear();
}
this->Properties.AppendProperty(prop, value, cmProperty::GLOBAL, asString); this->Properties.AppendProperty(prop, value, cmProperty::GLOBAL, asString);
} }
@ -2338,8 +2358,8 @@ const char *cmake::GetProperty(const std::string& prop,
else if ( prop == "COMMANDS" ) else if ( prop == "COMMANDS" )
{ {
cmake::RegisteredCommandsMap::iterator cmds cmake::RegisteredCommandsMap::iterator cmds
= this->GetCommands()->begin(); = this->Commands.begin();
for (unsigned int cc=0 ; cmds != this->GetCommands()->end(); ++ cmds ) for (unsigned int cc=0 ; cmds != this->Commands.end(); ++ cmds )
{ {
if ( cc > 0 ) if ( cc > 0 )
{ {
@ -2775,27 +2795,24 @@ void cmake::IssueMessage(cmake::MessageType t, std::string const& text,
} }
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
std::vector<std::string> const& cmake::GetDebugConfigs() std::vector<std::string> cmake::GetDebugConfigs()
{
// Compute on-demand.
if(this->DebugConfigs.empty())
{ {
std::vector<std::string> configs;
if(const char* config_list = this->GetProperty("DEBUG_CONFIGURATIONS")) if(const char* config_list = this->GetProperty("DEBUG_CONFIGURATIONS"))
{ {
// Expand the specified list and convert to upper-case. // Expand the specified list and convert to upper-case.
cmSystemTools::ExpandListArgument(config_list, this->DebugConfigs); cmSystemTools::ExpandListArgument(config_list, configs);
std::transform(this->DebugConfigs.begin(), std::transform(configs.begin(),
this->DebugConfigs.end(), configs.end(),
this->DebugConfigs.begin(), configs.begin(),
cmSystemTools::UpperCase); cmSystemTools::UpperCase);
} }
// If no configurations were specified, use a default list. // If no configurations were specified, use a default list.
if(this->DebugConfigs.empty()) if(configs.empty())
{ {
this->DebugConfigs.push_back("DEBUG"); configs.push_back("DEBUG");
} }
} return configs;
return this->DebugConfigs;
} }

View File

@ -113,15 +113,9 @@ class cmake
* and going up until it reaches the HomeDirectory. * and going up until it reaches the HomeDirectory.
*/ */
void SetHomeDirectory(const std::string& dir); void SetHomeDirectory(const std::string& dir);
const char* GetHomeDirectory() const const char* GetHomeDirectory() const;
{ void SetHomeOutputDirectory(const std::string& dir);
return this->cmHomeDirectory.c_str(); const char* GetHomeOutputDirectory() const;
}
void SetHomeOutputDirectory(const std::string& lib);
const char* GetHomeOutputDirectory() const
{
return this->HomeOutputDirectory.c_str();
}
//@} //@}
//@{ //@{
@ -132,24 +126,10 @@ class cmake
* recursing up the tree starting at the StartDirectory and going up until * recursing up the tree starting at the StartDirectory and going up until
* it reaches the HomeDirectory. * it reaches the HomeDirectory.
*/ */
void SetStartDirectory(const std::string& dir) void SetStartDirectory(const std::string& dir);
{ const char* GetStartDirectory() const;
this->cmStartDirectory = dir; void SetStartOutputDirectory(const std::string& dir);
cmSystemTools::ConvertToUnixSlashes(this->cmStartDirectory); const char* GetStartOutputDirectory() const;
}
const char* GetStartDirectory() const
{
return this->cmStartDirectory.c_str();
}
void SetStartOutputDirectory(const std::string& lib)
{
this->StartOutputDirectory = lib;
cmSystemTools::ConvertToUnixSlashes(this->StartOutputDirectory);
}
const char* GetStartOutputDirectory() const
{
return this->StartOutputDirectory.c_str();
}
//@} //@}
/** /**
@ -247,10 +227,7 @@ class cmake
/** /**
* Get a command by its name * Get a command by its name
*/ */
cmCommand *GetCommand(const std::string& name); cmCommand *GetCommand(const std::string& name) const;
/** Get list of all commands */
RegisteredCommandsMap* GetCommands() { return &this->Commands; }
/** Check if a command exists. */ /** Check if a command exists. */
bool CommandExists(const std::string& name) const; bool CommandExists(const std::string& name) const;
@ -260,10 +237,8 @@ class cmake
bool directoriesSetBefore = false); bool directoriesSetBefore = false);
///! Is this cmake running as a result of a TRY_COMPILE command ///! Is this cmake running as a result of a TRY_COMPILE command
bool GetIsInTryCompile() { return this->InTryCompile; } bool GetIsInTryCompile() const;
void SetIsInTryCompile(bool b);
///! Is this cmake running as a result of a TRY_COMPILE command
void SetIsInTryCompile(bool i) { this->InTryCompile = i; }
///! Parse command line arguments that might set cache values ///! Parse command line arguments that might set cache values
bool SetCacheArgs(const std::vector<std::string>&); bool SetCacheArgs(const std::vector<std::string>&);
@ -362,7 +337,7 @@ class cmake
/** Get the list of configurations (in upper case) considered to be /** Get the list of configurations (in upper case) considered to be
debugging configurations.*/ debugging configurations.*/
std::vector<std::string> const& GetDebugConfigs(); std::vector<std::string> GetDebugConfigs();
void SetCMakeEditCommand(std::string const& s) void SetCMakeEditCommand(std::string const& s)
{ this->CMakeEditCommand = s; } { this->CMakeEditCommand = s; }
@ -472,7 +447,6 @@ private:
bool DebugTryCompile; bool DebugTryCompile;
cmFileTimeComparison* FileComparison; cmFileTimeComparison* FileComparison;
std::string GraphVizFile; std::string GraphVizFile;
std::vector<std::string> DebugConfigs;
InstalledFilesMap InstalledFiles; InstalledFilesMap InstalledFiles;
void UpdateConversionPathTable(); void UpdateConversionPathTable();

View File

@ -0,0 +1,11 @@
CONFIGS:
IFACE1:\$<\$<CONFIG:DEBUG>:external1>
CONFIGS:EXTRA
IFACE1:\$<\$<CONFIG:DEBUG>:external1>
IFACE1:\$<\$<CONFIG:DEBUG>:external1>;\$<\$<CONFIG:EXTRA>:external2>
CONFIGS:NEW;CONFIGS
IFACE1:\$<\$<CONFIG:DEBUG>:external1>;\$<\$<CONFIG:EXTRA>:external2>
IFACE1:\$<\$<CONFIG:DEBUG>:external1>;\$<\$<CONFIG:EXTRA>:external2>;\$<\$<OR:\$<CONFIG:NEW>,\$<CONFIG:CONFIGS>>:external3>
CONFIGS:NEW;CONFIGS;EXTRA
IFACE1:\$<\$<CONFIG:DEBUG>:external1>;\$<\$<CONFIG:EXTRA>:external2>;\$<\$<OR:\$<CONFIG:NEW>,\$<CONFIG:CONFIGS>>:external3>
IFACE1:\$<\$<CONFIG:DEBUG>:external1>;\$<\$<CONFIG:EXTRA>:external2>;\$<\$<OR:\$<CONFIG:NEW>,\$<CONFIG:CONFIGS>>:external3>;\$<\$<OR:\$<CONFIG:NEW>,\$<CONFIG:CONFIGS>,\$<CONFIG:EXTRA>>:external4>

View File

@ -0,0 +1,41 @@
enable_language(CXX)
get_property(configs GLOBAL PROPERTY DEBUG_CONFIGURATIONS)
message("CONFIGS:${configs}")
add_library(iface1 INTERFACE)
target_link_libraries(iface1 INTERFACE debug external1)
get_property(tgt_iface TARGET iface1 PROPERTY INTERFACE_LINK_LIBRARIES)
message("IFACE1:${tgt_iface}")
set_property(GLOBAL APPEND PROPERTY DEBUG_CONFIGURATIONS EXTRA)
get_property(configs GLOBAL PROPERTY DEBUG_CONFIGURATIONS)
message("CONFIGS:${configs}")
get_property(tgt_iface TARGET iface1 PROPERTY INTERFACE_LINK_LIBRARIES)
message("IFACE1:${tgt_iface}")
target_link_libraries(iface1 INTERFACE debug external2)
get_property(tgt_iface TARGET iface1 PROPERTY INTERFACE_LINK_LIBRARIES)
message("IFACE1:${tgt_iface}")
set_property(GLOBAL PROPERTY DEBUG_CONFIGURATIONS NEW CONFIGS)
get_property(configs GLOBAL PROPERTY DEBUG_CONFIGURATIONS)
message("CONFIGS:${configs}")
get_property(tgt_iface TARGET iface1 PROPERTY INTERFACE_LINK_LIBRARIES)
message("IFACE1:${tgt_iface}")
target_link_libraries(iface1 INTERFACE debug external3)
get_property(tgt_iface TARGET iface1 PROPERTY INTERFACE_LINK_LIBRARIES)
message("IFACE1:${tgt_iface}")
set_property(GLOBAL APPEND PROPERTY DEBUG_CONFIGURATIONS EXTRA)
get_property(configs GLOBAL PROPERTY DEBUG_CONFIGURATIONS)
message("CONFIGS:${configs}")
get_property(tgt_iface TARGET iface1 PROPERTY INTERFACE_LINK_LIBRARIES)
message("IFACE1:${tgt_iface}")
target_link_libraries(iface1 INTERFACE debug external4)
get_property(tgt_iface TARGET iface1 PROPERTY INTERFACE_LINK_LIBRARIES)
message("IFACE1:${tgt_iface}")

View File

@ -7,3 +7,4 @@ run_cmake(install_properties)
run_cmake(source_properties) run_cmake(source_properties)
run_cmake(target_properties) run_cmake(target_properties)
run_cmake(test_properties) run_cmake(test_properties)
run_cmake(DebugConfigurations)

View File

@ -264,7 +264,8 @@ CMAKE_CXX_SOURCES="\
cmExportTryCompileFileGenerator \ cmExportTryCompileFileGenerator \
cmExportSet \ cmExportSet \
cmExportSetMap \ cmExportSetMap \
cmInstallDirectoryGenerator \ cmExternalMakefileProjectGenerator \
cmGeneratorExpressionEvaluationFile \
cmGeneratedFileStream \ cmGeneratedFileStream \
cmGeneratorTarget \ cmGeneratorTarget \
cmGeneratorExpressionContext \ cmGeneratorExpressionContext \
@ -275,6 +276,7 @@ CMAKE_CXX_SOURCES="\
cmGeneratorExpressionParser \ cmGeneratorExpressionParser \
cmGeneratorExpression \ cmGeneratorExpression \
cmGlobalGenerator \ cmGlobalGenerator \
cmInstallDirectoryGenerator \
cmLocalGenerator \ cmLocalGenerator \
cmInstalledFile \ cmInstalledFile \
cmInstallGenerator \ cmInstallGenerator \