find_path(LIBMAGIC_INCLUDE_DIR magic.h) find_library(LIBMAGIC_LIBRARY NAMES magic) if (LIBMAGIC_INCLUDE_DIR AND LIBMAGIC_LIBRARY) set(LIBMAGIC_FOUND TRUE) endif (LIBMAGIC_INCLUDE_DIR AND LIBMAGIC_LIBRARY) find_package_handle_standard_args("libmagic" DEFAULT_MSG LIBMAGIC_LIBRARY LIBMAGIC_INCLUDE_DIR ) mark_as_advanced( LIBMAGIC_INCLUDE_DIR LIBMAGIC_LIBRARY LIBMAGIC_FOUND )