]> git.ipfire.org Git - thirdparty/libarchive.git/commitdiff
Use ADD_TEST_28 macro to fix tests with the VS IDE
authorBrad King <brad.king@kitware.com>
Wed, 18 Nov 2009 14:14:18 +0000 (09:14 -0500)
committerBrad King <brad.king@kitware.com>
Wed, 18 Nov 2009 14:14:18 +0000 (09:14 -0500)
This macro simplifies creation of tests that refer to executables built
in the project.  We can pass executables as arguments to a test using a
CMake 2.8 "generator expression" of the form "$<TARGET_FILE:myexe>".
The macro translates the arguments into something CMake 2.6 understands.

This change also fixes the tests so that they run correctly in build
trees created for multi-configuration build tools like the VS IDE.
These tools place executables in a per-configuration subdirectory so
references to executables in test arguments must use a test-time
substitution.  The ADD_TEST_28 macro handles this automatically.

SVN-Revision: 1672

CMakeLists.txt
cpio/test/CMakeLists.txt
libarchive/test/CMakeLists.txt
tar/test/CMakeLists.txt

index d51f4466e3c80973b6f1a5b0c6d968b200b62de0..5031278a9a16898ff13dab3c4219d73f71175500 100644 (file)
@@ -31,6 +31,10 @@ SET(SOVERSION                   8)
 # Enable CTest/CDash support
 include(CTest)
 
+# Provide ADD_TEST_28 macro to approximate CMake 2.8 ADD_TEST(NAME).
+# TODO: Require CMake 2.8 and drop this workaround (perhaps late 2010).
+INCLUDE(AddTest28)
+
 OPTION(ENABLE_TAR "Enable tar building" ON)
 OPTION(ENABLE_TAR_SHARED "Enable dynamic build of tar" OFF)
 OPTION(ENABLE_CPIO "Enable cpio building" ON)
index ddc69cce3fa72211f99aeabf5a5e60ac8eb3de88..a822bcdfba5b31b0e63c128a6a6f33775c0646ab 100644 (file)
@@ -60,11 +60,12 @@ IF(ENABLE_CPIO AND ENABLE_TEST)
   # test.  We can use that to define the tests for cmake by
   # defining a DEFINE_TEST macro and reading list.h in.
   MACRO (DEFINE_TEST _testname)
-    ADD_TEST("bsdcpio_${_testname}"
-                 bsdcpio_test -vv
-                              -p ${BSDCPIO}
-                              -r ${CMAKE_CURRENT_SOURCE_DIR}
-                              ${_testname})
+    ADD_TEST_28(
+      NAME bsdcpio_${_testname}
+      COMMAND bsdcpio_test -vv
+                           -p $<TARGET_FILE:bsdcpio>
+                           -r ${CMAKE_CURRENT_SOURCE_DIR}
+                           ${_testname})
   ENDMACRO (DEFINE_TEST _testname)
 
   INCLUDE(${CMAKE_CURRENT_BINARY_DIR}/list.h)
index 682a58cc5793a6505212356aba2c9e2964b33259..69f494ccbbd33afb8c8a94dc0b91bb4b730acd0c 100644 (file)
@@ -137,8 +137,9 @@ IF(ENABLE_TEST)
   # test.  We can use that to define the tests for cmake by
   # defining a DEFINE_TEST macro and reading list.h in.
   MACRO (DEFINE_TEST _testname)
-  ADD_TEST("libarchive_${_testname}"
-                 libarchive_test -vv
+    ADD_TEST_28(
+      NAME libarchive_${_testname}
+      COMMAND libarchive_test -vv
                               -r ${CMAKE_CURRENT_SOURCE_DIR}
                               ${_testname})
   ENDMACRO (DEFINE_TEST _testname)
index fe5f0ba6ea99c12be19a899174e77d5436cb708f..fab67f3de6011f58dc3fa786dc8d152d15fb2190 100644 (file)
@@ -47,11 +47,12 @@ IF(ENABLE_TAR AND ENABLE_TEST)
   # test.  We can use that to define the tests for cmake by
   # defining a DEFINE_TEST macro and reading list.h in.
   MACRO (DEFINE_TEST _testname)
-    ADD_TEST("bsdtar_${_testname}"
-                 bsdtar_test -vv
-                              -p ${BSDTAR}
-                              -r ${CMAKE_CURRENT_SOURCE_DIR}
-                              ${_testname})
+    ADD_TEST_28(
+      NAME bsdtar_${_testname}
+      COMMAND bsdtar_test -vv
+                          -p $<TARGET_FILE:bsdtar>
+                          -r ${CMAKE_CURRENT_SOURCE_DIR}
+                          ${_testname})
   ENDMACRO (DEFINE_TEST _testname)
 
   INCLUDE(${CMAKE_CURRENT_BINARY_DIR}/list.h)