VS_USE_DEBUG_LIBRARIES — CMake 4.3.4 Documentation

# VS_USE_DEBUG_LIBRARIES

Added in version 3.30.

Indicate to Visual Studio Generators what configurations are considered debug configurations. This controls the `UseDebugLibraries` setting in each configuration of a `.vcxproj` file.

The "Use Debug Libraries" setting in Visual Studio projects, despite its specific-sounding name, is a general-purpose indicator of what configurations are considered debug configurations. In standalone projects, this may affect MSBuild's default selection of MSVC runtime library, optimization flags, runtime checks, and similar settings. In CMake projects those settings are typically generated explicitly based on the project's specification, e.g., the MSVC runtime library is controlled by `MSVC_RUNTIME_LIBRARY`. However, the `UseDebugLibraries` indicator is useful for reference by both humans and tools, and may also affect the behavior of platform-specific SDKs.

Set `VS_USE_DEBUG_LIBRARIES` to a true or false value to indicate whether each configuration is considered a debug configuration. The value may also be the empty string (`""`) in which case no `UseDebugLibraries` will be added explicitly by CMake, and MSBuild will use its default value, `false`.

Use `generator expressions` for per-configuration specification. For example, the code:

    add_executable(foo foo.c)
    set_property(TARGET foo PROPERTY
      VS_USE_DEBUG_LIBRARIES "$<CONFIG:Debug,Custom>")

indicates that target `foo` considers its "Debug" and "Custom" configurations to be debug configurations, and its other configurations to be non-debug configurations.

The property is initialized from the value of the `CMAKE_VS_USE_DEBUG_LIBRARIES` variable, if it is set. If the property is not set then CMake generates `UseDebugLibraries` using heuristics to determine which configurations are debug configurations. See policy `CMP0162`.