From 72e8629d729a578d808589c21520024d753e9b89 Mon Sep 17 00:00:00 2001 From: Noel Eck Date: Tue, 8 Nov 2016 18:11:28 -0800 Subject: [PATCH] cmake: Make sure utilities directory gets added to cmake If directories are specified with -DMODULE_LIST=blah, it's possible to skip adding the utilities directory which is needed by *most* sensor library targets in UPM. Added a check for this when using -DMODULE_LIST. Signed-off-by: Noel Eck --- src/CMakeLists.txt | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index cf49ede9..a3c343e6 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -547,12 +547,23 @@ elseif (BUILDSWIGPYTHON) file (WRITE ${CMAKE_CURRENT_BINARY_DIR}/pyupm_doxy2swig.i "// Empty doxy2swig stub") endif (BUILDDOC AND BUILDSWIGPYTHON) +# Add subdirectories from MODULE_LIST if defined +# Example -DMODULE_LIST="dfrph;rotaryencoder" if (MODULE_LIST) set(SUBDIRS ${MODULE_LIST}) set(SUBDIRS ${SUBDIRS} upm) else() + # Otherwise, add all subdirectories subdirlist(SUBDIRS ${CMAKE_CURRENT_SOURCE_DIR}) endif() + +# If the SUBDIRS list does NOT include the utilities directory, add it since +# most sensor library targets depend on utilities +if (NOT "${SUBDIRS}" MATCHES utilities) + add_subdirectory(${CMAKE_SOURCE_DIR}/src/utilities) +endif() + +# Iterate over each directory in SUBDIRS foreach(subdir ${SUBDIRS}) if(EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/${subdir}/CMakeLists.txt) add_subdirectory(${subdir})