Issue 83802
Summary Findzstd.cmake: string sub-command REGEX, mode REPLACE: regex "$" matched an empty string.
Labels new issue
Assignees
Reporter vgvassilev
    When using find_package(llvm) on windows we get:

```
CMake Error at D:/bld/cppinterop_1709495262007/_h_env/Library/lib/cmake/llvm/Findzstd.cmake:39 (string):
2024-03-03T19:54:48.3232894Z   string sub-command REGEX, mode REPLACE: regex "$" matched an empty string.
2024-03-03T19:54:48.3233394Z Call Stack (most recent call first):
2024-03-03T19:54:48.3233750Z D:/bld/cppinterop_1709495262007/_h_env/Library/lib/cmake/llvm/LLVMConfig.cmake:278 (find_package)
2024-03-03T19:54:48.3234068Z   CMakeLists.txt:121 (find_package)

```


Our diagnosis is that `find_package(LLVM REQUIRED CONFIG)` triggers `LLVMConfig.cmake` to call `find_package(zstd)`. In the MSVC branch we use `string(REGEX REPLACE "${CMAKE_INSTALL_LIBDIR}$" "${CMAKE_INSTALL_BINDIR}" zstd_DIRNAME "${zstd_DIRNAME}")`, however, `CMAKE_INSTALL_LIBDIR` is not defined yet and we error out:

https://github.com/llvm/llvm-project/blob/da5966e0c102f03ab853b906377814675db3623c/llvm/cmake/modules/Findzstd.cmake#L36-L47

Adding `include(GNUInstallDirs)` which defines `CMAKE_INSTALL_LIBDIR` in the calling cmake fixes the problem but it's difficult to debug and and far from optimal.

Full log is here: https://dev.azure.com/conda-forge/84710dde-1620-425b-80d0-4cf5baca359d/_apis/build/builds/888296/logs/24
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to