added tests for var args with macros

This commit is contained in:
Ken Martin 2004-04-26 11:12:19 -04:00
parent 2d53fcf035
commit c63c23a617
6 changed files with 57 additions and 0 deletions

View File

@ -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
#

View File

@ -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

View File

@ -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
#

View File

@ -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

View File

@ -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
#

View File

@ -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