Fix a CMake warning on release builds
It looks like this isn't a regression - all previous releases had this
issue. We simply didn't use the "-Werror=dev" flag before when testing
CMake. If the "pcre2_prerelease" variable was set to empty string, it
would be treated as "falsy" by CMake and not substituted correctly.
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 1e841a9..c970996 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -733,10 +733,9 @@
foreach(configure_line ${configure_lines})
foreach(substitution_variable ${SEARCHED_VARIABLES})
string(TOUPPER ${substitution_variable} substitution_variable_upper)
- if(NOT ${substitution_variable_upper})
- string(REGEX MATCH "m4_define\\(${substitution_variable}, *\\[(.*)\\]" MATCHED_STRING ${configure_line})
- if(CMAKE_MATCH_1)
- set(${substitution_variable_upper} ${CMAKE_MATCH_1})
+ if(NOT DEFINED ${substitution_variable_upper})
+ if("${configure_line}" MATCHES "m4_define\\(${substitution_variable}, *\\[(.*)\\]")
+ set(${substitution_variable_upper} "${CMAKE_MATCH_1}")
endif()
endif()
endforeach()