From f13d576fb6b09b08b5baad5af44e488ae8aa1cb4 Mon Sep 17 00:00:00 2001 From: Joey Riches Date: Mon, 16 Sep 2024 20:46:46 +0100 Subject: [PATCH] PCLConfig.cmake.in: Handle potentially empty ${LIB} variable Found in the wild attempting to build freecad ``` CMake Error at /usr/lib64/cmake/pcl/PCLConfig.cmake:332 (string): string sub-command REGEX, mode REPLACE needs at least 6 arguments total to command. Call Stack (most recent call first): /usr/lib64/cmake/pcl/PCLConfig.cmake:545 (find_external_library) cMake/FreeCAD_Helpers/SetupPCL.cmake:11 (find_package) CMakeLists.txt:55 (SetupPCL) ``` --- PCLConfig.cmake.in | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/PCLConfig.cmake.in b/PCLConfig.cmake.in index b179a5d8b6e..8e1f1f3865c 100644 --- a/PCLConfig.cmake.in +++ b/PCLConfig.cmake.in @@ -311,17 +311,17 @@ function(find_external_library _component _lib _is_optional) string(TOUPPER "${_component}" COMPONENT) string(TOUPPER "${_lib}" LIB) - string(REGEX REPLACE "[.-]" "_" LIB ${LIB}) + string(REGEX REPLACE "[.-]" "_" LIB "${LIB}") if(${LIB}_FOUND) list(APPEND PCL_${COMPONENT}_INCLUDE_DIRS ${${LIB}_INCLUDE_DIRS}) set(PCL_${COMPONENT}_INCLUDE_DIRS ${PCL_${COMPONENT}_INCLUDE_DIRS} PARENT_SCOPE) - + if(${LIB} MATCHES "VTK") if(${${LIB}_VERSION_MAJOR} GREATER_EQUAL 9) set(ISVTK9ORGREATER TRUE) endif() endif() - + if(${LIB}_USE_FILE AND NOT ISVTK9ORGREATER ) include(${${LIB}_USE_FILE}) else()