summaryrefslogtreecommitdiff
path: root/Tests/FunctionTest/CMakeLists.txt
diff options
context:
space:
mode:
Diffstat (limited to 'Tests/FunctionTest/CMakeLists.txt')
-rw-r--r--Tests/FunctionTest/CMakeLists.txt152
1 files changed, 76 insertions, 76 deletions
diff --git a/Tests/FunctionTest/CMakeLists.txt b/Tests/FunctionTest/CMakeLists.txt
index 5d4f42d..d1fada4 100644
--- a/Tests/FunctionTest/CMakeLists.txt
+++ b/Tests/FunctionTest/CMakeLists.txt
@@ -1,66 +1,66 @@
# a simple C only test case
cmake_minimum_required (VERSION 2.6)
-PROJECT (FunctionTest)
+project (FunctionTest)
-FUNCTION(FAILED testname)
- MESSAGE(SEND_ERROR "${testname} failed ${ARGN}")
-ENDFUNCTION(FAILED)
+function(FAILED testname)
+ message(SEND_ERROR "${testname} failed ${ARGN}")
+endfunction()
-FUNCTION(PASS testname)
- MESSAGE("${testname} passed ${ARGN}")
-ENDFUNCTION(PASS)
+function(PASS testname)
+ message("${testname} passed ${ARGN}")
+endfunction()
# test scope
-SET(COUNT 3)
-FUNCTION(scope_test)
- SET(COUNT 4)
-ENDFUNCTION(scope_test)
+set(COUNT 3)
+function(scope_test)
+ set(COUNT 4)
+endfunction()
scope_test()
-IF(COUNT EQUAL "3")
+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")
+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")
+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,109 +68,109 @@ 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)
+function(strange_function m)
+ set("${m}" strange_function PARENT_SCOPE)
+endfunction()
STRANGE_FUNCTION(var)
set(second_var "second_var")
-IF("${var}" STREQUAL "strange_function" AND "${second_var}" STREQUAL "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)
+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)
+function(undef_var m)
+ set("${m}" PARENT_SCOPE)
+endfunction()
-SET(FUNCTION_UNDEFINED 1)
+set(FUNCTION_UNDEFINED 1)
undef_var(FUNCTION_UNDEFINED)
-IF(DEFINED 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)
+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)
-IF(DEFINED SUBDIR_DEFINED)
+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)
- ADD_SUBDIRECTORY("${dir}" "${dir}2")
+function(ADD_SUBDIR2 dir)
+ add_subdirectory("${dir}" "${dir}2")
# The parent scope sets in the subdir should be visible here.
- IF(DEFINED SUBDIR_UNDEFINED)
+ 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)
- IF(DEFINED SUBDIR_DEFINED)
+ 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)
-SET(SUBDIR_DEFINED)
+set(SUBDIR_UNDEFINED 1)
+set(SUBDIR_DEFINED)
# Run test function.
ADD_SUBDIR2(SubDirScope)
# The parent scope sets in the subdir should not be visible here.
-IF(DEFINED SUBDIR_UNDEFINED)
+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)
-IF(DEFINED SUBDIR_DEFINED)
+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)
+add_executable(FunctionTest functionTest.c)
# Use the PROJECT_LABEL property: in IDEs, the project label should appear
# in the UI rather than the target name. If this were a good test of the
# property rather than just a smoke test, it would verify that the label
# actually appears in the UI of the IDE... Or at least that the text appears
# somewhere in the generated project files.
-SET_PROPERTY(TARGET miniFunctionTest
+set_property(TARGET miniFunctionTest
PROPERTY PROJECT_LABEL "Test de Fonctionnement")