Skip to content

Commit 9fcd95c

Browse files
committed
Checks for empty line in addon config. Add more src include directories
1 parent 894a9fe commit 9fcd95c

2 files changed

Lines changed: 19 additions & 2 deletions

File tree

apps/devApps/CMakeExample/CMakeLists.txt

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -317,8 +317,10 @@ message(VERBOSE "Project - checking for addons.make file.")
317317
if(EXISTS "${OF_PROJECT_DIRECTORY}/addons.make")
318318
file(STRINGS "${OF_PROJECT_DIRECTORY}/addons.make" TMP_ADDON_NAMES)
319319
foreach(TMP_ADDON_TO_INCLUDE IN LISTS TMP_ADDON_NAMES)
320-
message(STATUS "ADDING addon ${TMP_ADDON_TO_INCLUDE}")
321-
of_addon("${TMP_ADDON_TO_INCLUDE}")
320+
if(NOT "${TMP_ADDON_TO_INCLUDE}" STREQUAL "")
321+
message(STATUS "ADDING addon ${TMP_ADDON_TO_INCLUDE}")
322+
of_addon("${TMP_ADDON_TO_INCLUDE}")
323+
endif()
322324
endforeach()
323325
endif()
324326
# add_library(${OF_ADDONS} INTERFACE)

cmake/ofAddons.cmake

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,15 @@ function(of_addon ADDON_NAME)
1111
of_check_of_root_path()
1212
of_set_global_os_vars()
1313

14+
if("${ADDON_NAME}" STREQUAL "")
15+
message(WARNING "of_addon name is EMPTY!! Not adding.")
16+
return()
17+
endif()
18+
1419
set(ADDON_ROOT "${OF_ROOT_DIRECTORY}/addons/${ADDON_NAME}")
1520

21+
22+
1623
#TODO: If the addon does not exist, maybe we could use fetch content?
1724
if(EXISTS "${ADDON_ROOT}")
1825

@@ -40,6 +47,13 @@ function(of_addon ADDON_NAME)
4047
list(APPEND PARSED_INCLUDES_ABS "${ADDON_ROOT}/src" )
4148
endif()
4249

50+
# account for addons that aren't structured according to the libs they are meant to include
51+
# ie. ofxXmlSettings and ofxVectorGraphics
52+
if( EXISTS "${ADDON_ROOT}/libs" )
53+
# of_get_subdirs_recursive("${ADDON_ROOT}/src" PARSED_INCLUDES_ABS)
54+
list(APPEND PARSED_INCLUDES_ABS "${ADDON_ROOT}/libs" )
55+
endif()
56+
4357
# message(VERBOSE "of_addon ${ADDON_NAME}: Going to parse addon includes via directories")
4458
# of_get_all_header_files(${ADDON_ROOT} PARSED_ADDON_HEADERS )
4559

@@ -79,6 +93,7 @@ function(of_addon ADDON_NAME)
7993
file(GLOB TMP_ADDON_LIBS_LIB_DIRECTORIES CONFIGURE_DEPENDS "${lib_dir}/*")
8094
list(TRANSFORM TMP_ADDON_LIBS_LIB_DIRECTORIES REPLACE "\\\\" "/") # CMake 3.16 OK
8195
# don't consider listing directories named lib or license
96+
# it would probably be fine, but adds so many extra paths to a project, ie. Xcode
8297
list(FILTER TMP_ADDON_LIBS_LIB_DIRECTORIES EXCLUDE REGEX "(^|/)(lib|license)/?$")
8398
foreach(lib_lib_dir ${TMP_ADDON_LIBS_LIB_DIRECTORIES})
8499
if(IS_DIRECTORY "${lib_lib_dir}")

0 commit comments

Comments
 (0)