fix finding the library
[platform/upstream/libsolv.git] / cmake / modules / FindCheck.cmake
1
2 FIND_PATH(CHECK_INCLUDE_DIR NAMES check.h)
3 MARK_AS_ADVANCED(CHECK_INCLUDE_DIR)
4
5 # Look for the library.
6 FIND_LIBRARY(CHECK_LIBRARY NAMES check)
7 MARK_AS_ADVANCED(CHECK_LIBRARY)
8
9 # Copy the results to the output variables.
10 IF(CHECK_INCLUDE_DIR AND CHECK_LIBRARY)
11   SET(CHECK_FOUND 1)
12   SET(CHECK_LIBRARIES ${CHECK_LIBRARY})
13   SET(CHECK_INCLUDE_DIRS ${CHECK_INCLUDE_DIR})
14 ELSE(CHECK_INCLUDE_DIR AND CHECK_LIBRARY)
15   SET(CHECK_FOUND 0)
16   SET(CHECK_LIBRARIES)
17   SET(CHECK_INCLUDE_DIRS)
18 ENDIF(CHECK_INCLUDE_DIR AND CHECK_LIBRARY)
19
20 # Report the results.
21 IF(NOT CHECK_FOUND)
22   SET(CHECK_DIR_MESSAGE
23     "check C unit testing library was not found. Install check and check-devel.")
24   IF(NOT CHECK_FIND_QUIETLY)
25     MESSAGE(STATUS "${CHECK_DIR_MESSAGE}")
26   ELSE(NOT CHECK_FIND_QUIETLY)
27     IF(CHECK_FIND_REQUIRED)
28       MESSAGE(FATAL_ERROR "${CHECK_DIR_MESSAGE}")
29     ENDIF(CHECK_FIND_REQUIRED)
30   ENDIF(NOT CHECK_FIND_QUIETLY)
31 ELSE(NOT CHECK_FOUND)
32   MESSAGE(STATUS "check C unit testing library: ${CHECK_LIBRARIES}")
33 ENDIF(NOT CHECK_FOUND)