From b94768531ef8881f2b6e7b93c4f0324f02b80487 Mon Sep 17 00:00:00 2001 From: Christian Ehrlicher Date: Sun, 30 Sep 2007 16:19:18 +0000 Subject: FIND_LIBRARY_EX -> FIND_LIBRARY_WITH_DEBUG svn path=/trunk/KDE/kdelibs/; revision=719224 --- modules/FindBlitz.cmake | 4 +- modules/FindKDEWIN32.cmake | 6 +- modules/FindLibraryEx.cmake | 111 ------------------------------------ modules/FindLibraryWithDebug.cmake | 112 +++++++++++++++++++++++++++++++++++++ modules/FindOpenSSL.cmake | 6 +- modules/FindQCA2.cmake | 4 +- modules/FindSoprano.cmake | 3 +- modules/FindStrigi.cmake | 8 +-- modules/FindTaglib.cmake | 8 +-- 9 files changed, 132 insertions(+), 130 deletions(-) delete mode 100644 modules/FindLibraryEx.cmake create mode 100644 modules/FindLibraryWithDebug.cmake (limited to 'modules') diff --git a/modules/FindBlitz.cmake b/modules/FindBlitz.cmake index cd5f3e98..6f3e912b 100644 --- a/modules/FindBlitz.cmake +++ b/modules/FindBlitz.cmake @@ -10,7 +10,7 @@ # Redistribution and use is allowed according to the terms of the BSD license. # For details see the accompanying COPYING-CMAKE-SCRIPTS file. -include(FindLibraryEx) +include(FindLibraryWithDebug) if (BLITZ_INCLUDES AND BLITZ_LIBRARIES) set(Blitz_FIND_QUIETLY TRUE) @@ -26,7 +26,7 @@ find_path(BLITZ_INCLUDES ${INCLUDE_INSTALL_DIR} ) -FIND_LIBRARY_EX(BLITZ_LIBRARIES +find_library_with_debug(BLITZ_LIBRARIES WIN32_DEBUG_POSTFIX d qimageblitz PATHS diff --git a/modules/FindKDEWIN32.cmake b/modules/FindKDEWIN32.cmake index e6d044d7..5d4499af 100644 --- a/modules/FindKDEWIN32.cmake +++ b/modules/FindKDEWIN32.cmake @@ -14,21 +14,21 @@ if (WIN32) - include(FindLibraryEx) + include(FindLibraryWithDebug) if (NOT KDEWIN32_DIR) if(NOT KDEWIN_FOUND) find_package(KDEWIN REQUIRED) endif(NOT KDEWIN_FOUND) - find_path(KDEWIN32_INCLUDE_DIR winposix_export.h + find_path(KDEWIN32_INCLUDE_DIR winposix_export.h ${CMAKE_INCLUDE_PATH} ${CMAKE_INSTALL_PREFIX}/include ) # search for kdewin32 in the default install directory for applications (default of (n)make install) - find_library_ex(KDEWIN32_LIBRARY + find_library_with_debug(KDEWIN32_LIBRARY WIN32_DEBUG_POSTFIX d NAMES kdewin32 PATHS diff --git a/modules/FindLibraryEx.cmake b/modules/FindLibraryEx.cmake deleted file mode 100644 index aee3bf9e..00000000 --- a/modules/FindLibraryEx.cmake +++ /dev/null @@ -1,111 +0,0 @@ -# -# FIND_LIBRARY_EX - enhanced FIND_LIBRARY to allow the search for an -# optional debug library with a WIN32_DEBUG_POSTFIX similar -# to CMAKE_DEBUG_POSTFIX when creating a shared lib -# it has to be the second and third argument -# -# Copyright (c) 2007, Christian Ehrlicher, -# Redistribution and use is allowed according to the terms of the BSD license. -# For details see the accompanying COPYING-CMAKE-SCRIPTS file. - -MACRO(FIND_LIBRARY_EX var_name win32_dbg_postfix_name dgb_postfix libname) - - IF(NOT ${win32_dbg_postfix_name} STREQUAL "WIN32_DEBUG_POSTFIX") - - # no WIN32_DEBUG_POSTFIX -> simply pass all arguments to FIND_LIBRARY - FIND_LIBRARY(${var_name} - ${win32_dbg_postfix_name} - ${dgb_postfix} - ${libname} - ${ARGN} - ) - - ELSE(NOT ${win32_dbg_postfix_name} STREQUAL "WIN32_DEBUG_POSTFIX") - - IF(NOT WIN32) - # on non-win32 we don't need to take care about WIN32_DEBUG_POSTFIX - - FIND_LIBRARY(${var_name} ${libname} ${ARGN}) - - ELSE(NOT WIN32) - - # 1. get all possible libnames - SET(args ${ARGN}) - SET(libnames_release "") - SET(libnames_debug "") - - LIST(LENGTH args listCount) - - IF("${libname}" STREQUAL "NAMES") - SET(append_rest 0) - LIST(APPEND args " ") - - FOREACH(i RANGE ${listCount}) - LIST(GET args ${i} val) - - IF(append_rest) - LIST(APPEND newargs ${val}) - ELSE(append_rest) - IF("${val}" STREQUAL "PATHS") - LIST(APPEND newargs ${val}) - SET(append_rest 1) - ELSE("${val}" STREQUAL "PATHS") - LIST(APPEND libnames_release "${val}") - LIST(APPEND libnames_debug "${val}${dgb_postfix}") - ENDIF("${val}" STREQUAL "PATHS") - ENDIF(append_rest) - - ENDFOREACH(i) - - ELSE("${libname}" STREQUAL "NAMES") - - # just one name - LIST(APPEND libnames_release "${libname}") - LIST(APPEND libnames_debug "${libname}${dgb_postfix}") - - SET(newargs ${args}) - - ENDIF("${libname}" STREQUAL "NAMES") - - # search the release lib - FIND_LIBRARY(${var_name}_RELEASE - NAMES ${libnames_release} - ${newargs} - ) - - # search the debug lib - FIND_LIBRARY(${var_name}_DEBUG - NAMES ${libnames_debug} - ${newargs} - ) - - IF(${var_name}_RELEASE AND ${var_name}_DEBUG) - - # both libs found - SET(${var_name} optimized ${${var_name}_RELEASE} - debug ${${var_name}_DEBUG}) - - ELSE(${var_name}_RELEASE AND ${var_name}_DEBUG) - - IF(${var_name}_RELEASE) - - # only release found - SET(${var_name} ${${var_name}_RELEASE}) - - ELSE(${var_name}_RELEASE) - - # only debug (or nothing) found - SET(${var_name} ${${var_name}_DEBUG}) - - ENDIF(${var_name}_RELEASE) - - ENDIF(${var_name}_RELEASE AND ${var_name}_DEBUG) - - MARK_AS_ADVANCED(${var_name}_RELEASE) - MARK_AS_ADVANCED(${var_name}_DEBUG) - - ENDIF(NOT WIN32) - - ENDIF(NOT ${win32_dbg_postfix_name} STREQUAL "WIN32_DEBUG_POSTFIX") - -ENDMACRO(FIND_LIBRARY_EX) diff --git a/modules/FindLibraryWithDebug.cmake b/modules/FindLibraryWithDebug.cmake new file mode 100644 index 00000000..d3450a2a --- /dev/null +++ b/modules/FindLibraryWithDebug.cmake @@ -0,0 +1,112 @@ +# +# FIND_LIBRARY_WITH_DEBUG +# -> enhanced FIND_LIBRARY to allow the search for an +# optional debug library with a WIN32_DEBUG_POSTFIX similar +# to CMAKE_DEBUG_POSTFIX when creating a shared lib +# it has to be the second and third argument +# +# Copyright (c) 2007, Christian Ehrlicher, +# Redistribution and use is allowed according to the terms of the BSD license. +# For details see the accompanying COPYING-CMAKE-SCRIPTS file. + +MACRO(FIND_LIBRARY_WITH_DEBUG var_name win32_dbg_postfix_name dgb_postfix libname) + + IF(NOT ${win32_dbg_postfix_name} STREQUAL "WIN32_DEBUG_POSTFIX") + + # no WIN32_DEBUG_POSTFIX -> simply pass all arguments to FIND_LIBRARY + FIND_LIBRARY(${var_name} + ${win32_dbg_postfix_name} + ${dgb_postfix} + ${libname} + ${ARGN} + ) + + ELSE(NOT ${win32_dbg_postfix_name} STREQUAL "WIN32_DEBUG_POSTFIX") + + IF(NOT WIN32) + # on non-win32 we don't need to take care about WIN32_DEBUG_POSTFIX + + FIND_LIBRARY(${var_name} ${libname} ${ARGN}) + + ELSE(NOT WIN32) + + # 1. get all possible libnames + SET(args ${ARGN}) + SET(libnames_release "") + SET(libnames_debug "") + + LIST(LENGTH args listCount) + + IF("${libname}" STREQUAL "NAMES") + SET(append_rest 0) + LIST(APPEND args " ") + + FOREACH(i RANGE ${listCount}) + LIST(GET args ${i} val) + + IF(append_rest) + LIST(APPEND newargs ${val}) + ELSE(append_rest) + IF("${val}" STREQUAL "PATHS") + LIST(APPEND newargs ${val}) + SET(append_rest 1) + ELSE("${val}" STREQUAL "PATHS") + LIST(APPEND libnames_release "${val}") + LIST(APPEND libnames_debug "${val}${dgb_postfix}") + ENDIF("${val}" STREQUAL "PATHS") + ENDIF(append_rest) + + ENDFOREACH(i) + + ELSE("${libname}" STREQUAL "NAMES") + + # just one name + LIST(APPEND libnames_release "${libname}") + LIST(APPEND libnames_debug "${libname}${dgb_postfix}") + + SET(newargs ${args}) + + ENDIF("${libname}" STREQUAL "NAMES") + + # search the release lib + FIND_LIBRARY(${var_name}_RELEASE + NAMES ${libnames_release} + ${newargs} + ) + + # search the debug lib + FIND_LIBRARY(${var_name}_DEBUG + NAMES ${libnames_debug} + ${newargs} + ) + + IF(${var_name}_RELEASE AND ${var_name}_DEBUG) + + # both libs found + SET(${var_name} optimized ${${var_name}_RELEASE} + debug ${${var_name}_DEBUG}) + + ELSE(${var_name}_RELEASE AND ${var_name}_DEBUG) + + IF(${var_name}_RELEASE) + + # only release found + SET(${var_name} ${${var_name}_RELEASE}) + + ELSE(${var_name}_RELEASE) + + # only debug (or nothing) found + SET(${var_name} ${${var_name}_DEBUG}) + + ENDIF(${var_name}_RELEASE) + + ENDIF(${var_name}_RELEASE AND ${var_name}_DEBUG) + + MARK_AS_ADVANCED(${var_name}_RELEASE) + MARK_AS_ADVANCED(${var_name}_DEBUG) + + ENDIF(NOT WIN32) + + ENDIF(NOT ${win32_dbg_postfix_name} STREQUAL "WIN32_DEBUG_POSTFIX") + +ENDMACRO(FIND_LIBRARY_WITH_DEBUG) diff --git a/modules/FindOpenSSL.cmake b/modules/FindOpenSSL.cmake index 44cfa50f..2b5313d9 100644 --- a/modules/FindOpenSSL.cmake +++ b/modules/FindOpenSSL.cmake @@ -10,11 +10,11 @@ # Redistribution and use is allowed according to the terms of the BSD license. # For details see the accompanying COPYING-CMAKE-SCRIPTS file. -include(FindLibraryEx) +INCLUDE(FindLibraryWithDebug) # on win32 we additional need to link to libeay32.lib MACRO(OPENSSL_ADD_LIB_EAY_LIBS) - FIND_LIBRARY_EX(OPENSSL_EAY_LIBRARIES + FIND_LIBRARY_WITH_DEBUG(OPENSSL_EAY_LIBRARIES WIN32_DEBUG_POSTFIX d NAMES eay libeay libeay32 libeay32MD) ENDMACRO(OPENSSL_ADD_LIB_EAY_LIBS) @@ -29,7 +29,7 @@ ENDIF(SSL_EAY_DEBUG AND SSL_EAY_RELEASE) FIND_PATH(OPENSSL_INCLUDE_DIR openssl/ssl.h ) -FIND_LIBRARY_EX(OPENSSL_LIBRARIES +FIND_LIBRARY_WITH_DEBUG(OPENSSL_LIBRARIES WIN32_DEBUG_POSTFIX d NAMES ssl ssleay ssleay32 ssleay32MD) diff --git a/modules/FindQCA2.cmake b/modules/FindQCA2.cmake index 2f4835bf..877e4143 100644 --- a/modules/FindQCA2.cmake +++ b/modules/FindQCA2.cmake @@ -14,7 +14,7 @@ # Redistribution and use is allowed according to the terms of the BSD license. # For details see the accompanying COPYING-CMAKE-SCRIPTS file. -include(FindLibraryEx) +include(FindLibraryWithDebug) if (QCA2_INCLUDE_DIR AND QCA2_LIBRARIES) @@ -36,7 +36,7 @@ else (QCA2_INCLUDE_DIR AND QCA2_LIBRARIES) NO_DEFAULT_PATH ) ELSE (NOT WIN32) - FIND_LIBRARY_EX(QCA2_LIBRARIES + FIND_LIBRARY_WITH_DEBUG(QCA2_LIBRARIES WIN32_DEBUG_POSTFIX d NAMES qca) diff --git a/modules/FindSoprano.cmake b/modules/FindSoprano.cmake index 7857cbdb..f5d23b3b 100644 --- a/modules/FindSoprano.cmake +++ b/modules/FindSoprano.cmake @@ -6,6 +6,7 @@ if(SOPRANO_INCLUDE_DIR AND SOPRANO_LIBRARIES AND SOPRANO_INDEX_LIBRARIES) set(Soprano_FOUND TRUE) else(SOPRANO_INCLUDE_DIR AND SOPRANO_LIBRARIES AND SOPRANO_INDEX_LIBRARIES) + INCLUDE(FindLibraryWithDebug) FIND_PATH(SOPRANO_INCLUDE_DIR NAMES @@ -15,7 +16,7 @@ else(SOPRANO_INCLUDE_DIR AND SOPRANO_LIBRARIES AND SOPRANO_INDEX_LIBRARIES) ${INCLUDE_INSTALL_DIR} ) - FIND_LIBRARY_EX(SOPRANO_LIBRARIES + FIND_LIBRARY_WITH_DEBUG(SOPRANO_LIBRARIES WIN32_DEBUG_POSTFIX d NAMES soprano PATHS diff --git a/modules/FindStrigi.cmake b/modules/FindStrigi.cmake index f0d1e03b..0d4435e3 100644 --- a/modules/FindStrigi.cmake +++ b/modules/FindStrigi.cmake @@ -6,7 +6,7 @@ # STRIGI_STREAMANALYZER_LIBRARY - Link these to use Strigi streamanalyzer # STRIGI_STREAMS_LIBRARY - Link these to use Strigi streams -include(FindLibraryEx) +include(FindLibraryWithDebug) set(STRIGI_MIN_VERSION "0.5.3") @@ -22,7 +22,7 @@ find_path(STRIGI_INCLUDE_DIR strigi/streamanalyzer.h NO_DEFAULT_PATH ) -find_library_ex(STRIGI_STREAMANALYZER_LIBRARY +find_library_with_debug(STRIGI_STREAMANALYZER_LIBRARY WIN32_DEBUG_POSTFIX d NAMES streamanalyzer PATHS @@ -31,7 +31,7 @@ find_library_ex(STRIGI_STREAMANALYZER_LIBRARY ${_program_FILES_DIR}/strigi/lib ) -find_library_ex(STRIGI_STREAMS_LIBRARY +find_library_with_debug(STRIGI_STREAMS_LIBRARY WIN32_DEBUG_POSTFIX d NAMES streams PATHS @@ -40,7 +40,7 @@ find_library_ex(STRIGI_STREAMS_LIBRARY ${_program_FILES_DIR}/strigi/lib ) -find_library_ex(STRIGI_STRIGIQTDBUSCLIENT_LIBRARY +find_library_with_debug(STRIGI_STRIGIQTDBUSCLIENT_LIBRARY WIN32_DEBUG_POSTFIX d NAMES strigiqtdbusclient PATHS diff --git a/modules/FindTaglib.cmake b/modules/FindTaglib.cmake index 7b5ffc39..a66ae57b 100644 --- a/modules/FindTaglib.cmake +++ b/modules/FindTaglib.cmake @@ -10,8 +10,6 @@ # Redistribution and use is allowed according to the terms of the BSD license. # For details see the accompanying COPYING-CMAKE-SCRIPTS file. -include(FindLibraryEx) - IF(NOT WIN32) FIND_PROGRAM(TAGLIBCONFIG_EXECUTABLE NAMES taglib-config PATHS /usr/bin @@ -37,6 +35,9 @@ IF(TAGLIBCONFIG_EXECUTABLE) MARK_AS_ADVANCED(TAGLIB_CFLAGS TAGLIB_LIBRARIES) ELSE(TAGLIBCONFIG_EXECUTABLE) + include(FindLibraryWithDebug) + include(FindPackageHandleStandardArgs) + find_path(TAGLIB_INCLUDES NAMES tag.h @@ -46,7 +47,7 @@ ELSE(TAGLIBCONFIG_EXECUTABLE) ${INCLUDE_INSTALL_DIR} ) - FIND_LIBRARY_EX(TAGLIB_LIBRARIES + find_library_with_debug(TAGLIB_LIBRARIES WIN32_DEBUG_POSTFIX d NAMES tag PATHS @@ -54,7 +55,6 @@ ELSE(TAGLIBCONFIG_EXECUTABLE) ${LIB_INSTALL_DIR} ) - INCLUDE(FindPackageHandleStandardArgs) find_package_handle_standard_args(Taglib DEFAULT_MSG TAGLIB_INCLUDES TAGLIB_LIBRARIES) ENDIF(TAGLIBCONFIG_EXECUTABLE) -- cgit v1.2.1