mirror of
https://github.com/taglib/taglib.git
synced 2025-05-25 12:10:26 -04:00
Fix build by copying strigis FindCppUnit.cmake to taglib. Build failed because CPPUNIT_LIBRARIES didn't
contain cppunits dependencies reported by cppunit-config. git-svn-id: svn://anonsvn.kde.org/home/kde/trunk/kdesupport/taglib@899928 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
This commit is contained in:
parent
df3eb22060
commit
fc80167a4f
@ -22,7 +22,7 @@ ENDIF(ZLIB_FOUND)
|
||||
|
||||
SET(CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/cmake/modules)
|
||||
FIND_PACKAGE(CppUnit)
|
||||
IF (NOT CPPUNIT_FOUND AND BUILD_TESTS)
|
||||
IF (NOT CppUnit_FOUND AND BUILD_TESTS)
|
||||
MESSAGE(STATUS "CppUnit not found, disabling tests.")
|
||||
SET(BUILD_TESTS OFF)
|
||||
ENDIF(NOT CPPUNIT_FOUND AND BUILD_TESTS)
|
||||
ENDIF(NOT CppUnit_FOUND AND BUILD_TESTS)
|
||||
|
@ -1,28 +1,69 @@
|
||||
INCLUDE(UsePkgConfig)
|
||||
PKGCONFIG(cppunit _CppUnitIncDir _CppUnitLinkDir _CppUnitLinkFlags _CppUnitCflags)
|
||||
# - Try to find the libcppunit libraries
|
||||
# Once done this will define
|
||||
#
|
||||
# CppUnit_FOUND - system has libcppunit
|
||||
# CPPUNIT_INCLUDE_DIR - the libcppunit include directory
|
||||
# CPPUNIT_LIBRARIES - libcppunit library
|
||||
|
||||
FIND_PATH(CPPUNIT_INCLUDE_DIR cppunit/TestCase.h
|
||||
${_CppUnitIncDir}
|
||||
/usr/local/include
|
||||
/usr/include
|
||||
)
|
||||
include (MacroEnsureVersion)
|
||||
|
||||
FIND_LIBRARY(CPPUNIT_LIBRARIES cppunit
|
||||
${_CppUnitLinkDir}
|
||||
/usr/local/lib
|
||||
/usr/lib
|
||||
)
|
||||
if(NOT CPPUNIT_MIN_VERSION)
|
||||
SET(CPPUNIT_MIN_VERSION 1.12.0)
|
||||
endif(NOT CPPUNIT_MIN_VERSION)
|
||||
|
||||
IF (CPPUNIT_INCLUDE_DIR AND CPPUNIT_LIBRARIES)
|
||||
SET(CPPUNIT_FOUND TRUE)
|
||||
ENDIF (CPPUNIT_INCLUDE_DIR AND CPPUNIT_LIBRARIES)
|
||||
FIND_PROGRAM(CPPUNIT_CONFIG_EXECUTABLE cppunit-config )
|
||||
|
||||
IF (CPPUNIT_FOUND)
|
||||
IF (NOT CppUnit_FIND_QUIETLY)
|
||||
MESSAGE(STATUS "Found CppUnit: ${CPPUNIT_LIBRARIES}")
|
||||
ENDIF (NOT CppUnit_FIND_QUIETLY)
|
||||
ELSE (CPPUNIT_FOUND)
|
||||
IF (CppUnit_FIND_REQUIRED)
|
||||
MESSAGE(FATAL_ERROR "Could not find CppUnit")
|
||||
ENDIF (CppUnit_FIND_REQUIRED)
|
||||
ENDIF (CPPUNIT_FOUND)
|
||||
IF(CPPUNIT_INCLUDE_DIR AND CPPUNIT_LIBRARIES)
|
||||
|
||||
# in cache already
|
||||
SET(CppUnit_FOUND TRUE)
|
||||
|
||||
ELSE(CPPUNIT_INCLUDE_DIR AND CPPUNIT_LIBRARIES)
|
||||
|
||||
SET(CPPUNIT_INCLUDE_DIR)
|
||||
SET(CPPUNIT_LIBRARIES)
|
||||
|
||||
IF(CPPUNIT_CONFIG_EXECUTABLE)
|
||||
EXEC_PROGRAM(${CPPUNIT_CONFIG_EXECUTABLE} ARGS --cflags RETURN_VALUE _return_VALUE OUTPUT_VARIABLE CPPUNIT_CFLAGS)
|
||||
EXEC_PROGRAM(${CPPUNIT_CONFIG_EXECUTABLE} ARGS --libs RETURN_VALUE _return_VALUE OUTPUT_VARIABLE CPPUNIT_LIBRARIES)
|
||||
EXEC_PROGRAM(${CPPUNIT_CONFIG_EXECUTABLE} ARGS --version RETURN_VALUE _return_VALUE OUTPUT_VARIABLE CPPUNIT_INSTALLED_VERSION)
|
||||
STRING(REGEX REPLACE "-I(.+)" "\\1" CPPUNIT_CFLAGS "${CPPUNIT_CFLAGS}")
|
||||
ELSE(CPPUNIT_CONFIG_EXECUTABLE)
|
||||
# in case win32 needs to find it the old way?
|
||||
FIND_PATH(CPPUNIT_CFLAGS cppunit/TestRunner.h PATHS /usr/include /usr/local/include )
|
||||
FIND_LIBRARY(CPPUNIT_LIBRARIES NAMES cppunit PATHS /usr/lib /usr/local/lib )
|
||||
# how can we find cppunit version?
|
||||
MESSAGE (STATUS "Ensure you cppunit installed version is at least ${CPPUNIT_MIN_VERSION}")
|
||||
SET (CPPUNIT_INSTALLED_VERSION ${CPPUNIT_MIN_VERSION})
|
||||
ENDIF(CPPUNIT_CONFIG_EXECUTABLE)
|
||||
|
||||
SET(CPPUNIT_INCLUDE_DIR ${CPPUNIT_CFLAGS} "${CPPUNIT_CFLAGS}/cppunit")
|
||||
|
||||
ENDIF(CPPUNIT_INCLUDE_DIR AND CPPUNIT_LIBRARIES)
|
||||
|
||||
IF(CPPUNIT_INCLUDE_DIR AND CPPUNIT_LIBRARIES)
|
||||
|
||||
SET(CppUnit_FOUND TRUE)
|
||||
|
||||
if(NOT CppUnit_FIND_QUIETLY)
|
||||
MESSAGE (STATUS "Found cppunit: ${CPPUNIT_LIBRARIES}")
|
||||
endif(NOT CppUnit_FIND_QUIETLY)
|
||||
|
||||
IF(CPPUNIT_CONFIG_EXECUTABLE)
|
||||
EXEC_PROGRAM(${CPPUNIT_CONFIG_EXECUTABLE} ARGS --version RETURN_VALUE _return_VALUE OUTPUT_VARIABLE CPPUNIT_INSTALLED_VERSION)
|
||||
ENDIF(CPPUNIT_CONFIG_EXECUTABLE)
|
||||
|
||||
macro_ensure_version( ${CPPUNIT_MIN_VERSION} ${CPPUNIT_INSTALLED_VERSION} CPPUNIT_INSTALLED_VERSION_OK )
|
||||
|
||||
IF(NOT CPPUNIT_INSTALLED_VERSION_OK)
|
||||
MESSAGE ("** CppUnit version is too old: found ${CPPUNIT_INSTALLED_VERSION} installed, ${CPPUNIT_MIN_VERSION} or major is required")
|
||||
SET(CppUnit_FOUND FALSE)
|
||||
ENDIF(NOT CPPUNIT_INSTALLED_VERSION_OK)
|
||||
|
||||
ELSE(CPPUNIT_INCLUDE_DIR AND CPPUNIT_LIBRARIES)
|
||||
|
||||
SET(CppUnit_FOUND FALSE CACHE BOOL "Not found cppunit library")
|
||||
|
||||
ENDIF(CPPUNIT_INCLUDE_DIR AND CPPUNIT_LIBRARIES)
|
||||
|
||||
MARK_AS_ADVANCED(CPPUNIT_INCLUDE_DIR CPPUNIT_LIBRARIES)
|
||||
|
71
cmake/modules/MacroEnsureVersion.cmake
Normal file
71
cmake/modules/MacroEnsureVersion.cmake
Normal file
@ -0,0 +1,71 @@
|
||||
# This macro compares version numbers of the form "x.y.z"
|
||||
# MACRO_ENSURE_VERSION( FOO_MIN_VERSION FOO_VERSION_FOUND FOO_VERSION_OK)
|
||||
# will set FOO_VERSIN_OK to true if FOO_VERSION_FOUND >= FOO_MIN_VERSION
|
||||
# where both have to be in a 3-part-version format, leading and trailing
|
||||
# text is ok, e.g.
|
||||
# MACRO_ENSURE_VERSION( "2.5.31" "flex 2.5.4a" VERSION_OK)
|
||||
# which means 2.5.31 is required and "flex 2.5.4a" is what was found on the system
|
||||
|
||||
# Copyright (c) 2006, David Faure, <faure@kde.org>
|
||||
#
|
||||
# Redistribution and use is allowed according to the terms of the BSD license.
|
||||
# For details see the accompanying COPYING-CMAKE-SCRIPTS file.
|
||||
|
||||
MACRO(MACRO_ENSURE_VERSION requested_version found_version var_too_old)
|
||||
|
||||
# parse the parts of the version string
|
||||
STRING(REGEX REPLACE "([0-9]+)\\.[0-9]+\\.[0-9]+" "\\1" req_major_vers "${requested_version}")
|
||||
STRING(REGEX REPLACE "[0-9]+\\.([0-9]+)\\.[0-9]+" "\\1" req_minor_vers "${requested_version}")
|
||||
STRING(REGEX REPLACE "[0-9]+\\.[0-9]+\\.([0-9]+)" "\\1" req_patch_vers "${requested_version}")
|
||||
|
||||
STRING(REGEX REPLACE "[^0-9]*([0-9]+)\\.[0-9]+\\.[0-9]+.*" "\\1" found_major_vers "${found_version}")
|
||||
STRING(REGEX REPLACE "[^0-9]*[0-9]+\\.([0-9]+)\\.[0-9]+.*" "\\1" found_minor_vers "${found_version}")
|
||||
STRING(REGEX REPLACE "[^0-9]*[0-9]+\\.[0-9]+\\.([0-9]+).*" "\\1" found_patch_vers "${found_version}")
|
||||
|
||||
# compute an overall version number which can be compared at once
|
||||
MATH(EXPR req_vers_num "${req_major_vers}*10000 + ${req_minor_vers}*100 + ${req_patch_vers}")
|
||||
MATH(EXPR found_vers_num "${found_major_vers}*10000 + ${found_minor_vers}*100 + ${found_patch_vers}")
|
||||
|
||||
if (found_vers_num LESS req_vers_num)
|
||||
set( ${var_too_old} FALSE )
|
||||
else (found_vers_num LESS req_vers_num)
|
||||
set( ${var_too_old} TRUE )
|
||||
endif (found_vers_num LESS req_vers_num)
|
||||
|
||||
ENDMACRO(MACRO_ENSURE_VERSION)
|
||||
|
||||
|
||||
# This macro compares version numbers of the form "x.y"
|
||||
# MACRO_ENSURE_VERSION( FOO_MIN_VERSION FOO_VERSION_FOUND FOO_VERSION_OK)
|
||||
# will set FOO_VERSIN_OK to true if FOO_VERSION_FOUND >= FOO_MIN_VERSION
|
||||
# where both have to be in a 2-part-version format, leading and trailing
|
||||
# text is ok, e.g.
|
||||
# MACRO_ENSURE_VERSION( "0.5" "foo 0.6" VERSION_OK)
|
||||
# which means 0.5 is required and "foo 0.6" is what was found on the system
|
||||
|
||||
# Copyright (c) 2006, David Faure, <faure@kde.org>
|
||||
# Copyright (c) 2007, Pino Toscano, <pino@kde.org>
|
||||
#
|
||||
# Redistribution and use is allowed according to the terms of the BSD license.
|
||||
# For details see the accompanying COPYING-CMAKE-SCRIPTS file.
|
||||
|
||||
MACRO(MACRO_ENSURE_VERSION2 requested_version found_version var_too_old)
|
||||
|
||||
# parse the parts of the version string
|
||||
STRING(REGEX REPLACE "([0-9]+)\\.[0-9]+" "\\1" req_major_vers "${requested_version}")
|
||||
STRING(REGEX REPLACE "[0-9]+\\.([0-9]+)" "\\1" req_minor_vers "${requested_version}")
|
||||
|
||||
STRING(REGEX REPLACE "[^0-9]*([0-9]+)\\.[0-9]+.*" "\\1" found_major_vers "${found_version}")
|
||||
STRING(REGEX REPLACE "[^0-9]*[0-9]+\\.([0-9]+).*" "\\1" found_minor_vers "${found_version}")
|
||||
|
||||
# compute an overall version number which can be compared at once
|
||||
MATH(EXPR req_vers_num "${req_major_vers}*100 + ${req_minor_vers}")
|
||||
MATH(EXPR found_vers_num "${found_major_vers}*100 + ${found_minor_vers}")
|
||||
|
||||
if (found_vers_num LESS req_vers_num)
|
||||
set( ${var_too_old} FALSE )
|
||||
else (found_vers_num LESS req_vers_num)
|
||||
set( ${var_too_old} TRUE )
|
||||
endif (found_vers_num LESS req_vers_num)
|
||||
|
||||
ENDMACRO(MACRO_ENSURE_VERSION2)
|
Loading…
Reference in New Issue
Block a user