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_package(PkgConfig QUIET) 25if(PKG_CONFIG_FOUND) 26 pkg_check_modules(PC_CMOCKA QUIET cmocka) 27 set(CMOCKA_DEFINITIONS ${PC_CMOCKA_CFLAGS_OTHER}) 28endif() 29 30find_path(CMOCKA_INCLUDE_DIR 31 HINTS ${PC_CMOCKA_INCLUDEDIR} ${PC_CMOCKA_INCLUDE_DIRS} 32 NAMES 33 cmocka.h 34 PATHS 35 ${CMOCKA_ROOT_DIR}/include 36) 37 38find_library(CMOCKA_LIBRARY 39 HINTS ${PC_CMOCKA_LIBDIR} ${PC_CMOCKA_LIBRARY_DIRS} 40 NAMES 41 cmocka cmocka_shared 42 PATHS 43 ${CMOCKA_ROOT_DIR}/include 44) 45 46if (CMOCKA_LIBRARY) 47 set(CMOCKA_LIBRARIES 48 ${CMOCKA_LIBRARIES} 49 ${CMOCKA_LIBRARY} 50 ) 51endif (CMOCKA_LIBRARY) 52 53include(FindPackageHandleStandardArgs) 54find_package_handle_standard_args(CMocka DEFAULT_MSG CMOCKA_LIBRARIES CMOCKA_INCLUDE_DIR) 55 56# show the CMOCKA_INCLUDE_DIR and CMOCKA_LIBRARIES variables only in the advanced view 57mark_as_advanced(CMOCKA_INCLUDE_DIR CMOCKA_LIBRARIES) 58