diff options
author | Kitware Robot <kwrobot@kitware.com> | 2012-08-13 17:50:14 (GMT) |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2012-08-13 18:19:16 (GMT) |
commit | 9db3116226cb99fcf54e936c833953abcde9b729 (patch) | |
tree | bd755ed9e616bbf1482a894bc7946980d81b7703 /Tests/FunctionTest | |
parent | 77543bde41b0e52c3959016698b529835945d62d (diff) | |
download | CMake-9db3116226cb99fcf54e936c833953abcde9b729.zip CMake-9db3116226cb99fcf54e936c833953abcde9b729.tar.gz CMake-9db3116226cb99fcf54e936c833953abcde9b729.tar.bz2 |
Remove CMake-language block-end command arguments
Ancient versions of CMake required else(), endif(), and similar block
termination commands to have arguments matching the command starting the
block. This is no longer the preferred style.
Run the following shell code:
for c in else endif endforeach endfunction endmacro endwhile; do
echo 's/\b'"$c"'\(\s*\)(.\+)/'"$c"'\1()/'
done >convert.sed &&
git ls-files -z -- bootstrap '*.cmake' '*.cmake.in' '*CMakeLists.txt' |
egrep -z -v '^(Utilities/cm|Source/kwsys/)' |
egrep -z -v 'Tests/CMakeTests/While-Endwhile-' |
xargs -0 sed -i -f convert.sed &&
rm convert.sed
Diffstat (limited to 'Tests/FunctionTest')
-rw-r--r-- | Tests/FunctionTest/CMakeLists.txt | 82 | ||||
-rw-r--r-- | Tests/FunctionTest/SubDirScope/CMakeLists.txt | 8 | ||||
-rw-r--r-- | Tests/FunctionTest/Util.cmake | 2 |
3 files changed, 46 insertions, 46 deletions
diff --git a/Tests/FunctionTest/CMakeLists.txt b/Tests/FunctionTest/CMakeLists.txt index 204a824..d1fada4 100644 --- a/Tests/FunctionTest/CMakeLists.txt +++ b/Tests/FunctionTest/CMakeLists.txt @@ -4,63 +4,63 @@ project (FunctionTest) function(FAILED testname) message(SEND_ERROR "${testname} failed ${ARGN}") -endfunction(FAILED) +endfunction() function(PASS testname) message("${testname} passed ${ARGN}") -endfunction(PASS) +endfunction() # test scope set(COUNT 3) function(scope_test) set(COUNT 4) -endfunction(scope_test) +endfunction() scope_test() if(COUNT EQUAL "3") PASS("scope") -else(COUNT EQUAL "3") +else() FAILED("COUNT Got: ${COUNT}") -endif(COUNT EQUAL "3") +endif() # test ARGC function(weird_name) if("${ARGC}" EQUAL "3") PASS("ARGC") - else("${ARGC}" EQUAL "3") + else() FAILED("ARGC" "Got: ${ARGC}") - endif("${ARGC}" EQUAL "3") -endfunction(weird_name) + endif() +endfunction() WeIrD_nAmE(a1 a2 a3) # test ARGN function(test_argn_function argument) if("${ARGN}" EQUAL "3") PASS("ARGN") - else("${ARGN}" EQUAL "3") + else() FAILED("ARGN" "Got: ${ARGN}") - endif("${ARGN}" EQUAL "3") -endfunction(test_argn_function) + endif() +endfunction() Test_Argn_Function(ignored 3) # test argument naming and raise scope function(track_find_variable cache_variable is_changed) set("${is_changed}" changed PARENT_SCOPE) -endfunction(track_find_variable) +endfunction() track_find_variable(testvar is_changed) if ("${is_changed}" STREQUAL changed) pass("same argument name test") -else ("${is_changed}" STREQUAL changed) +else () pass("same argument name test") -endif ("${is_changed}" STREQUAL changed) +endif () include("Util.cmake") tester() if (tester_res STREQUAL "${CMAKE_CURRENT_LIST_FILE}") pass("CMAKE_CURRENT_LIST_FILE test") -else (tester_res STREQUAL "${CMAKE_CURRENT_LIST_FILE}") +else () pass("CMAKE_CURRENT_LIST_FILE test") -endif (tester_res STREQUAL "${CMAKE_CURRENT_LIST_FILE}") +endif () @@ -68,67 +68,67 @@ endif (tester_res STREQUAL "${CMAKE_CURRENT_LIST_FILE}") function (factorial argument result) if (argument LESS 2) set (lresult 1) - else (argument LESS 2) + else () math (EXPR temp "${argument} - 1") factorial (${temp} tresult) math (EXPR lresult "${argument}*${tresult}") - endif (argument LESS 2) + endif () set ("${result}" "${lresult}" PARENT_SCOPE) -endfunction (factorial) +endfunction () factorial (5 fresult) if (fresult EQUAL 120) pass("factorial") -else (fresult EQUAL 120) +else () failed ("factorial, computed ${fresult} instead of 120") -endif (fresult EQUAL 120) +endif () # case test function(strange_function m) set("${m}" strange_function PARENT_SCOPE) -endfunction(strange_function m) +endfunction() STRANGE_FUNCTION(var) set(second_var "second_var") if("${var}" STREQUAL "strange_function" AND "${second_var}" STREQUAL "second_var") PASS("Case Test" "(${var} ${second_var})") -else("${var}" STREQUAL "strange_function" AND "${second_var}" STREQUAL "second_var") +else() FAILED("Case test" "(${var} ${second_var})") -endif("${var}" STREQUAL "strange_function" AND "${second_var}" STREQUAL "second_var") +endif() # test backing up command function(ADD_EXECUTABLE exec) _ADD_EXECUTABLE(mini${exec} ${ARGN}) -endfunction(ADD_EXECUTABLE) +endfunction() # var undef case function(undef_var m) set("${m}" PARENT_SCOPE) -endfunction(undef_var) +endfunction() set(FUNCTION_UNDEFINED 1) undef_var(FUNCTION_UNDEFINED) if(DEFINED FUNCTION_UNDEFINED) FAILED("Function Undefine Test" "(${FUNCTION_UNDEFINED})") -else(DEFINED FUNCTION_UNDEFINED) +else() PASS("Function Undefine Test" "(${FUNCTION_UNDEFINED})") -endif(DEFINED FUNCTION_UNDEFINED) +endif() # Subdirectory scope raise. set(SUBDIR_UNDEFINED 1) add_subdirectory(SubDirScope) if(DEFINED SUBDIR_UNDEFINED) FAILED("Subdir Undefine Test" "(${SUBDIR_UNDEFINED})") -else(DEFINED SUBDIR_UNDEFINED) +else() PASS("Subdir Undefine Test" "(${SUBDIR_UNDEFINED})") -endif(DEFINED SUBDIR_UNDEFINED) +endif() if(DEFINED SUBDIR_DEFINED) PASS("Subdir Define Test" "(${SUBDIR_DEFINED})") -else(DEFINED SUBDIR_DEFINED) +else() FAILED("Subdir Define Test" "(${SUBDIR_DEFINED})") -endif(DEFINED SUBDIR_DEFINED) +endif() # Test function-scoped directory. function(ADD_SUBDIR2 dir) @@ -136,15 +136,15 @@ function(ADD_SUBDIR2 dir) # The parent scope sets in the subdir should be visible here. if(DEFINED SUBDIR_UNDEFINED) FAILED("Subdir Function Undefine Test 1" "(${SUBDIR_UNDEFINED})") - else(DEFINED SUBDIR_UNDEFINED) + else() PASS("Subdir Function Undefine Test 1" "(${SUBDIR_UNDEFINED})") - endif(DEFINED SUBDIR_UNDEFINED) + endif() if(DEFINED SUBDIR_DEFINED) PASS("Subdir Function Define Test 1" "(${SUBDIR_DEFINED})") - else(DEFINED SUBDIR_DEFINED) + else() FAILED("Subdir Function Define Test 1" "(${SUBDIR_DEFINED})") - endif(DEFINED SUBDIR_DEFINED) -endfunction(ADD_SUBDIR2) + endif() +endfunction() # Reset test variables. set(SUBDIR_UNDEFINED 1) @@ -156,14 +156,14 @@ ADD_SUBDIR2(SubDirScope) # The parent scope sets in the subdir should not be visible here. if(DEFINED SUBDIR_UNDEFINED) PASS("Subdir Function Undefine Test 2" "(${SUBDIR_UNDEFINED})") -else(DEFINED SUBDIR_UNDEFINED) +else() FAILED("Subdir Function Undefine Test 2" "(${SUBDIR_UNDEFINED})") -endif(DEFINED SUBDIR_UNDEFINED) +endif() if(DEFINED SUBDIR_DEFINED) FAILED("Subdir Function Define Test 2" "(${SUBDIR_DEFINED})") -else(DEFINED SUBDIR_DEFINED) +else() PASS("Subdir Function Define Test 2" "(${SUBDIR_DEFINED})") -endif(DEFINED SUBDIR_DEFINED) +endif() add_executable(FunctionTest functionTest.c) diff --git a/Tests/FunctionTest/SubDirScope/CMakeLists.txt b/Tests/FunctionTest/SubDirScope/CMakeLists.txt index c40fadb..c1a3cfb 100644 --- a/Tests/FunctionTest/SubDirScope/CMakeLists.txt +++ b/Tests/FunctionTest/SubDirScope/CMakeLists.txt @@ -4,11 +4,11 @@ set(SUBDIR_UNDEFINED PARENT_SCOPE) # The above sets should not affect the current scope. if(DEFINED SUBDIR_UNDEFINED) PASS("SubdirScope Undefine Test" "(${SUBDIR_UNDEFINED})") -else(DEFINED SUBDIR_UNDEFINED) +else() FAILED("SubdirScope Undefine Test" "(${SUBDIR_UNDEFINED})") -endif(DEFINED SUBDIR_UNDEFINED) +endif() if(DEFINED SUBDIR_DEFINED) FAILED("SubdirScope Define Test" "(${SUBDIR_DEFINED})") -else(DEFINED SUBDIR_DEFINED) +else() PASS("SubdirScope Define Test" "(${SUBDIR_DEFINED})") -endif(DEFINED SUBDIR_DEFINED) +endif() diff --git a/Tests/FunctionTest/Util.cmake b/Tests/FunctionTest/Util.cmake index f0c73b5..846abd7 100644 --- a/Tests/FunctionTest/Util.cmake +++ b/Tests/FunctionTest/Util.cmake @@ -1,3 +1,3 @@ function(tester) set (tester_res "${CMAKE_CURRENT_LIST_FILE}" PARENT_SCOPE) -endfunction(tester) +endfunction() |