PCL_SUBSUBSYS_DEPEND seems to be a copy of PCL_SUBSUBSYS_DEPEND - the only difference is, that the parameter _name is getting the prefix _parent. This could be handled by a simple optional parameter.
By combining these both methods we are preventing issues like introduced in #1786, where only one of both methods is getting an adjustment (I think the part Include directories are now added for opt dependencies should be added for both methods).
To show the differences between both methods (based on #5378):
-macro(PCL_SUBSYS_DEPEND _var _name)
+macro(PCL_SUBSUBSYS_DEPEND _var _parent _name)
set(options)
- set(oneValueArgs)
+ set(parentArg)
set(multiValueArgs DEPS EXT_DEPS OPT_DEPS)
- cmake_parse_arguments(ARGS "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN})
+ cmake_parse_arguments(ARGS "${options}" "${parentArg}" "${multiValueArgs}" ${ARGN})
if(ARGS_UNPARSED_ARGUMENTS)
- message(FATAL_ERROR "Unknown arguments given to PCL_SUBSYS_DEPEND: ${ARGS_UNPARSED_ARGUMENTS}")
+ message(FATAL_ERROR "Unknown arguments given to PCL_SUBSUBSYS_DEPEND: ${ARGS_UNPARSED_ARGUMENTS}")
endif()
if(ARGS_DEPS)
- SET_IN_GLOBAL_MAP(PCL_SUBSYS_DEPS ${_name} "${ARGS_DEPS}")
+ SET_IN_GLOBAL_MAP(PCL_SUBSYS_DEPS ${_parent}_${_name} "${ARGS_DEPS}")
endif()
if(ARGS_EXT_DEPS)
- SET_IN_GLOBAL_MAP(PCL_SUBSYS_EXT_DEPS ${_name} "${ARGS_EXT_DEPS}")
+ SET_IN_GLOBAL_MAP(PCL_SUBSYS_EXT_DEPS ${_parent}_${_name} "${ARGS_EXT_DEPS}")
endif()
if(ARGS_OPT_DEPS)
- SET_IN_GLOBAL_MAP(PCL_SUBSYS_OPT_DEPS ${_name} "${ARGS_OPT_DEPS}")
+ SET_IN_GLOBAL_MAP(PCL_SUBSYS_OPT_DEPS ${_parent}_${_name} "${ARGS_OPT_DEPS}")
endif()
- GET_IN_MAP(subsys_status PCL_SUBSYS_HYPERSTATUS ${_name})
+ GET_IN_MAP(subsys_status PCL_SUBSYS_HYPERSTATUS ${_parent}_${_name})
if(${_var} AND (NOT ("${subsys_status}" STREQUAL "AUTO_OFF")))
if(ARGS_DEPS)
foreach(_dep ${ARGS_DEPS})
PCL_GET_SUBSYS_STATUS(_status ${_dep})
if(NOT _status)
set(${_var} FALSE)
- PCL_SET_SUBSYS_STATUS(${_name} FALSE "Requires ${_dep}.")
+ PCL_SET_SUBSYS_STATUS(${_parent}_${_name} FALSE "Requires ${_dep}.")
else()
PCL_GET_SUBSYS_INCLUDE_DIR(_include_dir ${_dep})
include_directories(${PROJECT_SOURCE_DIR}/${_include_dir}/include)
if(ARGS_EXT_DEPS)
foreach(_dep ${ARGS_EXT_DEPS})
string(TOUPPER "${_dep}_found" EXT_DEP_FOUND)
- #Variable EXT_DEP_FOUND expands to ie. QHULL_FOUND which in turn is then used to see if the EXT_DEPS is found.
if(NOT ${EXT_DEP_FOUND})
set(${_var} FALSE)
- PCL_SET_SUBSYS_STATUS(${_name} FALSE "Requires external library ${_dep}.")
+ PCL_SET_SUBSYS_STATUS(${_parent}_${_name} FALSE "Requires external library ${_dep}.")
endif()
endforeach()
endif()
- if(ARGS_OPT_DEPS)
- foreach(_dep ${ARGS_OPT_DEPS})
- PCL_GET_SUBSYS_INCLUDE_DIR(_include_dir ${_dep})
- include_directories(${PROJECT_SOURCE_DIR}/${_include_dir}/include)
- endforeach()
- endif()
endif()
endmacro()
PCL_SUBSUBSYS_DEPENDseems to be a copy ofPCL_SUBSUBSYS_DEPEND- the only difference is, that the parameter_nameis getting the prefix_parent. This could be handled by a simple optional parameter.By combining these both methods we are preventing issues like introduced in #1786, where only one of both methods is getting an adjustment (I think the part
Include directories are now added for opt dependenciesshould be added for both methods).To show the differences between both methods (based on #5378):