[LLVMdev] [PATCH] MSVC: Allow choosing different CRT for different build types

Óscar Fuentes ofv at wanadoo.es
Mon Aug 2 16:56:01 PDT 2010

nobled <nobled at dreamwidth.org> writes:

> This patch splits LLVM_USE_CRT into new CMake variables
> LLVM_USE_CRT_DEBUG, LLVM_USE_CRT_RELEASE, etc (one for each build
> type). It also automatically detects which CRT was already chosen by
> CMake's defaults in the CMAKE_CXX_FLAGS_* variables, and defaults to
> those values.
> (Before, it was using add_llvm_definitions(), which worked...somehow,
> but CMAKE_CXX_FLAGS_RELEASE and friends were still defining their own
> CRT flag. Now it edits the FLAGS variables instead.)

I'm a bit wary about this patch. So much complexity for so petty
feature... Maybe the right thing is to determine the scenarios where
people set LLVM_USE_CRT. Maybe all we need is to define another build
type that inherits from Release which uses the debug version of the CRT.

Anyways, the patch have some issues: remove commented-out code, use the
`foreach' instead of `FOREACH', as in the rest of the code (same for
other keywords), either remove the user-configurable variable
LLVM_USE_CRT or exit with an error if the user sets it, add an extensive
comment about the motivation of the code and about how it achieves its
purpose. Maybe put it on a new file under cmake/modules for stuff
specific of Visual Studio.

But first I'll like to see if we can simplify the requirements.


More information about the llvm-dev mailing list