FindCheck.cmake 2.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374
  1. # Find CHECK libraries
  2. #
  3. # This module defines:
  4. # CHECK_FOUND - system has check
  5. # CHECK_INCLUDE_DIRS - the check include directory
  6. # CHECK_LIBRARIES - check library
  7. #
  8. # If you have libcheck installed in a non-standard place, you can define
  9. # CHECK_PREFIX to tell cmake where it is.
  10. if(CHECK_PREFIX)
  11. set(CHECK_PREFIX_INC "${CHECK_PREFIX}/include")
  12. set(CHECK_PREFIX_LIB "${CHECK_PREFIX}/lib")
  13. endif()
  14. find_path(CHECK_INCLUDE_DIRS check.h "${CHECK_PREFIX_INC}")
  15. find_library(CHECK_LIBRARY check HINTS "${CHECK_PREFIX_LIB}")
  16. if(MSVC)
  17. find_library(COMPAT_LIBRARY compat HINTS "${CHECK_PREFIX_LIB}")
  18. set(CHECK_LIBRARIES "${CHECK_LIBRARY}" "${COMPAT_LIBRARY}")
  19. include(FindPackageHandleStandardArgs)
  20. find_package_handle_standard_args(CHECK DEFAULT_MSG CHECK_INCLUDE_DIRS CHECK_LIBRARIES)
  21. mark_as_advanced(CHECK_INCLUDE_DIRS CHECK_LIBRARIES)
  22. else()
  23. INCLUDE( FindPkgConfig )
  24. IF ( Check_FIND_REQUIRED )
  25. SET( _pkgconfig_REQUIRED "REQUIRED" )
  26. ELSE( Check_FIND_REQUIRED )
  27. SET( _pkgconfig_REQUIRED "" )
  28. ENDIF ( Check_FIND_REQUIRED )
  29. IF ( CHECK_MIN_VERSION )
  30. PKG_SEARCH_MODULE( CHECK ${_pkgconfig_REQUIRED} check>=${CHECK_MIN_VERSION} )
  31. ELSE ( CHECK_MIN_VERSION )
  32. PKG_SEARCH_MODULE( CHECK ${_pkgconfig_REQUIRED} check )
  33. ENDIF ( CHECK_MIN_VERSION )
  34. # Look for CHECK include dir and libraries
  35. IF( NOT CHECK_FOUND AND NOT PKG_CONFIG_FOUND )
  36. SET(CHECK_LIBRARIES "CHECK_LIBRARIES-NOTFOUND")
  37. FIND_LIBRARY( SUBUNIT_LIBRARY NAMES subunit HINTS "${CHECK_PREFIX_LIB}")
  38. IF ( CHECK_INCLUDE_DIRS AND CHECK_LIBRARY )
  39. SET(CHECK_LIBRARIES "${CHECK_LIBRARY}")
  40. if ( SUBUNIT_LIBRARY )
  41. LIST(APPEND CHECK_LIBRARIES "${SUBUNIT_LIBRARY}")
  42. endif()
  43. SET( CHECK_FOUND 1 )
  44. IF ( NOT Check_FIND_QUIETLY )
  45. MESSAGE ( STATUS "Found CHECK: ${CHECK_LIBRARIES}" )
  46. ENDIF ( NOT Check_FIND_QUIETLY )
  47. ELSE ( CHECK_INCLUDE_DIRS AND CHECK_LIBRARIES )
  48. IF ( Check_FIND_REQUIRED )
  49. MESSAGE( FATAL_ERROR "Could NOT find CHECK" )
  50. ELSE ( Check_FIND_REQUIRED )
  51. IF ( NOT Check_FIND_QUIETLY )
  52. MESSAGE( STATUS "Could NOT find CHECK" )
  53. ENDIF ( NOT Check_FIND_QUIETLY )
  54. ENDIF ( Check_FIND_REQUIRED )
  55. ENDIF ( CHECK_INCLUDE_DIRS AND CHECK_LIBRARIES )
  56. ENDIF( NOT CHECK_FOUND AND NOT PKG_CONFIG_FOUND )
  57. # Hide advanced variables from CMake GUIs
  58. MARK_AS_ADVANCED( CHECK_INCLUDE_DIRS CHECK_LIBRARIES )
  59. endif()