FindCMocka.cmake 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. # - Try to find CMocka
  2. # Once done this will define
  3. #
  4. # CMOCKA_ROOT_DIR - Set this variable to the root installation of CMocka
  5. #
  6. # Read-Only variables:
  7. # CMOCKA_FOUND - system has CMocka
  8. # CMOCKA_INCLUDE_DIR - the CMocka include directory
  9. # CMOCKA_LIBRARIES - Link these to use CMocka
  10. # CMOCKA_DEFINITIONS - Compiler switches required for using CMocka
  11. #
  12. #=============================================================================
  13. # Copyright (c) 2011-2012 Andreas Schneider <asn@cryptomilk.org>
  14. #
  15. # Distributed under the OSI-approved BSD License (the "License");
  16. # see accompanying file Copyright.txt for details.
  17. #
  18. # This software is distributed WITHOUT ANY WARRANTY; without even the
  19. # implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
  20. # See the License for more information.
  21. #=============================================================================
  22. #
  23. find_path(CMOCKA_INCLUDE_DIR
  24. NAMES
  25. cmocka.h
  26. PATHS
  27. ${CMOCKA_ROOT_DIR}/include
  28. )
  29. find_library(CMOCKA_LIBRARY
  30. NAMES
  31. cmocka
  32. PATHS
  33. ${CMOCKA_ROOT_DIR}/lib
  34. )
  35. if (CMOCKA_LIBRARY)
  36. set(CMOCKA_LIBRARIES
  37. ${CMOCKA_LIBRARIES}
  38. ${CMOCKA_LIBRARY}
  39. )
  40. endif (CMOCKA_LIBRARY)
  41. include(FindPackageHandleStandardArgs)
  42. find_package_handle_standard_args(CMocka DEFAULT_MSG CMOCKA_LIBRARIES CMOCKA_INCLUDE_DIR)
  43. # show the CMOCKA_INCLUDE_DIR and CMOCKA_LIBRARIES variables only in the advanced view
  44. mark_as_advanced(CMOCKA_INCLUDE_DIR CMOCKA_LIBRARIES)