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/MacroTest | |
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/MacroTest')
-rw-r--r-- | Tests/MacroTest/CMakeLists.txt | 34 | ||||
-rw-r--r-- | Tests/MacroTest/context.cmake | 2 |
2 files changed, 18 insertions, 18 deletions
diff --git a/Tests/MacroTest/CMakeLists.txt b/Tests/MacroTest/CMakeLists.txt index 9d189b9..02bb31f 100644 --- a/Tests/MacroTest/CMakeLists.txt +++ b/Tests/MacroTest/CMakeLists.txt @@ -4,48 +4,48 @@ project (MacroTest) macro(FAILED testname) message(SEND_ERROR "${testname} failed ${ARGN}") -endmacro(FAILED) +endmacro() macro(PASS testname) message("${testname} passed ${ARGN}") -endmacro(PASS) +endmacro() # test ARGC macro(weird_name) if("${ARGC}" EQUAL "3") PASS("ARGC") - else("${ARGC}" EQUAL "3") + else() FAILED("ARGC" "Got: ${ARGC}") - endif("${ARGC}" EQUAL "3") -endmacro(weird_name) + endif() +endmacro() WeIrD_nAmE(a1 a2 a3) # test ARGN macro(test_argn_macro argument) if("${ARGN}" EQUAL "3") PASS("ARGN") - else("${ARGN}" EQUAL "3") + else() FAILED("ARGN" "Got: ${ARGN}") - endif("${ARGN}" EQUAL "3") -endmacro(test_argn_macro) + endif() +endmacro() Test_Argn_Macro(ignored 3) # case test macro(strange_macro m) set("${m}" strange_macro) -endmacro(strange_macro m) +endmacro() STRANGE_MACRO(var) set(second_var "second_var") if("${var}" STREQUAL "strange_macro" AND "${second_var}" STREQUAL "second_var") PASS("Case Test" "(${var} ${second_var})") -else("${var}" STREQUAL "strange_macro" AND "${second_var}" STREQUAL "second_var") +else() FAILED("Case test" "(${var} ${second_var})") -endif("${var}" STREQUAL "strange_macro" AND "${second_var}" STREQUAL "second_var") +endif() # test backing up command macro(ADD_EXECUTABLE exec) _ADD_EXECUTABLE("mini${exec}" ${ARGN}) -endmacro(ADD_EXECUTABLE) +endmacro() include(CheckCSourceCompiles) Check_C_Source_Compiles( @@ -64,9 +64,9 @@ int main(int ac, char*av[]){ SOME_CHECK) if(SOME_CHECK) message("CheckCSourceCompiles works") -else(SOME_CHECK) +else() message(FATAL_ERROR "CheckCSourceCompiles does not work") -endif(SOME_CHECK) +endif() include(CheckCXXSourceCompiles) Check_CXX_Source_Compiles( @@ -79,13 +79,13 @@ int main(int ac, char*av[]){ SOME_CHECK) if(SOME_CHECK) message("CheckCXXSourceCompiles works") -else(SOME_CHECK) +else() message(FATAL_ERROR "CheckCXXSourceCompiles does not work") -endif(SOME_CHECK) +endif() add_executable(MacroTest macroTest.c) macro(GET_CURRENT_FILE var) set(${var} ${CMAKE_CURRENT_LIST_FILE}) -endmacro(GET_CURRENT_FILE) +endmacro() include(context.cmake) diff --git a/Tests/MacroTest/context.cmake b/Tests/MacroTest/context.cmake index 82eb485..f7350d7 100644 --- a/Tests/MacroTest/context.cmake +++ b/Tests/MacroTest/context.cmake @@ -7,4 +7,4 @@ if(NOT "${current_file}" STREQUAL "${CMAKE_CURRENT_LIST_FILE}") " ${current_file}\n" "from the macro." ) -endif(NOT "${current_file}" STREQUAL "${CMAKE_CURRENT_LIST_FILE}") +endif() |