1 # FindLibSolv - Find libsolv headers and libraries.
5 # SET( LibSolv_USE_STATIC_LIBS OFF )
6 # FIND_PACKAGE( LibSolv REQUIRED ext )
8 # INCLUDE_DIRECTORIES( ${LibSolv_INCLUDE_DIRS} )
9 # TARGET_LINK_LIBRARIES( ... ${LibSolv_LIBRARIES} )
12 # Variables used by this module need to be set before calling find_package
13 # (not that they are cmale cased like the modiulemane itself):
15 # LibSolv_USE_STATIC_LIBS Can be set to ON to force the use of the static
16 # libsolv libraries. Defaults to OFF.
18 # Supported components:
20 # ext Also include libsolvext
22 # Variables provided by this module:
24 # LibSolv_FOUND Include dir, libsolv and all extra libraries
25 # specified in the COMPONENTS list were found.
27 # LibSolv_LIBRARIES Link to these to use all the libraries you specified.
29 # LibSolv_INCLUDE_DIRS Include directories.
31 # For each component you specify in find_package(), the following (UPPER-CASE)
32 # variables are set to pick and choose components instead of just using LibSolv_LIBRARIES:
34 # LIBSOLV_FOUND TRUE if libsolv was found
35 # LIBSOLV_LIBRARY libsolv libraries
37 # LIBSOLV_${COMPONENT}_FOUND TRUE if the library component was found
38 # LIBSOLV_${COMPONENT}_LIBRARY The libraries for the specified component
41 # Support preference of static libs by adjusting CMAKE_FIND_LIBRARY_SUFFIXES
42 IF(LibSolv_USE_STATIC_LIBS)
43 SET( _ORIG_CMAKE_FIND_LIBRARY_SUFFIXES ${CMAKE_FIND_LIBRARY_SUFFIXES})
44 SET(CMAKE_FIND_LIBRARY_SUFFIXES .a )
47 # Look for the header files
48 UNSET(LibSolv_INCLUDE_DIRS CACHE)
49 FIND_PATH(LibSolv_INCLUDE_DIRS NAMES solv/solvable.h)
51 # Look for the core library
52 UNSET(LIBSOLV_LIBRARY CACHE)
53 FIND_LIBRARY(LIBSOLV_LIBRARY NAMES solv)
54 FIND_PACKAGE_HANDLE_STANDARD_ARGS(LibSolv DEFAULT_MSG LIBSOLV_LIBRARY LibSolv_INCLUDE_DIRS)
60 # Prepare return values and collectiong more components
61 SET(LibSolv_FOUND ${LIBSOLV_FOUND})
62 SET(LibSolv_LIBRARIES ${LIBSOLV_LIBRARY})
70 FOREACH(COMPONENT ${LibSolv_FIND_COMPONENTS})
71 STRING(TOUPPER ${COMPONENT} _UPPERCOMPONENT)
72 UNSET(LIBSOLV_${_UPPERCOMPONENT}_LIBRARY CACHE)
73 FIND_LIBRARY(LIBSOLV_${_UPPERCOMPONENT}_LIBRARY NAMES solv${COMPONENT})
74 SET(LibSolv_${COMPONENT}_FIND_REQUIRED ${LibSolv_FIND_REQUIRED})
75 SET(LibSolv_${COMPONENT}_FIND_QUIETLY ${LibSolv_FIND_QUIETLY})
76 FIND_PACKAGE_HANDLE_STANDARD_ARGS(LibSolv_${COMPONENT} DEFAULT_MSG LIBSOLV_${_UPPERCOMPONENT}_LIBRARY)
78 LIBSOLV_${_UPPERCOMPONENT}_FOUND
79 LIBSOLV_${_UPPERCOMPONENT}_LIBRARY
81 IF(LIBSOLV_${_UPPERCOMPONENT}_FOUND)
82 SET(LibSolv_LIBRARIES ${LibSolv_LIBRARIES} ${LIBSOLV_${_UPPERCOMPONENT}_LIBRARY})
84 SET(LibSolv_FOUND FALSE)
88 # restore CMAKE_FIND_LIBRARY_SUFFIXES
89 IF(Solv_USE_STATIC_LIBS)
90 SET(CMAKE_FIND_LIBRARY_SUFFIXES ${_ORIG_CMAKE_FIND_LIBRARY_SUFFIXES} )
93 IF(LibSolv_FOUND AND NOT LibSolv_FIND_QUIETLY)
94 MESSAGE(STATUS "Found LibSolv: ${LibSolv_INCLUDE_DIRS} ${LibSolv_LIBRARIES}")