FindCheck.cmake 1.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  1. # - Try to find the CHECK libraries
  2. # Once done this will define
  3. #
  4. # CHECK_FOUND - system has check
  5. # CHECK_INCLUDE_DIRS - the check include directory
  6. # CHECK_LIBRARIES - check library
  7. #
  8. # Copyright (c) 2007 Daniel Gollub <gollub@b1-systems.de>
  9. # Copyright (c) 2007-2009 Bjoern Ricks <bjoern.ricks@gmail.com>
  10. #
  11. # Redistribution and use is allowed according to the terms of the New
  12. # BSD license.
  13. # For details see the accompanying COPYING-CMAKE-SCRIPTS file.
  14. INCLUDE( FindPkgConfig )
  15. IF ( Check_FIND_REQUIRED )
  16. SET( _pkgconfig_REQUIRED "REQUIRED" )
  17. ELSE( Check_FIND_REQUIRED )
  18. SET( _pkgconfig_REQUIRED "" )
  19. ENDIF ( Check_FIND_REQUIRED )
  20. if(NOT MSVC)
  21. IF ( CHECK_MIN_VERSION )
  22. PKG_SEARCH_MODULE( CHECK ${_pkgconfig_REQUIRED} check>=${CHECK_MIN_VERSION} )
  23. ELSE ( CHECK_MIN_VERSION )
  24. PKG_SEARCH_MODULE( CHECK ${_pkgconfig_REQUIRED} check )
  25. ENDIF ( CHECK_MIN_VERSION )
  26. endif()
  27. # Look for CHECK include dir and libraries
  28. IF( NOT CHECK_FOUND AND NOT PKG_CONFIG_FOUND )
  29. FIND_PATH( CHECK_INCLUDE_DIRS check.h )
  30. FIND_LIBRARY( CHECK_LIBRARIES NAMES check )
  31. if (MSVC)
  32. FIND_LIBRARY( CHECK_COMPAT_LIBRARIES NAMES compat )
  33. endif()
  34. IF ( CHECK_INCLUDE_DIRS AND CHECK_LIBRARIES )
  35. if ( CHECK_COMPAT_LIBRARIES )
  36. LIST(APPEND CHECK_LIBRARIES "${CHECK_COMPAT_LIBRARIES}")
  37. endif()
  38. SET( CHECK_FOUND 1 )
  39. IF ( NOT Check_FIND_QUIETLY )
  40. MESSAGE ( STATUS "Found CHECK: ${CHECK_LIBRARIES}" )
  41. ENDIF ( NOT Check_FIND_QUIETLY )
  42. ELSE ( CHECK_INCLUDE_DIRS AND CHECK_LIBRARIES )
  43. IF ( Check_FIND_REQUIRED )
  44. MESSAGE( FATAL_ERROR "Could NOT find CHECK" )
  45. ELSE ( Check_FIND_REQUIRED )
  46. IF ( NOT Check_FIND_QUIETLY )
  47. MESSAGE( STATUS "Could NOT find CHECK" )
  48. ENDIF ( NOT Check_FIND_QUIETLY )
  49. ENDIF ( Check_FIND_REQUIRED )
  50. ENDIF ( CHECK_INCLUDE_DIRS AND CHECK_LIBRARIES )
  51. ENDIF( NOT CHECK_FOUND AND NOT PKG_CONFIG_FOUND )
  52. # Hide advanced variables from CMake GUIs
  53. MARK_AS_ADVANCED( CHECK_INCLUDE_DIRS CHECK_LIBRARIES )