| 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 <[email protected]> |
| 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 |
|
| 24 |
set(_CMOCKA_ROOT_HINTS |
| 25 |
) |
| 26 |
|
| 27 |
set(_CMOCKA_ROOT_PATHS |
| 28 |
"$ENV{PROGRAMFILES}/cmocka" |
| 29 |
) |
| 30 |
|
| 31 |
find_path(CMOCKA_ROOT_DIR |
| 32 |
NAMES |
| 33 |
include/cmocka.h |
| 34 |
HINTS |
| 35 |
${_CMOCKA_ROOT_HINTS} |
| 36 |
PATHS |
| 37 |
${_CMOCKA_ROOT_PATHS} |
| 38 |
) |
| 39 |
mark_as_advanced(CMOCKA_ROOT_DIR) |
| 40 |
|
| 41 |
find_path(CMOCKA_INCLUDE_DIR |
| 42 |
NAMES |
| 43 |
cmocka.h |
| 44 |
PATHS |
| 45 |
${CMOCKA_ROOT_DIR}/include |
| 46 |
) |
| 47 |
|
| 48 |
find_library(CMOCKA_LIBRARY |
| 49 |
NAMES |
| 50 |
cmocka |
| 51 |
PATHS |
| 52 |
${CMOCKA_ROOT_DIR}/lib |
| 53 |
) |
| 54 |
|
| 55 |
if (CMOCKA_LIBRARY) |
| 56 |
set(CMOCKA_LIBRARIES |
| 57 |
${CMOCKA_LIBRARIES} |
| 58 |
${CMOCKA_LIBRARY} |
| 59 |
) |
| 60 |
endif (CMOCKA_LIBRARY) |
| 61 |
|
| 62 |
include(FindPackageHandleStandardArgs) |
| 63 |
find_package_handle_standard_args(CMocka DEFAULT_MSG CMOCKA_LIBRARIES CMOCKA_INCLUDE_DIR) |
| 64 |
|
| 65 |
# show the CMOCKA_INCLUDE_DIR and CMOCKA_LIBRARIES variables only in the advanced view |
| 66 |
mark_as_advanced(CMOCKA_INCLUDE_DIR CMOCKA_LIBRARIES) |