mirror of
https://github.com/reactos/CMake.git
synced 2024-11-25 12:40:06 +00:00
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
|
||||
{
|
||||
|
1
Tests/RunCMake/export/CustomTarget-result.txt
Normal file
1
Tests/RunCMake/export/CustomTarget-result.txt
Normal file
@ -0,0 +1 @@
|
||||
1
|
4
Tests/RunCMake/export/CustomTarget-stderr.txt
Normal file
4
Tests/RunCMake/export/CustomTarget-stderr.txt
Normal file
@ -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\)$
|
2
Tests/RunCMake/export/CustomTarget.cmake
Normal file
2
Tests/RunCMake/export/CustomTarget.cmake
Normal file
@ -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
Block a user