Description
I try to build LLVM on Windows via MSVC with zlib-ng (in compatability mode), zstd and libxml2.
I have build these 3rdparty projects including there CMake Config files. I use a custom include install path. Therefor the old CMake Modules can't work for my build. I build LLVM with CMAKE_FIND_PACKAGE_PREFER_CONFIG=ON
to used the installed project Config files.
I looks like LLVM uses some old style CMake variables including:
ZLIB_INCLUDE_DIR=C:/usr/include/zlib_ng
ZLIB_INCLUDE_DIRS=C:/usr/include/zlib_ng
ZLIB_LIBRARY
(missing,ZLIB_LIBRARIES
isZLIB::ZLIB
)zstd_INCLUDE_DIR
(missing)zstd_LIBRARY
(missing)LIBXML2_INCLUDE_DIR=C:/usr/include/libxml2/libxml2
LIBXML2_INCLUDE_DIRS=C:/usr/include/libxml2/libxml2
LIBXML2_LIBRARY=debug;C:/usr/lib/libxml2d.lib;optimized;C:/usr/lib/libxml2.lib
LIBXML2_LIBRARIES=debug;C:/usr/lib/libxml2d.lib;optimized;C:/usr/lib/libxml2.lib
LIBXML2_DEFINITIONS=
As you can see zstd doesn't set any these old variables at all. They don't work with Multi-Config anyway.
Config files support Multi-Config, so *_LIBRARIES
can't be set to the Debug or the Release lib file. zlib-ng sets it to ZLIB::ZLIB
. libxml2 sets it to debug;C:/usr/lib/libxml2d.lib;optimized;C:/usr/lib/libxml2.lib
. I think both isn't what LLVM expects.
Also the ZLIB check is broken, because ZLIB_LIBRARY
is not set, ZLIB_LIBRARIES
would work here.
llvm-project/llvm/cmake/config-ix.cmake
Lines 165 to 186 in 61ef286
The next problematic section seams to be:
llvm-project/llvm/cmake/modules/LLVMExternalProjectUtils.cmake
Lines 172 to 196 in 2334fd2
This looks to me, like a forwarding of arguments to a subsequent call.
I think this may be the reason for this error in my build:
loading initial cache file C:/TechnoTeam/develop/usr/build/llvm/projects/runtimes/tmp/runtimes-cache-Release.cmake
-- Performing bootstrapping runtimes build.
-- Could NOT find ZLIB (missing: ZLIB_INCLUDE_DIR)
-- Could NOT find zstd (missing: zstd_INCLUDE_DIR)
-- Could NOT find LibXml2 (missing: LIBXML2_INCLUDE_DIR)
-- Could NOT find ZLIB (missing: ZLIB_INCLUDE_DIR)
-- Could NOT find zstd (missing: zstd_INCLUDE_DIR)
-- Could NOT find LibXml2 (missing: LIBXML2_INCLUDE_DIR)
CMake Error at C:/temp/tt/env/share/cmake-3.31/Modules/FindPackageHandleStandardArgs.cmake:233 (message):
Could NOT find Python3 (missing: Python3_EXECUTABLE Interpreter)
Call Stack (most recent call first):
C:/temp/tt/env/share/cmake-3.31/Modules/FindPackageHandleStandardArgs.cmake:603 (_FPHSA_FAILURE_MESSAGE)
C:/temp/tt/env/share/cmake-3.31/Modules/FindPython/Support.cmake:4002 (find_package_handle_standard_args)
C:/temp/tt/env/share/cmake-3.31/Modules/FindPython3.cmake:602 (include)
CMakeLists.txt:180 (find_package)
I am investigating this further and will add to this issue.