Warning, /office/calligra/cmake/modules/LibFindMacros.cmake is written in an unsupported language. File is not indexed.
0001 # Version 1.0 (2013-04-12) 0002 # Public Domain, originally written by Lasse Kärkkäinen <tronic@zi.fi> 0003 # Published at http://www.cmake.org/Wiki/CMake:How_To_Find_Libraries 0004 0005 # If you improve the script, please modify the forementioned wiki page because 0006 # I no longer maintain my scripts (hosted as static files at zi.fi). Feel free 0007 # to remove this entire header if you use real version control instead. 0008 0009 # Changelog: 0010 # 2013-04-12 Added version number (1.0) and this header, no other changes 0011 # 2009-10-08 Originally published 0012 0013 0014 # Works the same as find_package, but forwards the "REQUIRED" and "QUIET" arguments 0015 # used for the current package. For this to work, the first parameter must be the 0016 # prefix of the current package, then the prefix of the new package etc, which are 0017 # passed to find_package. 0018 macro (libfind_package PREFIX) 0019 set (LIBFIND_PACKAGE_ARGS ${ARGN}) 0020 if (${PREFIX}_FIND_QUIETLY) 0021 set (LIBFIND_PACKAGE_ARGS ${LIBFIND_PACKAGE_ARGS} QUIET) 0022 endif () 0023 if (${PREFIX}_FIND_REQUIRED) 0024 set (LIBFIND_PACKAGE_ARGS ${LIBFIND_PACKAGE_ARGS} REQUIRED) 0025 endif () 0026 find_package(${LIBFIND_PACKAGE_ARGS}) 0027 endmacro (libfind_package) 0028 0029 # CMake developers made the UsePkgConfig system deprecated in the same release (2.6) 0030 # where they added pkg_check_modules. Consequently I need to support both in my scripts 0031 # to avoid those deprecated warnings. Here's a helper that does just that. 0032 # Works identically to pkg_check_modules, except that no checks are needed prior to use. 0033 macro (libfind_pkg_check_modules PREFIX PKGNAME) 0034 if (${CMAKE_MAJOR_VERSION} EQUAL 2 AND ${CMAKE_MINOR_VERSION} EQUAL 4) 0035 include(UsePkgConfig) 0036 pkgconfig(${PKGNAME} ${PREFIX}_INCLUDE_DIRS ${PREFIX}_LIBRARY_DIRS ${PREFIX}_LDFLAGS ${PREFIX}_CFLAGS) 0037 else () 0038 find_package(PkgConfig) 0039 if (PKG_CONFIG_FOUND) 0040 pkg_check_modules(${PREFIX} ${PKGNAME}) 0041 endif () 0042 endif () 0043 endmacro (libfind_pkg_check_modules) 0044 0045 # Do the final processing once the paths have been detected. 0046 # If include dirs are needed, ${PREFIX}_PROCESS_INCLUDES should be set to contain 0047 # all the variables, each of which contain one include directory. 0048 # Ditto for ${PREFIX}_PROCESS_LIBS and library files. 0049 # Will set ${PREFIX}_FOUND, ${PREFIX}_INCLUDE_DIRS and ${PREFIX}_LIBRARIES. 0050 # Also handles errors in case library detection was required, etc. 0051 macro (libfind_process PREFIX) 0052 # Skip processing if already processed during this run 0053 if (NOT ${PREFIX}_FOUND) 0054 # Start with the assumption that the library was found 0055 set (${PREFIX}_FOUND TRUE) 0056 0057 # Process all includes and set _FOUND to false if any are missing 0058 foreach (i ${${PREFIX}_PROCESS_INCLUDES}) 0059 if (${i}) 0060 set (${PREFIX}_INCLUDE_DIRS ${${PREFIX}_INCLUDE_DIRS} ${${i}}) 0061 mark_as_advanced(${i}) 0062 else () 0063 set (${PREFIX}_FOUND FALSE) 0064 endif () 0065 endforeach (i) 0066 0067 # Process all libraries and set _FOUND to false if any are missing 0068 foreach (i ${${PREFIX}_PROCESS_LIBS}) 0069 if (${i}) 0070 set (${PREFIX}_LIBRARIES ${${PREFIX}_LIBRARIES} ${${i}}) 0071 mark_as_advanced(${i}) 0072 else () 0073 set (${PREFIX}_FOUND FALSE) 0074 endif () 0075 endforeach (i) 0076 0077 # Print message and/or exit on fatal error 0078 if (${PREFIX}_FOUND) 0079 if (NOT ${PREFIX}_FIND_QUIETLY) 0080 message (STATUS "Found ${PREFIX} ${${PREFIX}_VERSION}") 0081 endif () 0082 else () 0083 if (${PREFIX}_FIND_REQUIRED) 0084 foreach (i ${${PREFIX}_PROCESS_INCLUDES} ${${PREFIX}_PROCESS_LIBS}) 0085 message("${i}=${${i}}") 0086 endforeach (i) 0087 message (FATAL_ERROR "Required library ${PREFIX} NOT FOUND.\nInstall the library (dev version) and try again. If the library is already installed, use ccmake to set the missing variables manually.") 0088 endif () 0089 endif () 0090 endif () 0091 endmacro (libfind_process) 0092 0093 macro(libfind_library PREFIX basename) 0094 set(TMP "") 0095 if(MSVC80) 0096 set(TMP -vc80) 0097 endif() 0098 if(MSVC90) 0099 set(TMP -vc90) 0100 endif() 0101 set(${PREFIX}_LIBNAMES ${basename}${TMP}) 0102 if(${ARGC} GREATER 2) 0103 set(${PREFIX}_LIBNAMES ${basename}${TMP}-${ARGV2}) 0104 string(REGEX REPLACE "\\." "_" TMP ${${PREFIX}_LIBNAMES}) 0105 set(${PREFIX}_LIBNAMES ${${PREFIX}_LIBNAMES} ${TMP}) 0106 endif() 0107 find_library(${PREFIX}_LIBRARY 0108 NAMES ${${PREFIX}_LIBNAMES} 0109 PATHS ${${PREFIX}_PKGCONF_LIBRARY_DIRS} 0110 ) 0111 endmacro(libfind_library) 0112