Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[cmake] Combine PCL_SUBSUBSYS_DEPEND with PCL_SUBSYS_DEPEND #5379

Closed
SunBlack opened this issue Aug 14, 2022 · 0 comments · Fixed by #5387
Closed

[cmake] Combine PCL_SUBSUBSYS_DEPEND with PCL_SUBSYS_DEPEND #5379

SunBlack opened this issue Aug 14, 2022 · 0 comments · Fixed by #5387
Labels

Comments

@SunBlack
Copy link
Contributor

SunBlack commented Aug 14, 2022

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()
@SunBlack SunBlack added the status: triage Labels incomplete label Aug 14, 2022
@SunBlack SunBlack changed the title [custom] Provide a general summary of the issue [cmake] Combine PCL_SUBSUBSYS_DEPEND with PCL_SUBSYS_DEPEND Aug 14, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants