summaryrefslogtreecommitdiffstats
path: root/Source
diff options
context:
space:
mode:
Diffstat (limited to 'Source')
-rw-r--r--Source/CMakeVersion.cmake2
-rw-r--r--Source/cmGeneratorTarget.cxx93
-rw-r--r--Source/cmGeneratorTarget.h4
-rw-r--r--Source/cmGetFilenameComponentCommand.cxx20
-rw-r--r--Source/cmLocalVisualStudioGenerator.cxx4
5 files changed, 81 insertions, 42 deletions
diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake
index 54bbbbb..e2de794 100644
--- a/Source/CMakeVersion.cmake
+++ b/Source/CMakeVersion.cmake
@@ -1,5 +1,5 @@
# CMake version number components.
set(CMake_VERSION_MAJOR 3)
set(CMake_VERSION_MINOR 3)
-set(CMake_VERSION_PATCH 20150820)
+set(CMake_VERSION_PATCH 20150821)
#set(CMake_VERSION_RC 1)
diff --git a/Source/cmGeneratorTarget.cxx b/Source/cmGeneratorTarget.cxx
index 89c1922..1a7b843 100644
--- a/Source/cmGeneratorTarget.cxx
+++ b/Source/cmGeneratorTarget.cxx
@@ -270,48 +270,71 @@ const char *cmGeneratorTarget::GetProperty(const std::string& prop) const
std::string cmGeneratorTarget::GetOutputName(const std::string& config,
bool implib) const
{
- std::vector<std::string> props;
- std::string type = this->Target->GetOutputTargetType(implib);
- std::string configUpper = cmSystemTools::UpperCase(config);
- if(!type.empty() && !configUpper.empty())
- {
- // <ARCHIVE|LIBRARY|RUNTIME>_OUTPUT_NAME_<CONFIG>
- props.push_back(type + "_OUTPUT_NAME_" + configUpper);
- }
- if(!type.empty())
+ // Lookup/compute/cache the output name for this configuration.
+ OutputNameKey key(config, implib);
+ cmGeneratorTarget::OutputNameMapType::iterator i =
+ this->OutputNameMap.find(key);
+ if(i == this->OutputNameMap.end())
{
- // <ARCHIVE|LIBRARY|RUNTIME>_OUTPUT_NAME
- props.push_back(type + "_OUTPUT_NAME");
- }
- if(!configUpper.empty())
- {
- // OUTPUT_NAME_<CONFIG>
- props.push_back("OUTPUT_NAME_" + configUpper);
- // <CONFIG>_OUTPUT_NAME
- props.push_back(configUpper + "_OUTPUT_NAME");
- }
- // OUTPUT_NAME
- props.push_back("OUTPUT_NAME");
+ // Add empty name in map to detect potential recursion.
+ OutputNameMapType::value_type entry(key, "");
+ i = this->OutputNameMap.insert(entry).first;
- std::string outName;
- for(std::vector<std::string>::const_iterator i = props.begin();
- i != props.end(); ++i)
- {
- if (const char* outNameProp = this->Target->GetProperty(*i))
+ // Compute output name.
+ std::vector<std::string> props;
+ std::string type = this->Target->GetOutputTargetType(implib);
+ std::string configUpper = cmSystemTools::UpperCase(config);
+ if(!type.empty() && !configUpper.empty())
{
- outName = outNameProp;
- break;
+ // <ARCHIVE|LIBRARY|RUNTIME>_OUTPUT_NAME_<CONFIG>
+ props.push_back(type + "_OUTPUT_NAME_" + configUpper);
+ }
+ if(!type.empty())
+ {
+ // <ARCHIVE|LIBRARY|RUNTIME>_OUTPUT_NAME
+ props.push_back(type + "_OUTPUT_NAME");
+ }
+ if(!configUpper.empty())
+ {
+ // OUTPUT_NAME_<CONFIG>
+ props.push_back("OUTPUT_NAME_" + configUpper);
+ // <CONFIG>_OUTPUT_NAME
+ props.push_back(configUpper + "_OUTPUT_NAME");
+ }
+ // OUTPUT_NAME
+ props.push_back("OUTPUT_NAME");
+
+ std::string outName;
+ for(std::vector<std::string>::const_iterator it = props.begin();
+ it != props.end(); ++it)
+ {
+ if (const char* outNameProp = this->Target->GetProperty(*it))
+ {
+ outName = outNameProp;
+ break;
+ }
}
- }
- if (outName.empty())
+ if(outName.empty())
+ {
+ outName = this->GetName();
+ }
+
+ // Now evaluate genex and update the previously-prepared map entry.
+ cmGeneratorExpression ge;
+ cmsys::auto_ptr<cmCompiledGeneratorExpression> cge = ge.Parse(outName);
+ i->second = cge->Evaluate(this->Makefile, config);
+ }
+ else if(i->second.empty())
{
- outName = this->GetName();
+ // An empty map entry indicates we have been called recursively
+ // from the above block.
+ this->Makefile->GetCMakeInstance()->IssueMessage(
+ cmake::FATAL_ERROR,
+ "Target '" + this->GetName() + "' OUTPUT_NAME depends on itself.",
+ this->Target->GetBacktrace());
}
-
- cmGeneratorExpression ge;
- cmsys::auto_ptr<cmCompiledGeneratorExpression> cge = ge.Parse(outName);
- return cge->Evaluate(this->Makefile, config);
+ return i->second;
}
//----------------------------------------------------------------------------
diff --git a/Source/cmGeneratorTarget.h b/Source/cmGeneratorTarget.h
index 68e7a8a..15b3335 100644
--- a/Source/cmGeneratorTarget.h
+++ b/Source/cmGeneratorTarget.h
@@ -375,6 +375,10 @@ private:
};
mutable std::map<std::string, LinkImplClosure> LinkImplClosureMap;
+ typedef std::pair<std::string, bool> OutputNameKey;
+ typedef std::map<OutputNameKey, std::string> OutputNameMapType;
+ mutable OutputNameMapType OutputNameMap;
+
public:
std::vector<cmTarget const*> const&
GetLinkImplementationClosure(const std::string& config) const;
diff --git a/Source/cmGetFilenameComponentCommand.cxx b/Source/cmGetFilenameComponentCommand.cxx
index 13a9afb..0f56c8e 100644
--- a/Source/cmGetFilenameComponentCommand.cxx
+++ b/Source/cmGetFilenameComponentCommand.cxx
@@ -93,11 +93,23 @@ bool cmGetFilenameComponentCommand
else if (args[2] == "ABSOLUTE" ||
args[2] == "REALPATH")
{
+ // If the path given is relative, evaluate it relative to the
+ // current source directory unless the user passes a different
+ // base directory.
+ std::string baseDir = this->Makefile->GetCurrentSourceDirectory();
+ for(unsigned int i=3; i < args.size(); ++i)
+ {
+ if(args[i] == "BASE_DIR")
+ {
+ ++i;
+ if(i < args.size())
+ {
+ baseDir = args[i];
+ }
+ }
+ }
// Collapse the path to its simplest form.
- // If the path given is relative evaluate it relative to the
- // current source directory.
- result = cmSystemTools::CollapseFullPath(
- filename, this->Makefile->GetCurrentSourceDirectory());
+ result = cmSystemTools::CollapseFullPath(filename, baseDir);
if(args[2] == "REALPATH")
{
// Resolve symlinks if possible
diff --git a/Source/cmLocalVisualStudioGenerator.cxx b/Source/cmLocalVisualStudioGenerator.cxx
index ca72939..3588853 100644
--- a/Source/cmLocalVisualStudioGenerator.cxx
+++ b/Source/cmLocalVisualStudioGenerator.cxx
@@ -57,7 +57,7 @@ void cmLocalVisualStudioGenerator::ComputeObjectFilenames(
cmSourceFile const* sf = si->first;
std::string objectNameLower = cmSystemTools::LowerCase(
cmSystemTools::GetFilenameWithoutLastExtension(sf->GetFullPath()));
- objectNameLower += ".obj";
+ objectNameLower += this->GlobalGenerator->GetLanguageOutputExtension(*sf);
counts[objectNameLower] += 1;
}
@@ -70,7 +70,7 @@ void cmLocalVisualStudioGenerator::ComputeObjectFilenames(
cmSourceFile const* sf = si->first;
std::string objectName =
cmSystemTools::GetFilenameWithoutLastExtension(sf->GetFullPath());
- objectName += ".obj";
+ objectName += this->GlobalGenerator->GetLanguageOutputExtension(*sf);
if(counts[cmSystemTools::LowerCase(objectName)] > 1)
{
const_cast<cmGeneratorTarget*>(gt)->AddExplicitObjectName(sf);