Closed
Description
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:
llvm-project/llvm/cmake/modules/Findzstd.cmake
Lines 36 to 47 in da5966e
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