0030456: Make OCCT_CHECK_AND_UNSET_GROUP more general
authorapn <apn@opencascade.com>
Fri, 19 Jul 2019 13:25:59 +0000 (16:25 +0300)
committerapn <apn@opencascade.com>
Tue, 22 Oct 2019 12:15:41 +0000 (15:15 +0300)
Modify OCCT_CHECK_AND_UNSET_GROUP function to allow unset any group of variables

adm/cmake/occt_macros.cmake

index 8220ecd..0a38794 100644 (file)
@@ -12,18 +12,12 @@ macro (OCCT_CHECK_AND_UNSET VARNAME)
   endif()
 endmacro()
 
-macro (OCCT_CHECK_AND_UNSET_GROUP VARNAME)
-  OCCT_CHECK_AND_UNSET ("${VARNAME}_DIR")
-
-  OCCT_CHECK_AND_UNSET ("${VARNAME}_INCLUDE_DIR")
-
-  OCCT_CHECK_AND_UNSET ("${VARNAME}_LIBRARY")
-  OCCT_CHECK_AND_UNSET ("${VARNAME}_LIBRARY_DIR")
-
-  if (WIN32)
-    OCCT_CHECK_AND_UNSET ("${VARNAME}_DLL")
-    OCCT_CHECK_AND_UNSET ("${VARNAME}_DLL_DIR")
-  endif()
+macro (OCCT_CHECK_AND_UNSET_GROUP GROUPNAME)
+  get_cmake_property(VARS VARIABLES)
+  string (REGEX MATCHALL "(^|;)${GROUPNAME}[A-Za-z0-9_]*" GROUPNAME_VARS "${VARS}")
+  foreach(GROUPNAME_VAR ${GROUPNAME_VARS})
+    OCCT_CHECK_AND_UNSET(${GROUPNAME_VAR})
+  endforeach()
 endmacro()
 
 macro (OCCT_CHECK_AND_UNSET_INSTALL_DIR_SUBDIRS)