﻿FIND_PATH(COLLECTC_INCLUDE_DIR collectc/list.h)
FIND_LIBRARY(COLLECTC_LIBRARY NAMES collectc)

# Handle the QUIETLY and REQUIRED arguments and set COLLECTC_FOUND to TRUE if all listed variables are TRUE.
INCLUDE(FindPackageHandleStandardArgs)

FIND_PACKAGE_HANDLE_STANDARD_ARGS(Collectc REQUIRED_VARS COLLECTC_LIBRARY COLLECTC_INCLUDE_DIR)

# Copy the results to the output variables.
if (Collectc_FOUND)
    SET(COLLECTC_LIBRARIES ${COLLECTC_LIBRARY})
    SET(COLLECTC_INCLUDE_DIRS ${COLLECTC_INCLUDE_DIR})
    if (NOT TARGET Collectc::Collectc)
        add_library(Collectc::Collectc UNKNOWN IMPORTED)
        set_target_properties(Collectc::Collectc PROPERTIES INTERFACE_INCLUDE_DIRECTORIES "${COLLECTC_INCLUDE_DIR}")
        set_property(TARGET Collectc::Collectc APPEND PROPERTY IMPORTED_LOCATION "${COLLECTC_LIBRARY}")
    endif ()
else (Collectc_FOUND)
    SET(COLLECTC_LIBRARIES)
    SET(COLLECTC_INCLUDE_DIRS)
endif (Collectc_FOUND)
MARK_AS_ADVANCED(COLLECTC_INCLUDE_DIRS COLLECTC_LIBRARIES)