From: Tim Kientzle Date: Thu, 29 Dec 2011 03:01:07 +0000 (-0500) Subject: Require CMake 2.8 and drop some workarounds for older versions. X-Git-Tag: v3.0.4~2^2~246 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=45e71a7bc454903d28c6f90e2d0ed3d5d650cb79;p=thirdparty%2Flibarchive.git Require CMake 2.8 and drop some workarounds for older versions. SVN-Revision: 4027 --- diff --git a/CMakeLists.txt b/CMakeLists.txt index 51a938e94..a675f4d88 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -2,7 +2,7 @@ # PROJECT(libarchive C) # -CMAKE_MINIMUM_REQUIRED(VERSION 2.6.3 FATAL_ERROR) +CMAKE_MINIMUM_REQUIRED(VERSION 2.8 FATAL_ERROR) SET(CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/build/cmake") if(NOT CMAKE_RUNTIME_OUTPUT_DIRECTORY) set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${libarchive_BINARY_DIR}/bin) @@ -58,10 +58,6 @@ ENDIF ("CMAKE_C_COMPILER_ID" MATCHES "^GNU$") # 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_NETTLE "Enable use of Nettle" ON) OPTION(ENABLE_OPENSSL "Enable use of OpenSSL" ON) OPTION(ENABLE_TAR "Enable tar building" ON) diff --git a/build/cmake/AddTest28.cmake b/build/cmake/AddTest28.cmake deleted file mode 100644 index ab26a9a9b..000000000 --- a/build/cmake/AddTest28.cmake +++ /dev/null @@ -1,107 +0,0 @@ -# - Macro approximating the CMake 2.8 ADD_TEST(NAME) signature. -# ADD_TEST_28(NAME COMMAND [arg1 [arg2 ...]]) -# - The name of the test -# - The test executable -# [argN...] - Arguments to the test executable -# This macro approximates the ADD_TEST(NAME) signature provided in -# CMake 2.8 but works with CMake 2.6 too. See CMake 2.8 documentation -# of ADD_TEST()for details. -# -# This macro automatically replaces a that names an -# executable target with the target location. A generator expression -# of the form "$" is supported in both the command -# and arguments of the test. Howerver, this macro only works for -# targets without per-config output name properties set. -# -# Example usage: -# add_test(NAME mytest COMMAND testDriver --exe $) -# This creates a test "mytest" whose command runs a testDriver tool -# passing the full path to the executable file produced by target -# "myexe". - -#============================================================================= -# Copyright 2009 Kitware, Inc. -# All rights reserved. -# -# Redistribution and use in source and binary forms, with or without -# modification, are permitted provided that the following conditions -# are met: -# 1. Redistributions of source code must retain the above copyright -# notice, this list of conditions and the following disclaimer -# in this position and unchanged. -# 2. Redistributions in binary form must reproduce the above copyright -# notice, this list of conditions and the following disclaimer in the -# documentation and/or other materials provided with the distribution. -# -# THIS SOFTWARE IS PROVIDED BY THE AUTHOR(S) ``AS IS'' AND ANY EXPRESS OR -# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES -# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. -# IN NO EVENT SHALL THE AUTHOR(S) BE LIABLE FOR ANY DIRECT, INDIRECT, -# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT -# NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF -# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -#============================================================================= - -CMAKE_MINIMUM_REQUIRED(VERSION 2.6.3) - -# CMake 2.8 supports ADD_TEST(NAME) natively. -IF(NOT "${CMAKE_VERSION}" VERSION_LESS "2.8") - MACRO(ADD_TEST_28) - ADD_TEST(${ARGV}) - ENDMACRO() - RETURN() -ENDIF() - -# Simulate ADD_TEST(NAME) signature from CMake 2.8. -MACRO(ADD_TEST_28 NAME name COMMAND command) - # Enforce the signature. - IF(NOT "x${NAME}" STREQUAL "xNAME") - MESSAGE(FATAL_ERROR "First ADD_TEST_28 argument must be \"NAME\"") - ENDIF() - IF(NOT "x${COMMAND}" STREQUAL "xCOMMAND") - MESSAGE(FATAL_ERROR "Third ADD_TEST_28 argument must be \"COMMAND\"") - ENDIF() - - # Perform "COMMAND myexe ..." substitution. - SET(cmd "${command}") - IF(TARGET "${cmd}") - _ADD_TEST_28_GET_EXE(${cmd} cmd) - ENDIF() - - # Perform "COMMAND ... $ ..." substitution. - SET(target_file "\\$") - SET(args) - FOREACH(ARG ${cmd} ${ARGN}) - SET(arg "${ARG}") - IF("${arg}" MATCHES "${target_file}") - STRING(REGEX REPLACE "${target_file}" "\\1" tgt "${arg}") - IF(TARGET "${tgt}") - _ADD_TEST_28_GET_EXE(${tgt} exe) - STRING(REGEX REPLACE "${target_file}" "${exe}" arg "${arg}") - ENDIF() - ENDIF() - LIST(APPEND args "${arg}") - ENDFOREACH() - - # Invoke old ADD_TEST() signature with transformed arguments. - ADD_TEST(${name} ${args}) -ENDMACRO() - -# Get the test-time location of an executable target. -MACRO(_ADD_TEST_28_GET_EXE tgt exe_var) - # The LOCATION property gives a build-time location. - GET_TARGET_PROPERTY(${exe_var} ${tgt} LOCATION) - - # In single-configuration generatrs the build-time and test-time - # locations are the same because there is no per-config variable - # reference. In multi-configuration generators the following - # substitution converts the build-time configuration variable - # reference to a test-time configuration variable reference. - IF(CMAKE_CONFIGURATION_TYPES) - STRING(REPLACE "${CMAKE_CFG_INTDIR}" "\${CTEST_CONFIGURATION_TYPE}" - ${exe_var} "${${exe_var}}") - ENDIF(CMAKE_CONFIGURATION_TYPES) -ENDMACRO() diff --git a/cpio/test/CMakeLists.txt b/cpio/test/CMakeLists.txt index cb1a3ad56..2196c19ae 100644 --- a/cpio/test/CMakeLists.txt +++ b/cpio/test/CMakeLists.txt @@ -58,7 +58,7 @@ 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_28( + ADD_TEST( NAME bsdcpio_${_testname} COMMAND bsdcpio_test -vv -p $ diff --git a/libarchive/test/CMakeLists.txt b/libarchive/test/CMakeLists.txt index d9be74f19..ce6ab9090 100644 --- a/libarchive/test/CMakeLists.txt +++ b/libarchive/test/CMakeLists.txt @@ -196,7 +196,7 @@ 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_28( + ADD_TEST( NAME libarchive_${_testname} COMMAND libarchive_test -vv -r ${CMAKE_CURRENT_SOURCE_DIR} diff --git a/tar/test/CMakeLists.txt b/tar/test/CMakeLists.txt index 95ca091b0..f30a0dd32 100644 --- a/tar/test/CMakeLists.txt +++ b/tar/test/CMakeLists.txt @@ -58,7 +58,7 @@ 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_28( + ADD_TEST( NAME bsdtar_${_testname} COMMAND bsdtar_test -vv -p $