[MDEV-31252] cmake trace-expand fails on variable expansion of libfmt for cmake <3.24 Created: 2023-05-12  Updated: 2023-05-15  Resolved: 2023-05-15

Status: Closed
Project: MariaDB Server
Component/s: Configuration
Affects Version/s: 10.4
Fix Version/s: N/A

Type: Bug Priority: Major
Reporter: Anel Husakovic Assignee: Anel Husakovic
Resolution: Won't Fix Votes: 0
Labels: None


 Description   

When running cmake --trace-expand, with cmake version 3.16, noted error

/usr/share/cmake-3.16/Modules/ExternalProject.cmake(2543):  set(tag MD5=e77873199e897ca9f780479ad68e25b1 )
/usr/share/cmake-3.16/Modules/ExternalProject.cmake(2544):  configure_file(/usr/share/cmake-3.16/Modules/RepositoryInfo.txt.in /home/anel/GitHub/mariadb/server/build/connect-java/extra/libfmt/src/libfmt-stamp/libfmt-urlinfo.txt @ONLY )
/usr/share/cmake-3.16/Modules/ExternalProject.cmake(2549):  list(APPEND depends /home/anel/GitHub/mariadb/server/build/connect-java/extra/libfmt/src/libfmt-stamp/libfmt-urlinfo.txt )
/usr/share/cmake-3.16/Modules/ExternalProject.cmake(2551):  list(LENGTH url url_list_length )
/usr/share/cmake-3.16/Modules/ExternalProject.cmake(2552):  if(NOT 1 STREQUAL 1 )
/usr/share/cmake-3.16/Modules/ExternalProject.cmake(2563):  if(IS_DIRECTORY https://github.com/fmtlib/fmt/releases/download/8.0.1/fmt-8.0.1.zip )
/usr/share/cmake-3.16/Modules/ExternalProject.cmake(2568):  else()
/usr/share/cmake-3.16/Modules/ExternalProject.cmake(2569):  get_property(no_extract TARGET libfmt PROPERTY _EP_DOWNLOAD_NO_EXTRACT SET )
/usr/share/cmake-3.16/Modules/ExternalProject.cmake(2570):  if(https://github.com/fmtlib/fmt/releases/download/8.0.1/fmt-8.0.1.zip MATCHES ^[a-z]+:// )
/usr/share/cmake-3.16/Modules/ExternalProject.cmake(2572):  if(x STREQUAL x )
/usr/share/cmake-3.16/Modules/ExternalProject.cmake(2573):  set(fname https://github.com/fmtlib/fmt/releases/download/8.0.1/fmt-8.0.1.zip )
CMake Error at /usr/share/cmake-3.16/Modules/ExternalProject.cmake:2575 (if):
  Syntax error in cmake code when parsing string
 
    ([^/\?#]+(\.|=)(7z|tar|tar\.bz2|tar\.gz|tar\.xz|tbz2|tgz|txz|zip))([/?#].*)?$
 
  Invalid escape sequence \?
Call Stack (most recent call first):
  /usr/share/cmake-3.16/Modules/ExternalProject.cmake:3236 (_ep_add_download_command)
  cmake/libfmt.cmake:15 (ExternalProject_Add)
  cmake/libfmt.cmake:47 (BUNDLE_LIBFMT)
  CMakeLists.txt:396 (CHECK_LIBFMT)
 
 
/usr/share/cmake-3.16/Modules/ExternalProject.cmake(2575):  if(https://github.com/fmtlib/fmt/releases/download/8.0.1/fmt-8.0.1.zip MATCHES ([^/\?#]+(\.|=)(7z|tar|tar\.bz2|tar\.gz|tar\.xz|tbz2|tgz|txz|zip))([/?#].*)?$ )
-- Configuring incomplete, errors occurred!
See also "/home/anel/GitHub/mariadb/server/build/connect-java/CMakeFiles/CMakeOutput.log".
See also "/home/anel/GitHub/mariadb/server/build/connect-java/CMakeFiles/CMakeError.log".

However after testing cmake regex is good.
Tested: https://regexr.com/7dmes

This seems to be cmake bug.
New cmake patch 3351b7b82c2 from cmake 3.24+ works, I have verified and tested and it works fine.

Not sure should we indicate that in our codebase somehow (with comments)?



 Comments   
Comment by Daniel Black [ 2023-05-15 ]

The work around is obviously to have libfmt installed locally so it doesn't hit this path same with every other ExternalProject_Add project (pcre / aws_sdk).

No workaround is easy in the codebase. So nothing is required.

Generated at Thu Feb 08 10:22:26 UTC 2024 using Jira 8.20.16#820016-sha1:9d11dbea5f4be3d4cc21f03a88dd11d8c8687422.