From c63c23a61759b178c04ac1c492beff131be9d41b Mon Sep 17 00:00:00 2001 From: Ken Martin Date: Mon, 26 Apr 2004 11:12:19 -0400 Subject: [PATCH] added tests for var args with macros --- Tests/Complex/CMakeLists.txt | 13 +++++++++++++ Tests/Complex/Executable/complex.cxx | 6 ++++++ Tests/ComplexOneConfig/CMakeLists.txt | 13 +++++++++++++ Tests/ComplexOneConfig/Executable/complex.cxx | 6 ++++++ Tests/ComplexRelativePaths/CMakeLists.txt | 13 +++++++++++++ Tests/ComplexRelativePaths/Executable/complex.cxx | 6 ++++++ 6 files changed, 57 insertions(+) diff --git a/Tests/Complex/CMakeLists.txt b/Tests/Complex/CMakeLists.txt index c93713e05..ef0ff8075 100644 --- a/Tests/Complex/CMakeLists.txt +++ b/Tests/Complex/CMakeLists.txt @@ -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 # diff --git a/Tests/Complex/Executable/complex.cxx b/Tests/Complex/Executable/complex.cxx index 7ad9997b5..5cbe51cf1 100644 --- a/Tests/Complex/Executable/complex.cxx +++ b/Tests/Complex/Executable/complex.cxx @@ -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 diff --git a/Tests/ComplexOneConfig/CMakeLists.txt b/Tests/ComplexOneConfig/CMakeLists.txt index c93713e05..ef0ff8075 100644 --- a/Tests/ComplexOneConfig/CMakeLists.txt +++ b/Tests/ComplexOneConfig/CMakeLists.txt @@ -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 # diff --git a/Tests/ComplexOneConfig/Executable/complex.cxx b/Tests/ComplexOneConfig/Executable/complex.cxx index 7ad9997b5..5cbe51cf1 100644 --- a/Tests/ComplexOneConfig/Executable/complex.cxx +++ b/Tests/ComplexOneConfig/Executable/complex.cxx @@ -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 diff --git a/Tests/ComplexRelativePaths/CMakeLists.txt b/Tests/ComplexRelativePaths/CMakeLists.txt index c93713e05..ef0ff8075 100644 --- a/Tests/ComplexRelativePaths/CMakeLists.txt +++ b/Tests/ComplexRelativePaths/CMakeLists.txt @@ -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 # diff --git a/Tests/ComplexRelativePaths/Executable/complex.cxx b/Tests/ComplexRelativePaths/Executable/complex.cxx index 7ad9997b5..5cbe51cf1 100644 --- a/Tests/ComplexRelativePaths/Executable/complex.cxx +++ b/Tests/ComplexRelativePaths/Executable/complex.cxx @@ -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