Merge topic 'fix-transitive-target-names'

1bdd167 Restore support for target names with '+' (#13986)
254687d Only process transitive interface properties for valid target names.
This commit is contained in:
Brad King 2013-03-12 13:46:40 -04:00 committed by CMake Topic Stage
commit 950541618c
4 changed files with 14 additions and 3 deletions

View File

@ -393,7 +393,7 @@ bool cmGeneratorExpression::IsValidTargetName(const std::string &input)
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_.:-]+$");
targetNameValidator.compile("^[A-Za-z0-9_.:+-]+$");
return targetNameValidator.find(input.c_str());
}

View File

@ -2898,7 +2898,8 @@ std::vector<std::string> cmTarget::GetIncludeDirectories(const char *config)
ge.Parse(it->Value);
std::string result = cge->Evaluate(this->Makefile, config,
false, this, 0, 0);
if (!this->Makefile->FindTargetToUse(result.c_str()))
if (!cmGeneratorExpression::IsValidTargetName(result.c_str())
|| !this->Makefile->FindTargetToUse(result.c_str()))
{
continue;
}
@ -2975,7 +2976,9 @@ std::string cmTarget::GetCompileDefinitions(const char *config)
for (std::vector<std::string>::const_iterator it = libs.begin();
it != libs.end(); ++it)
{
if (this->Makefile->FindTargetToUse(it->c_str()))
if ((cmGeneratorExpression::IsValidTargetName(it->c_str())
|| cmGeneratorExpression::Find(it->c_str()) != std::string::npos)
&& this->Makefile->FindTargetToUse(it->c_str()))
{
depString += sep + "$<TARGET_PROPERTY:"
+ *it + ",INTERFACE_COMPILE_DEFINITIONS>";

View File

@ -102,7 +102,14 @@ target_compile_definitions(depG INTERFACE
TEST_DEF
)
add_executable(targetC targetC.cpp)
if(NOT BORLAND AND NOT WATCOM)
# Linking to a target containing a + should be non-fatal, though it does
# not work at all on Borland or watcom
add_library(wrapc++ empty.cpp)
target_link_libraries(targetC wrapc++)
endif()
# The TARGET_PROPERTY expression is duplicated below to test that there is no
# shortcutting of the evaluation by returning an empty string.
set(_exe_test $<STREQUAL:$<TARGET_PROPERTY:TYPE>,EXECUTABLE>)

View File

@ -0,0 +1 @@
// No content