#
# Copyright (c) .NET Foundation and Contributors
# See LICENSE file in the project root for full license information.
#


# native code directory
set(BASE_PATH_FOR_THIS_MODULE "${BASE_PATH_FOR_CLASS_LIBRARIES_MODULES}/nanoFramework.Device.Can")


# set include directories
list(APPEND nanoFramework.Device.Can_INCLUDE_DIRS ${BASE_PATH_FOR_THIS_MODULE})
list(APPEND nanoFramework.Device.Can_INCLUDE_DIRS ${TARGET_BASE_LOCATION})
list(APPEND nanoFramework.Device.Can_INCLUDE_DIRS ${CMAKE_SOURCE_DIR}/src/nanoFramework.Device.Can)

# source files
set(nanoFramework.Device.Can_SRCS

    nf_device_can_native_nanoFramework_Device_Can_CanController.cpp
    nf_device_can_native.cpp

    target_nf_device_can_config.cpp
)

foreach(SRC_FILE ${nanoFramework.Device.Can_SRCS})

    set(nanoFramework.Device.Can_SRC_FILE SRC_FILE-NOTFOUND)

    find_file(nanoFramework.Device.Can_SRC_FILE ${SRC_FILE}
        PATHS 
            ${BASE_PATH_FOR_THIS_MODULE}
            ${TARGET_BASE_LOCATION}
            ${CMAKE_SOURCE_DIR}/src/nanoFramework.Device.Can

        CMAKE_FIND_ROOT_PATH_BOTH
    )

    if (BUILD_VERBOSE)
        message("${SRC_FILE} >> ${nanoFramework.Device.Can_SRC_FILE}")
    endif()
    
    list(APPEND nanoFramework.Device.Can_SOURCES ${nanoFramework.Device.Can_SRC_FILE})

endforeach()


include(FindPackageHandleStandardArgs)

FIND_PACKAGE_HANDLE_STANDARD_ARGS(nanoFramework.Device.Can DEFAULT_MSG nanoFramework.Device.Can_INCLUDE_DIRS nanoFramework.Device.Can_SOURCES)
