GenEx: Report actual target name not found, not "0" each time.

This commit is contained in:
Stephen Kelly 2012-10-04 00:32:39 +02:00 committed by Brad King
parent d70650d6c3
commit a4985a9af9
5 changed files with 18 additions and 2 deletions

View File

@ -278,14 +278,15 @@ static const struct TargetPropertyNode : public cmGeneratorExpressionNode
std::string propertyName = *parameters.begin();
if (parameters.size() == 2)
{
std::string targetName = parameters.front();
target = context->Makefile->FindGeneratorTargetToUse(
parameters.begin()->c_str());
targetName.c_str());
if (!target)
{
cmOStringStream e;
e << "Target \""
<< target
<< targetName
<< "\" not found.";
reportError(context, content->GetOriginalExpression(), e.str());
return std::string();

View File

@ -0,0 +1,6 @@
CMake Error:
Error evaluating generator expression:
\$<TARGET_PROPERTY:NonExistant,INCLUDE_DIRECTORIES>
Target "NonExistant" not found.$

View File

@ -0,0 +1,7 @@
file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/main.cpp"
"int main(int, char **) { return 0; }\n")
add_executable(TargetPropertyGeneratorExpressions
"${CMAKE_CURRENT_BINARY_DIR}/main.cpp")
include_directories("$<TARGET_PROPERTY:NonExistant,INCLUDE_DIRECTORIES>")

View File

@ -6,3 +6,4 @@ run_cmake(BadSelfReference3)
run_cmake(BadSelfReference4)
run_cmake(BadSelfReference5)
run_cmake(BadSelfReference6)
run_cmake(BadNonTarget)