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.
This commit is contained in:
parent
faa927e273
commit
9712362b45
|
@ -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)
|
||||
|
|
|
@ -0,0 +1 @@
|
|||
1
|
|
@ -0,0 +1,8 @@
|
|||
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\)
|
|
@ -0,0 +1,7 @@
|
|||
|
||||
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)
|
||||
|
|
|
@ -0,0 +1 @@
|
|||
// empty
|
Loading…
Reference in New Issue