FIND_PATH(CMOCKA_INCLUDE_DIR NAMES cmocka.h)
MARK_AS_ADVANCED(CMOCKA_INCLUDE_DIR)

FIND_LIBRARY(CMOCKA_LIBRARY NAMES
    cmocka
    libcmocka
    cmockalib
)
MARK_AS_ADVANCED(CMOCKA_LIBRARY)

INCLUDE(FindPackageHandleStandardArgs)
FIND_PACKAGE_HANDLE_STANDARD_ARGS(CMocka DEFAULT_MSG CMOCKA_LIBRARY CMOCKA_INCLUDE_DIR)

if(CMOCKA_FOUND)
  SET(CMOCKA_LIBRARIES ${CMOCKA_LIBRARY})
  SET(CMOCKA_INCLUDE_DIRS ${CMOCKA_INCLUDE_DIR})
endif()