diff options
author | Ken Martin <ken.martin@kitware.com> | 2004-04-26 15:12:19 (GMT) |
---|---|---|
committer | Ken Martin <ken.martin@kitware.com> | 2004-04-26 15:12:19 (GMT) |
commit | c63c23a61759b178c04ac1c492beff131be9d41b (patch) | |
tree | f6575298aade688e315de9eedc58a3d06bff3d9c /Tests | |
parent | 2d53fcf03522bfc13f0a3817c260576bbe496c7d (diff) | |
download | CMake-c63c23a61759b178c04ac1c492beff131be9d41b.zip CMake-c63c23a61759b178c04ac1c492beff131be9d41b.tar.gz CMake-c63c23a61759b178c04ac1c492beff131be9d41b.tar.bz2 |
added tests for var args with macros
Diffstat (limited to 'Tests')
-rw-r--r-- | Tests/Complex/CMakeLists.txt | 13 | ||||
-rw-r--r-- | Tests/Complex/Executable/complex.cxx | 6 | ||||
-rw-r--r-- | Tests/ComplexOneConfig/CMakeLists.txt | 13 | ||||
-rw-r--r-- | Tests/ComplexOneConfig/Executable/complex.cxx | 6 | ||||
-rw-r--r-- | Tests/ComplexRelativePaths/CMakeLists.txt | 13 | ||||
-rw-r--r-- | Tests/ComplexRelativePaths/Executable/complex.cxx | 6 |
6 files changed, 57 insertions, 0 deletions
diff --git a/Tests/Complex/CMakeLists.txt b/Tests/Complex/CMakeLists.txt index c93713e..ef0ff80 100644 --- a/Tests/Complex/CMakeLists.txt +++ b/Tests/Complex/CMakeLists.txt @@ -17,6 +17,19 @@ ENDMACRO(ASSERT) 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 # IF (CMAKE_ANSI_CXXFLAGS) diff --git a/Tests/Complex/Executable/complex.cxx b/Tests/Complex/Executable/complex.cxx index 7ad9997..5cbe51c 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 c93713e..ef0ff80 100644 --- a/Tests/ComplexOneConfig/CMakeLists.txt +++ b/Tests/ComplexOneConfig/CMakeLists.txt @@ -17,6 +17,19 @@ ENDMACRO(ASSERT) 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 # IF (CMAKE_ANSI_CXXFLAGS) diff --git a/Tests/ComplexOneConfig/Executable/complex.cxx b/Tests/ComplexOneConfig/Executable/complex.cxx index 7ad9997..5cbe51c 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 c93713e..ef0ff80 100644 --- a/Tests/ComplexRelativePaths/CMakeLists.txt +++ b/Tests/ComplexRelativePaths/CMakeLists.txt @@ -17,6 +17,19 @@ ENDMACRO(ASSERT) 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 # IF (CMAKE_ANSI_CXXFLAGS) diff --git a/Tests/ComplexRelativePaths/Executable/complex.cxx b/Tests/ComplexRelativePaths/Executable/complex.cxx index 7ad9997..5cbe51c 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 |