Merge topic 'add_custom_command-no-INTERFACE-lib'
2600e923
Disallow INTERFACE libraries with add_custom_command(TARGET).
This commit is contained in:
commit
86b003c3c6
|
@ -264,7 +264,8 @@ void cmLocalGenerator::TraceDependencies()
|
|||
for(cmGeneratorTargetsType::iterator t = targets.begin();
|
||||
t != targets.end(); ++t)
|
||||
{
|
||||
if (t->second->Target->IsImported())
|
||||
if (t->second->Target->IsImported()
|
||||
|| t->second->Target->GetType() == cmTarget::INTERFACE_LIBRARY)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
|
|
@ -926,6 +926,14 @@ cmMakefile::AddCustomCommandToTarget(const std::string& target,
|
|||
this->IssueMessage(cmake::FATAL_ERROR, e.str());
|
||||
return;
|
||||
}
|
||||
if(ti->second.GetType() == cmTarget::INTERFACE_LIBRARY)
|
||||
{
|
||||
cmOStringStream e;
|
||||
e << "Target \"" << target << "\" is an INTERFACE library "
|
||||
"that may not have PRE_BUILD, PRE_LINK, or POST_BUILD commands.";
|
||||
this->IssueMessage(cmake::FATAL_ERROR, e.str());
|
||||
return;
|
||||
}
|
||||
// Add the command to the appropriate build step for the target.
|
||||
std::vector<std::string> no_output;
|
||||
cmCustomCommand cc(this, no_output, depends,
|
||||
|
|
|
@ -8,3 +8,4 @@ run_cmake(invalid_signature)
|
|||
run_cmake(global-interface)
|
||||
run_cmake(genex_link)
|
||||
run_cmake(add_dependencies)
|
||||
run_cmake(add_custom_command-TARGET)
|
||||
|
|
|
@ -0,0 +1 @@
|
|||
1
|
|
@ -0,0 +1,5 @@
|
|||
CMake Error at add_custom_command-TARGET.cmake:4 \(add_custom_command\):
|
||||
Target "iface" is an INTERFACE library that may not have PRE_BUILD,
|
||||
PRE_LINK, or POST_BUILD commands.
|
||||
Call Stack \(most recent call first\):
|
||||
CMakeLists.txt:3 \(include\)
|
|
@ -0,0 +1,6 @@
|
|||
|
||||
add_library(iface INTERFACE)
|
||||
|
||||
add_custom_command(TARGET iface
|
||||
COMMAND "${CMAKE_COMMAND}" -E echo test
|
||||
)
|
Loading…
Reference in New Issue