diff options
author | David Cole <david.cole@kitware.com> | 2012-10-23 20:37:56 (GMT) |
---|---|---|
committer | CMake Topic Stage <kwrobot@kitware.com> | 2012-10-23 20:37:56 (GMT) |
commit | 02b993b1ca3fc569aca2af6b0cf7eb442b5b8e2a (patch) | |
tree | 7d40825ea78e1f731118cc75345b7d715549bf07 /Source | |
parent | 2b5635ee2327a41688a7ccfdf80a534a47268131 (diff) | |
parent | e386992152ac3ba5fe2abb66a56ea6ae99d6e8f3 (diff) | |
download | CMake-02b993b1ca3fc569aca2af6b0cf7eb442b5b8e2a.zip CMake-02b993b1ca3fc569aca2af6b0cf7eb442b5b8e2a.tar.gz CMake-02b993b1ca3fc569aca2af6b0cf7eb442b5b8e2a.tar.bz2 |
Merge topic 'genex-validate-target-property-names'
e386992 GexEx: Validate Target names and property names differently.
95d590d GenEx: Create cmGeneratorTargets for imported targets.
0442104 GenEx: Add an accessor for imported targets in a makefile.
Diffstat (limited to 'Source')
-rw-r--r-- | Source/cmExtraEclipseCDT4Generator.cxx | 4 | ||||
-rw-r--r-- | Source/cmGeneratorExpressionEvaluator.cxx | 17 | ||||
-rw-r--r-- | Source/cmGlobalGenerator.cxx | 10 | ||||
-rw-r--r-- | Source/cmLocalGenerator.cxx | 4 | ||||
-rw-r--r-- | Source/cmMakefile.h | 4 |
5 files changed, 33 insertions, 6 deletions
diff --git a/Source/cmExtraEclipseCDT4Generator.cxx b/Source/cmExtraEclipseCDT4Generator.cxx index 689f213..96b8a09 100644 --- a/Source/cmExtraEclipseCDT4Generator.cxx +++ b/Source/cmExtraEclipseCDT4Generator.cxx @@ -889,6 +889,10 @@ void cmExtraEclipseCDT4Generator::CreateCProjectFile() const for (cmGeneratorTargetsType::iterator l = targets.begin(); l != targets.end(); ++l) { + if (l->first->IsImported()) + { + continue; + } std::vector<std::string> includeDirs; const char *config = mf->GetDefinition("CMAKE_BUILD_TYPE"); (*it)->GetIncludeDirectories(includeDirs, l->second, "C", config); diff --git a/Source/cmGeneratorExpressionEvaluator.cxx b/Source/cmGeneratorExpressionEvaluator.cxx index 287066a..ee1b60a 100644 --- a/Source/cmGeneratorExpressionEvaluator.cxx +++ b/Source/cmGeneratorExpressionEvaluator.cxx @@ -277,8 +277,12 @@ static const struct TargetPropertyNode : public cmGeneratorExpressionNode "$<TARGET_PROPERTY:...> expression requires one or two parameters"); return std::string(); } - cmsys::RegularExpression nameValidator; - nameValidator.compile("^[A-Za-z0-9_.-]+$"); + cmsys::RegularExpression targetNameValidator; + // The ':' is supported to allow use with IMPORTED targets. At least + // Qt 4 and 5 IMPORTED targets use ':' as the namespace delimiter. + targetNameValidator.compile("^[A-Za-z0-9_.:-]+$"); + cmsys::RegularExpression propertyNameValidator; + propertyNameValidator.compile("^[A-Za-z0-9_]+$"); cmGeneratorTarget* target = context->Target; std::string propertyName = *parameters.begin(); @@ -301,9 +305,9 @@ static const struct TargetPropertyNode : public cmGeneratorExpressionNode std::string targetName = parameters.front(); propertyName = parameters[1]; - if (!nameValidator.find(targetName.c_str())) + if (!targetNameValidator.find(targetName.c_str())) { - if (!nameValidator.find(propertyName.c_str())) + if (!propertyNameValidator.find(propertyName.c_str())) { ::reportError(context, content->GetOriginalExpression(), "Target name and property name not supported."); @@ -335,7 +339,7 @@ static const struct TargetPropertyNode : public cmGeneratorExpressionNode return std::string(); } - if (!nameValidator.find(propertyName.c_str())) + if (!propertyNameValidator.find(propertyName.c_str())) { ::reportError(context, content->GetOriginalExpression(), "Property name not supported."); @@ -480,7 +484,8 @@ struct TargetFilesystemArtifact : public cmGeneratorExpressionNode std::string name = *parameters.begin(); cmsys::RegularExpression targetValidator; - targetValidator.compile("^[A-Za-z0-9_.-]+$"); + // The ':' is supported to allow use with IMPORTED targets. + targetValidator.compile("^[A-Za-z0-9_.:-]+$"); if (!targetValidator.find(name.c_str())) { ::reportError(context, content->GetOriginalExpression(), diff --git a/Source/cmGlobalGenerator.cxx b/Source/cmGlobalGenerator.cxx index 23ec08a..b9de4d8 100644 --- a/Source/cmGlobalGenerator.cxx +++ b/Source/cmGlobalGenerator.cxx @@ -1108,6 +1108,16 @@ void cmGlobalGenerator::CreateGeneratorTargets() this->ComputeTargetObjects(gt); generatorTargets[t] = gt; } + + for(std::vector<cmTarget*>::const_iterator + j = mf->GetOwnedImportedTargets().begin(); + j != mf->GetOwnedImportedTargets().end(); ++j) + { + cmGeneratorTarget* gt = new cmGeneratorTarget(*j); + this->GeneratorTargets[*j] = gt; + generatorTargets[*j] = gt; + } + mf->SetGeneratorTargets(generatorTargets); } } diff --git a/Source/cmLocalGenerator.cxx b/Source/cmLocalGenerator.cxx index 4f4f725..4952a8c 100644 --- a/Source/cmLocalGenerator.cxx +++ b/Source/cmLocalGenerator.cxx @@ -745,6 +745,10 @@ void cmLocalGenerator for(cmGeneratorTargetsType::iterator l = tgts.begin(); l != tgts.end(); l++) { + if (l->first->IsImported()) + { + continue; + } cmGeneratorTarget& target = *l->second; switch(target.GetType()) { diff --git a/Source/cmMakefile.h b/Source/cmMakefile.h index 80a50d6..70cfe54 100644 --- a/Source/cmMakefile.h +++ b/Source/cmMakefile.h @@ -519,6 +519,10 @@ public: * Get the list of targets, const version */ const cmTargets &GetTargets() const { return this->Targets; } + const std::vector<cmTarget*> &GetOwnedImportedTargets() const + { + return this->ImportedTargetsOwned; + } const cmGeneratorTargetsType &GetGeneratorTargets() const { |