Commit c63c23a6 authored by Ken Martin's avatar Ken Martin

added tests for var args with macros

parent 2d53fcf0
......@@ -16,6 +16,19 @@ ENDMACRO(ASSERT)
# invoke the macro
ASSERT(Complex_BINARY_DIR "The PROJECT command is broken")
#
# Define a var args macro, it must take two or four args
#
MACRO(TEST_ARGC value1 value2)
ADD_DEFINITIONS(${value1} ${value2})
IF (${ARGC} MATCHES 4)
ADD_DEFINITIONS(${ARGV2} ${ARGV3})
ENDIF (${ARGC} MATCHES 4)
ENDMACRO(TEST_ARGC)
# invoke the macro
TEST_ARGC(-DCMAKE_ARGV1 -DCMAKE_ARGV2 -DCMAKE_ARGV3 -DCMAKE_ARGV4)
#
# Use the ansi CXX compile flag for building cmake
#
......
......@@ -194,6 +194,12 @@ int main()
cmPassed("CMAKE_IS_FUN is defined.");
#endif
#if defined(CMAKE_ARGV1) && defined(CMAKE_ARGV2) && defined(CMAKE_ARGV3) && defined(CMAKE_ARGV4)
cmPassed("Variable args for MACROs are working.");
#else
cmFailed("Variable args for MACROs are failing.");
#endif
// ----------------------------------------------------------------------
// Test SET, VARIABLE_REQUIRES
......
......@@ -16,6 +16,19 @@ ENDMACRO(ASSERT)
# invoke the macro
ASSERT(Complex_BINARY_DIR "The PROJECT command is broken")
#
# Define a var args macro, it must take two or four args
#
MACRO(TEST_ARGC value1 value2)
ADD_DEFINITIONS(${value1} ${value2})
IF (${ARGC} MATCHES 4)
ADD_DEFINITIONS(${ARGV2} ${ARGV3})
ENDIF (${ARGC} MATCHES 4)
ENDMACRO(TEST_ARGC)
# invoke the macro
TEST_ARGC(-DCMAKE_ARGV1 -DCMAKE_ARGV2 -DCMAKE_ARGV3 -DCMAKE_ARGV4)
#
# Use the ansi CXX compile flag for building cmake
#
......
......@@ -194,6 +194,12 @@ int main()
cmPassed("CMAKE_IS_FUN is defined.");
#endif
#if defined(CMAKE_ARGV1) && defined(CMAKE_ARGV2) && defined(CMAKE_ARGV3) && defined(CMAKE_ARGV4)
cmPassed("Variable args for MACROs are working.");
#else
cmFailed("Variable args for MACROs are failing.");
#endif
// ----------------------------------------------------------------------
// Test SET, VARIABLE_REQUIRES
......
......@@ -16,6 +16,19 @@ ENDMACRO(ASSERT)
# invoke the macro
ASSERT(Complex_BINARY_DIR "The PROJECT command is broken")
#
# Define a var args macro, it must take two or four args
#
MACRO(TEST_ARGC value1 value2)
ADD_DEFINITIONS(${value1} ${value2})
IF (${ARGC} MATCHES 4)
ADD_DEFINITIONS(${ARGV2} ${ARGV3})
ENDIF (${ARGC} MATCHES 4)
ENDMACRO(TEST_ARGC)
# invoke the macro
TEST_ARGC(-DCMAKE_ARGV1 -DCMAKE_ARGV2 -DCMAKE_ARGV3 -DCMAKE_ARGV4)
#
# Use the ansi CXX compile flag for building cmake
#
......
......@@ -194,6 +194,12 @@ int main()
cmPassed("CMAKE_IS_FUN is defined.");
#endif
#if defined(CMAKE_ARGV1) && defined(CMAKE_ARGV2) && defined(CMAKE_ARGV3) && defined(CMAKE_ARGV4)
cmPassed("Variable args for MACROs are working.");
#else
cmFailed("Variable args for MACROs are failing.");
#endif
// ----------------------------------------------------------------------
// Test SET, VARIABLE_REQUIRES
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment