Skip to content

Commit 5d64964

Browse files
committed
Support for legacy Arduino libraries w/o src
1 parent 7f17263 commit 5d64964

File tree

1 file changed

+14
-5
lines changed

1 file changed

+14
-5
lines changed

ArduinoLibrary.cmake

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -31,11 +31,20 @@ function(arduino_library LIB_NAME LIB_PATH)
3131
endif()
3232
set(LIB_PATH "${CLONE_DIR}")
3333
endif()
34-
set(INC_DIR "${LIB_PATH}/src")
35-
file(GLOB SRC_FILES
36-
"${LIB_PATH}/src/*.c"
37-
"${LIB_PATH}/src/*.cpp"
38-
)
34+
if(EXISTS "${LIB_PATH}/src")
35+
set(INC_DIR "${LIB_PATH}/src")
36+
file(GLOB_RECURSE SRC_FILES
37+
"${LIB_PATH}/src/*.c"
38+
"${LIB_PATH}/src/*.cpp"
39+
)
40+
else()
41+
# Legacy libraries without src folder
42+
set(INC_DIR "${LIB_PATH}")
43+
file(GLOB_RECURSE SRC_FILES
44+
"${LIB_PATH}/*.c"
45+
"${LIB_PATH}/*.cpp"
46+
)
47+
endif()
3948
# Only create library if there are source files
4049
if(SRC_FILES)
4150
add_library(${LIB_NAME} STATIC ${SRC_FILES})

0 commit comments

Comments
 (0)