fix uninitialized var in if(NOT foo bar STREQUAL "foo bar")

Also adds test to verify this.
This commit is contained in:
Rolf Eike Beer 2012-01-20 18:27:26 +01:00
parent b8ff1c1e72
commit 54fd9e38bb
3 changed files with 11 additions and 0 deletions

View File

@ -910,6 +910,7 @@ bool cmIfCommand::IsTrue(const std::vector<std::string> &args,
if (newArgs.size() != 1)
{
errorString = "Unknown arguments specified";
status = cmake::FATAL_ERROR;
return false;
}

View File

@ -0,0 +1,2 @@
if (NOT foo bar STREQUAL "foo bar")
endif()

View File

@ -156,3 +156,11 @@ foreach(_bad 2x -2x)
endforeach()
test_vars("")
set(Invalid-Argument-RESULT 1)
set(Invalid-Argument-STDERR ".*CMake Error at (@CMAKE_CURRENT_SOURCE_DIR@/)?If-Invalid-Argument.cmake:1 \\(if\\):.*Unknown arguments specified.*")
include("@CMAKE_CURRENT_SOURCE_DIR@/CheckCMakeTest.cmake")
check_cmake_test(If
Invalid-Argument
)