[CMake] Resource compiler issues for cross-compiling

Shoaib Meenai smeenai at fb.com
Tue Oct 24 18:37:01 EDT 2017


Hi all,

I'm cross-compiling from Linux to Windows using clang-cl and the Windows SDK
(i.e. emulating an MSVC environment), and I'm attempting to use llvm-rc (which
is new in LLVM 6.0) as the resource compiler. cmake automatically enables the
RC language for MSVC. However, it also sets `CMAKE_NINJA_CMCLDEPS_RC` to 1,
which causes the ninja generator to require cmcldeps, but that program is only
built on Windows.

I've only looked at cmcldeps briefly, but it seems to have a bunch of Windows-
specific code, and I'm not sure how easy it would be to build it for other
platforms. I'm also not really sure what cmcldeps does or how necessary it is
for a cross-compilation scenario, however. In particular, the RC files I'm
attempting to compile are quite simple and don't contain any `#include`s.

Unfortunately, I don't see how to get around the cmcldeps requirement, since
the Windows-MSVC platform sets CMAKE_NINJA_CMCLDEPS_RC unconditionally. I've
worked around it temporarily by disabling resource file usage on non-Windows
build hosts, but I'd like to be able to use llvm-rc eventually. What's the
best path forward here?

Thanks,
Shoaib



More information about the CMake mailing list