Skip to content

Commit 07d927a

Browse files
alvasMancodebot
authored andcommitted
cmake: look for plugins in the plugin folder
1 parent 2f72241 commit 07d927a

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed

CMakeLists.txt

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,7 @@ option(ENABLE_DPDK "Enable DPDK" OFF)
6767
option(ENABLE_LIBNUMA "Enable LibNUMA" OFF)
6868
option(ENABLE_EXPORT "Enable PIC and export libraries" OFF)
6969
option(ENABLE_TRX_DRIVER "Enable Amarisoft TRX driver library" OFF)
70+
option(ENABLE_PLUGINS "Compile plugins in the plugin folder" OFF)
7071
option(BUILD_TESTS "Compile tests" ON)
7172
option(ENABLE_GPROF "Enable gprof" OFF)
7273
option(USE_PHY_TESTVECTORS "Enable testvector PHY tests" ON)
@@ -439,6 +440,22 @@ if (BUILD_TESTS)
439440
add_subdirectory(tests/benchmarks)
440441
endif (BUILD_TESTS)
441442

443+
if (ENABLE_PLUGINS)
444+
# Discover all subdirectories in the plugin directory (but not recursively)
445+
file(GLOB SUBDIRS RELATIVE ${CMAKE_SOURCE_DIR} ${CMAKE_SOURCE_DIR}/plugins/*)
446+
447+
# Loop through each plugin subdirectory
448+
foreach(subdir ${SUBDIRS})
449+
# Check if it's a directory and contains a CMakeLists.txt file
450+
if(IS_DIRECTORY ${CMAKE_SOURCE_DIR}/${subdir} AND EXISTS ${CMAKE_SOURCE_DIR}/${subdir}/CMakeLists.txt)
451+
message(STATUS "Adding subdirectory: ${subdir}")
452+
add_subdirectory(${subdir})
453+
endif()
454+
endforeach()
455+
endif ()
456+
457+
458+
442459
########################################################################
443460
# Export (selected) libraries
444461
########################################################################

0 commit comments

Comments
 (0)