summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorStephen Kelly <steveire@gmail.com>2012-10-19 11:11:59 (GMT)
committerBrad King <brad.king@kitware.com>2012-10-22 18:05:48 (GMT)
commite386992152ac3ba5fe2abb66a56ea6ae99d6e8f3 (patch)
treea0bb84e1d490d88b2863baa9fa1011336ba9298f
parent95d590ddbac80780f437252de4522b78f4069f45 (diff)
downloadCMake-e386992152ac3ba5fe2abb66a56ea6ae99d6e8f3.zip
CMake-e386992152ac3ba5fe2abb66a56ea6ae99d6e8f3.tar.gz
CMake-e386992152ac3ba5fe2abb66a56ea6ae99d6e8f3.tar.bz2
GexEx: Validate Target names and property names differently.
In the unit test, use the same IMPORTED_LOCATION trick that the ExportImport test uses.
-rw-r--r--Source/cmGeneratorExpressionEvaluator.cxx17
-rw-r--r--Tests/IncludeDirectories/TargetIncludeDirectories/CMakeLists.txt11
-rw-r--r--Tests/IncludeDirectories/TargetIncludeDirectories/main.cpp1
3 files changed, 23 insertions, 6 deletions
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/Tests/IncludeDirectories/TargetIncludeDirectories/CMakeLists.txt b/Tests/IncludeDirectories/TargetIncludeDirectories/CMakeLists.txt
index d71f92e..7cb1b42 100644
--- a/Tests/IncludeDirectories/TargetIncludeDirectories/CMakeLists.txt
+++ b/Tests/IncludeDirectories/TargetIncludeDirectories/CMakeLists.txt
@@ -17,6 +17,7 @@ create_header(bing)
create_header(bung)
create_header(arguments)
create_header(list)
+create_header(target)
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>")
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}/foo")
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("$<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>"
+)
diff --git a/Tests/IncludeDirectories/TargetIncludeDirectories/main.cpp b/Tests/IncludeDirectories/TargetIncludeDirectories/main.cpp
index 030bb1c..90909d3 100644
--- a/Tests/IncludeDirectories/TargetIncludeDirectories/main.cpp
+++ b/Tests/IncludeDirectories/TargetIncludeDirectories/main.cpp
@@ -9,6 +9,7 @@
#include "ting.h"
#include "arguments.h"
#include "list.h"
+#include "target.h"
int main(int, char**)
{