xref: /freebsd/contrib/libcbor/CMakeModules/FindCMocka.cmake (revision 3332f1b444d4a73238e9f59cca27bfc95fe936bd)
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
24find_path(CMOCKA_INCLUDE_DIR
25    NAMES
26        cmocka.h
27    PATHS
28        ${CMOCKA_ROOT_DIR}/include
29)
30
31find_library(CMOCKA_LIBRARY
32    NAMES
33        cmocka cmocka_shared
34    PATHS
35        ${CMOCKA_ROOT_DIR}/include
36)
37
38if (CMOCKA_LIBRARY)
39  set(CMOCKA_LIBRARIES
40      ${CMOCKA_LIBRARIES}
41      ${CMOCKA_LIBRARY}
42  )
43endif (CMOCKA_LIBRARY)
44
45include(FindPackageHandleStandardArgs)
46find_package_handle_standard_args(CMocka DEFAULT_MSG CMOCKA_LIBRARIES CMOCKA_INCLUDE_DIR)
47
48# show the CMOCKA_INCLUDE_DIR and CMOCKA_LIBRARIES variables only in the advanced view
49mark_as_advanced(CMOCKA_INCLUDE_DIR CMOCKA_LIBRARIES)
50