mirror of
https://github.com/Kitware/CMake.git
synced 2025-12-31 10:50:16 -06:00
get_filename_component: make errors fatal
Make all errors in `get_filename_component` fatal. Fixes: #20015
This commit is contained in:
@@ -14,6 +14,7 @@ bool cmGetFilenameComponentCommand(std::vector<std::string> const& args,
|
||||
{
|
||||
if (args.size() < 3) {
|
||||
status.SetError("called with incorrect number of arguments");
|
||||
cmSystemTools::SetFatalErrorOccured();
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -114,6 +115,7 @@ bool cmGetFilenameComponentCommand(std::vector<std::string> const& args,
|
||||
} else {
|
||||
std::string err = "unknown component " + args[2];
|
||||
status.SetError(err);
|
||||
cmSystemTools::SetFatalErrorOccured();
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1 @@
|
||||
1
|
||||
@@ -0,0 +1,4 @@
|
||||
^CMake Error at IncorrectArguments.cmake:1 \(get_filename_component\):
|
||||
get_filename_component called with incorrect number of arguments
|
||||
Call Stack \(most recent call first\):
|
||||
CMakeLists.txt:[0-9]+ \(include\)$
|
||||
@@ -0,0 +1,2 @@
|
||||
get_filename_component(var)
|
||||
message("The error is fatal, so this should not print")
|
||||
@@ -1,4 +1,5 @@
|
||||
include(RunCMake)
|
||||
|
||||
run_cmake(IncorrectArguments)
|
||||
run_cmake(KnownComponents)
|
||||
run_cmake(UnknownComponent)
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
CMake Error at UnknownComponent.cmake:1 \(get_filename_component\):
|
||||
^CMake Error at UnknownComponent.cmake:1 \(get_filename_component\):
|
||||
get_filename_component unknown component BOGUS
|
||||
Call Stack \(most recent call first\):
|
||||
CMakeLists.txt:[0-9]+ \(include\)
|
||||
CMakeLists.txt:[0-9]+ \(include\)$
|
||||
|
||||
@@ -1 +1,2 @@
|
||||
get_filename_component(var "/path/to/filename.ext.in" BOGUS)
|
||||
message("The error is fatal, so this should not print")
|
||||
|
||||
Reference in New Issue
Block a user