Skip to content

LLVM_USE_CRT_RELEASE/DEBUG seems to have been broken with the update to require CMake 3.20 #62739

@dschuff

Description

@dschuff

LLVM has the CMake flag LLVM_USE_CRT_RELEASE (and a debug equivalent) that can add e.g. the /MT compiler flag to select the static C runtime. With the update to require a newer version of CMake, this seems to have stopped working.
I'm using Cmake 3.21 with clang-cl and using -DLLVM_USE_CRT_RELEASE=MT, and found that after the update, clang was getting passed the /MT flag but then after that the -MD flag was being added by CMake. This seems to be because of https://cmake.org/cmake/help/latest/policy/CMP0091.html, a new feature that does a similar runtime selection at the CMake level. I found that adding -DCMAKE_MSVC_RUNTIME_LIBRARY=MultiThreaded made it start working again.

So, probably LLVM_USE_CRT_{RELEASE,DEBUG} needs to be updated somehow to work with the new policy, or perhaps it can just be removed in favor of the CMake version.

Metadata

Metadata

Assignees

No one assigned

    Labels

    cmakeBuild system in general and CMake in particular

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions