export: Reject custom target exports earlier (#15657)
Diagnose and reject custom targets given to the export() command immediately. Previously we would generate an internal error later.
This commit is contained in:
parent
3b09398ae2
commit
7e9f908ef5
|
@ -177,6 +177,12 @@ bool cmExportCommand
|
|||
this->SetError(e.str());
|
||||
return false;
|
||||
}
|
||||
if (target->GetType() == cmTarget::UTILITY)
|
||||
{
|
||||
this->SetError("given custom target \"" + *currentTarget
|
||||
+ "\" which may not be exported.");
|
||||
return false;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
|
@ -0,0 +1 @@
|
|||
1
|
|
@ -0,0 +1,4 @@
|
|||
^CMake Error at CustomTarget.cmake:[0-9]+ \(export\):
|
||||
export given custom target "CustomTarget" which may not be exported.
|
||||
Call Stack \(most recent call first\):
|
||||
CMakeLists.txt:3 \(include\)$
|
|
@ -0,0 +1,2 @@
|
|||
add_custom_target(CustomTarget)
|
||||
export(TARGETS CustomTarget FILE somefile.cmake)
|
|
@ -1,5 +1,6 @@
|
|||
include(RunCMake)
|
||||
|
||||
run_cmake(CustomTarget)
|
||||
run_cmake(TargetNotFound)
|
||||
run_cmake(AppendExport)
|
||||
run_cmake(OldIface)
|
||||
|
|
Loading…
Reference in New Issue