mirror of
https://github.com/Kitware/CMake.git
synced 2025-10-14 02:08:27 +08:00
@@ -107,6 +107,12 @@ bool cmIfFunctionBlocker::Replay(std::vector<cmListFileFunction> functions,
|
||||
return true;
|
||||
}
|
||||
|
||||
if (func.Arguments().empty()) {
|
||||
mf.GetCMakeInstance()->IssueMessage(
|
||||
MessageType::AUTHOR_WARNING,
|
||||
"ELSEIF called with no arguments, it will be skipped. ", elseifBT);
|
||||
}
|
||||
|
||||
if (this->HasRun) {
|
||||
this->IsBlocking = true;
|
||||
} else {
|
||||
|
@@ -16,6 +16,7 @@ run_cmake(duplicate-deep-else)
|
||||
run_cmake(duplicate-else)
|
||||
run_cmake(duplicate-else-after-elseif)
|
||||
run_cmake(elseif-message)
|
||||
run_cmake(empty-elseif-warning)
|
||||
run_cmake(misplaced-elseif)
|
||||
|
||||
run_cmake(unbalanced-parenthesis)
|
||||
|
5
Tests/RunCMake/if/empty-elseif-warning-stderr.txt
Normal file
5
Tests/RunCMake/if/empty-elseif-warning-stderr.txt
Normal file
@@ -0,0 +1,5 @@
|
||||
CMake Warning \(dev\) at empty-elseif-warning.cmake:3 \(elseif\):
|
||||
ELSEIF called with no arguments, it will be skipped.
|
||||
Call Stack \(most recent call first\):
|
||||
CMakeLists.txt:3 \(include\)
|
||||
This warning is for project developers. Use -Wno-dev to suppress it.
|
4
Tests/RunCMake/if/empty-elseif-warning.cmake
Normal file
4
Tests/RunCMake/if/empty-elseif-warning.cmake
Normal file
@@ -0,0 +1,4 @@
|
||||
if(0)
|
||||
elseif(${emptyVar}) # okay
|
||||
elseif() # warns
|
||||
endif()
|
Reference in New Issue
Block a user