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.
This commit is contained in:
commit
02b993b1ca
|
@ -889,6 +889,10 @@ void cmExtraEclipseCDT4Generator::CreateCProjectFile() const
|
||||||
for (cmGeneratorTargetsType::iterator l = targets.begin();
|
for (cmGeneratorTargetsType::iterator l = targets.begin();
|
||||||
l != targets.end(); ++l)
|
l != targets.end(); ++l)
|
||||||
{
|
{
|
||||||
|
if (l->first->IsImported())
|
||||||
|
{
|
||||||
|
continue;
|
||||||
|
}
|
||||||
std::vector<std::string> includeDirs;
|
std::vector<std::string> includeDirs;
|
||||||
const char *config = mf->GetDefinition("CMAKE_BUILD_TYPE");
|
const char *config = mf->GetDefinition("CMAKE_BUILD_TYPE");
|
||||||
(*it)->GetIncludeDirectories(includeDirs, l->second, "C", config);
|
(*it)->GetIncludeDirectories(includeDirs, l->second, "C", config);
|
||||||
|
|
|
@ -277,8 +277,12 @@ static const struct TargetPropertyNode : public cmGeneratorExpressionNode
|
||||||
"$<TARGET_PROPERTY:...> expression requires one or two parameters");
|
"$<TARGET_PROPERTY:...> expression requires one or two parameters");
|
||||||
return std::string();
|
return std::string();
|
||||||
}
|
}
|
||||||
cmsys::RegularExpression nameValidator;
|
cmsys::RegularExpression targetNameValidator;
|
||||||
nameValidator.compile("^[A-Za-z0-9_.-]+$");
|
// 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;
|
cmGeneratorTarget* target = context->Target;
|
||||||
std::string propertyName = *parameters.begin();
|
std::string propertyName = *parameters.begin();
|
||||||
|
@ -301,9 +305,9 @@ static const struct TargetPropertyNode : public cmGeneratorExpressionNode
|
||||||
|
|
||||||
std::string targetName = parameters.front();
|
std::string targetName = parameters.front();
|
||||||
propertyName = parameters[1];
|
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(),
|
::reportError(context, content->GetOriginalExpression(),
|
||||||
"Target name and property name not supported.");
|
"Target name and property name not supported.");
|
||||||
|
@ -335,7 +339,7 @@ static const struct TargetPropertyNode : public cmGeneratorExpressionNode
|
||||||
return std::string();
|
return std::string();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!nameValidator.find(propertyName.c_str()))
|
if (!propertyNameValidator.find(propertyName.c_str()))
|
||||||
{
|
{
|
||||||
::reportError(context, content->GetOriginalExpression(),
|
::reportError(context, content->GetOriginalExpression(),
|
||||||
"Property name not supported.");
|
"Property name not supported.");
|
||||||
|
@ -480,7 +484,8 @@ struct TargetFilesystemArtifact : public cmGeneratorExpressionNode
|
||||||
std::string name = *parameters.begin();
|
std::string name = *parameters.begin();
|
||||||
|
|
||||||
cmsys::RegularExpression targetValidator;
|
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()))
|
if (!targetValidator.find(name.c_str()))
|
||||||
{
|
{
|
||||||
::reportError(context, content->GetOriginalExpression(),
|
::reportError(context, content->GetOriginalExpression(),
|
||||||
|
|
|
@ -1108,6 +1108,16 @@ void cmGlobalGenerator::CreateGeneratorTargets()
|
||||||
this->ComputeTargetObjects(gt);
|
this->ComputeTargetObjects(gt);
|
||||||
generatorTargets[t] = 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);
|
mf->SetGeneratorTargets(generatorTargets);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -745,6 +745,10 @@ void cmLocalGenerator
|
||||||
for(cmGeneratorTargetsType::iterator l = tgts.begin();
|
for(cmGeneratorTargetsType::iterator l = tgts.begin();
|
||||||
l != tgts.end(); l++)
|
l != tgts.end(); l++)
|
||||||
{
|
{
|
||||||
|
if (l->first->IsImported())
|
||||||
|
{
|
||||||
|
continue;
|
||||||
|
}
|
||||||
cmGeneratorTarget& target = *l->second;
|
cmGeneratorTarget& target = *l->second;
|
||||||
switch(target.GetType())
|
switch(target.GetType())
|
||||||
{
|
{
|
||||||
|
|
|
@ -519,6 +519,10 @@ public:
|
||||||
* Get the list of targets, const version
|
* Get the list of targets, const version
|
||||||
*/
|
*/
|
||||||
const cmTargets &GetTargets() const { return this->Targets; }
|
const cmTargets &GetTargets() const { return this->Targets; }
|
||||||
|
const std::vector<cmTarget*> &GetOwnedImportedTargets() const
|
||||||
|
{
|
||||||
|
return this->ImportedTargetsOwned;
|
||||||
|
}
|
||||||
|
|
||||||
const cmGeneratorTargetsType &GetGeneratorTargets() const
|
const cmGeneratorTargetsType &GetGeneratorTargets() const
|
||||||
{
|
{
|
||||||
|
|
|
@ -17,6 +17,7 @@ create_header(bing)
|
||||||
create_header(bung)
|
create_header(bung)
|
||||||
create_header(arguments)
|
create_header(arguments)
|
||||||
create_header(list)
|
create_header(list)
|
||||||
|
create_header(target)
|
||||||
|
|
||||||
set(CMAKE_INCLUDE_CURRENT_DIR ON)
|
set(CMAKE_INCLUDE_CURRENT_DIR ON)
|
||||||
|
|
||||||
|
@ -24,6 +25,7 @@ include_directories("${CMAKE_CURRENT_BINARY_DIR}/bar")
|
||||||
include_directories("$<1:${CMAKE_CURRENT_BINARY_DIR}/bang>")
|
include_directories("$<1:${CMAKE_CURRENT_BINARY_DIR}/bang>")
|
||||||
|
|
||||||
add_executable(TargetIncludeDirectories main.cpp)
|
add_executable(TargetIncludeDirectories main.cpp)
|
||||||
|
|
||||||
set_property(TARGET TargetIncludeDirectories APPEND PROPERTY INCLUDE_DIRECTORIES "${CMAKE_CURRENT_BINARY_DIR}/bat")
|
set_property(TARGET TargetIncludeDirectories APPEND PROPERTY INCLUDE_DIRECTORIES "${CMAKE_CURRENT_BINARY_DIR}/bat")
|
||||||
set_property(TARGET TargetIncludeDirectories APPEND PROPERTY INCLUDE_DIRECTORIES "${CMAKE_CURRENT_BINARY_DIR}/foo")
|
set_property(TARGET TargetIncludeDirectories APPEND PROPERTY INCLUDE_DIRECTORIES "${CMAKE_CURRENT_BINARY_DIR}/foo")
|
||||||
set_property(TARGET TargetIncludeDirectories APPEND PROPERTY
|
set_property(TARGET TargetIncludeDirectories APPEND PROPERTY
|
||||||
|
@ -34,3 +36,12 @@ include_directories("$<1:${CMAKE_CURRENT_BINARY_DIR}/bung>")
|
||||||
include_directories("sing$<1:/ting>")
|
include_directories("sing$<1:/ting>")
|
||||||
|
|
||||||
include_directories("$<1:${CMAKE_CURRENT_BINARY_DIR}/arguments;${CMAKE_CURRENT_BINARY_DIR}/list>")
|
include_directories("$<1:${CMAKE_CURRENT_BINARY_DIR}/arguments;${CMAKE_CURRENT_BINARY_DIR}/list>")
|
||||||
|
|
||||||
|
add_library(somelib::withcolons UNKNOWN IMPORTED)
|
||||||
|
set_property(TARGET somelib::withcolons PROPERTY IMPORTED_LOCATION "${CMAKE_CURRENT_BINARY_DIR}/target")
|
||||||
|
set_property(TARGET somelib::withcolons PROPERTY INTERFACE_INCLUDE_DIRECTORIES "${CMAKE_CURRENT_BINARY_DIR}/target")
|
||||||
|
|
||||||
|
set_property(TARGET TargetIncludeDirectories
|
||||||
|
APPEND PROPERTY INCLUDE_DIRECTORIES
|
||||||
|
"$<TARGET_PROPERTY:somelib::withcolons,INTERFACE_INCLUDE_DIRECTORIES>"
|
||||||
|
)
|
||||||
|
|
|
@ -9,6 +9,7 @@
|
||||||
#include "ting.h"
|
#include "ting.h"
|
||||||
#include "arguments.h"
|
#include "arguments.h"
|
||||||
#include "list.h"
|
#include "list.h"
|
||||||
|
#include "target.h"
|
||||||
|
|
||||||
int main(int, char**)
|
int main(int, char**)
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in New Issue