-
Notifications
You must be signed in to change notification settings - Fork 4
/
pico_enc28j60_import.cmake
31 lines (24 loc) · 1.33 KB
/
pico_enc28j60_import.cmake
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
# This is a copy of <PICO_ENC28J60_PATH>/external/pico_enc28j60_import.cmake
# This can be dropped into an external project to help locate pico-enc28j60
# It should be include()ed prior to project()
if (DEFINED ENV{PICO_ENC28J60_PATH} AND (NOT PICO_ENC28J60_PATH))
set(PICO_ENC28J60_PATH $ENV{PICO_ENC28J60_PATH})
message("Using PICO_ENC28J60_PATH from environment ('${PICO_ENC28J60_PATH}')")
endif ()
if (NOT PICO_ENC28J60_PATH)
if (PICO_SDK_PATH AND EXISTS "${PICO_SDK_PATH}/../pico-enc28j60")
set(PICO_ENC28J60_PATH ${PICO_SDK_PATH}/../pico-enc28j60)
message("Defaulting PICO_ENC28J60_PATH as sibling of PICO_SDK_PATH: ${PICO_ENC28J60_PATH}")
else()
message(FATAL_ERROR
"PICO ENC28J60 location was not specified. Please set PICO_ENC28J60_PATH or set PICO_ENC28J60_FETCH_FROM_GIT to on to fetch from git."
)
endif()
endif ()
set(PICO_ENC28J60_PATH "${PICO_ENC28J60_PATH}" CACHE PATH "Path to the PICO ENC28J60")
get_filename_component(PICO_ENC28J60_PATH "${PICO_ENC28J60_PATH}" REALPATH BASE_DIR "${CMAKE_BINARY_DIR}")
if (NOT EXISTS ${PICO_ENC28J60_PATH})
message(FATAL_ERROR "Directory '${PICO_ENC28J60_PATH}' not found")
endif ()
set(PICO_ENC28J60_PATH ${PICO_ENC28J60_PATH} CACHE PATH "Path to the PICO ENC28J60" FORCE)
add_subdirectory(${PICO_ENC28J60_PATH} pico_enc28j60)