Commit 9712362b authored by Stephen Kelly's avatar Stephen Kelly
Browse files

Don't allow utility or global targets in the LINKED expression.

The LINKED expression is exclusively for handling INTERFACE content
and it does not make sense for utility targets to have INTERFACE
content.
parent faa927e2
......@@ -702,6 +702,14 @@ private:
{
return std::string();
}
if(target->GetType() >= cmTarget::UTILITY &&
target->GetType() != cmTarget::UNKNOWN_LIBRARY)
{
::reportError(context, content->GetOriginalExpression(),
"Target \"" + item
+ "\" is not an executable or library.");
return std::string();
}
std::string propertyName = "INTERFACE_" + prop;
const char *propContent = target->GetProperty(propertyName.c_str());
if (!propContent)
......
CMake Error at BadLinked-UtilityTarget.cmake:7 \(set_property\):
Error evaluating generator expression:
\$<LINKED:check>
Target "check" is not an executable or library.
Call Stack \(most recent call first\):
CMakeLists.txt:8 \(include\)
add_custom_target(check ALL
COMMAND ${CMAKE_COMMAND} -E echo check
)
add_library(foo STATIC empty.cpp)
set_property(TARGET foo PROPERTY INCLUDE_DIRECTORIES $<LINKED:check>)
......@@ -16,3 +16,4 @@ run_cmake(BadInvalidName6)
run_cmake(BadInvalidName7)
run_cmake(BadInvalidName8)
run_cmake(BadLinked)
run_cmake(BadLinked-UtilityTarget)
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment