1 # a simple C only test case
2 cmake_minimum_required (VERSION 2.6)
5 SET(CMAKE_C_FLAGS "${CMAKE_ANSI_CFLAGS} ${CMAKE_C_FLAGS}")
8 MESSAGE(SEND_ERROR "${testname} failed ${ARGN}")
12 MESSAGE("${testname} passed ${ARGN}")
17 IF("${ARGC}" EQUAL "3")
19 ELSE("${ARGC}" EQUAL "3")
20 FAILED("ARGC" "Got: ${ARGC}")
21 ENDIF("${ARGC}" EQUAL "3")
26 MACRO(test_argn_macro argument)
27 IF("${ARGN}" EQUAL "3")
29 ELSE("${ARGN}" EQUAL "3")
30 FAILED("ARGN" "Got: ${ARGN}")
31 ENDIF("${ARGN}" EQUAL "3")
32 ENDMACRO(test_argn_macro)
33 Test_Argn_Macro(ignored 3)
36 MACRO(strange_macro m)
37 SET("${m}" strange_macro)
38 ENDMACRO(strange_macro m)
40 set(second_var "second_var")
41 IF("${var}" STREQUAL "strange_macro" AND "${second_var}" STREQUAL "second_var")
42 PASS("Case Test" "(${var} ${second_var})")
43 ELSE("${var}" STREQUAL "strange_macro" AND "${second_var}" STREQUAL "second_var")
44 FAILED("Case test" "(${var} ${second_var})")
45 ENDIF("${var}" STREQUAL "strange_macro" AND "${second_var}" STREQUAL "second_var")
47 # test backing up command
48 MACRO(ADD_EXECUTABLE exec)
49 _ADD_EXECUTABLE("mini${exec}" ${ARGN})
50 ENDMACRO(ADD_EXECUTABLE)
52 INCLUDE(CheckCSourceCompiles)
53 Check_C_Source_Compiles(
61 int main(int ac, char*av[]){
63 if(ac > 1000){return *av[0];}
68 MESSAGE("CheckCSourceCompiles works")
70 MESSAGE(FATAL_ERROR "CheckCSourceCompiles does not work")
73 INCLUDE(CheckCXXSourceCompiles)
74 Check_CXX_Source_Compiles(
77 int main(int ac, char*av[]){
78 if(ac > 1000){return *av[0];}
83 MESSAGE("CheckCXXSourceCompiles works")
85 MESSAGE(FATAL_ERROR "CheckCXXSourceCompiles does not work")
88 ADD_EXECUTABLE(MacroTest macroTest.c)
90 MACRO(GET_CURRENT_FILE var)
91 SET(${var} ${CMAKE_CURRENT_LIST_FILE})
92 ENDMACRO(GET_CURRENT_FILE)
93 INCLUDE(context.cmake)