Skip to content

MSVC: Add abstraction for incremental linking

Matching the pattern for CMAKE_MSVC_RUNTIME_LIBRARY and CMAKE_MSVC_DEBUG_INFORMATION_FORMAT, implement a new policy to provide a programmatic model for setting /INCREMENTAL or /INCREMENTAL:NO to enable moving the setting out of the default options.

Replace our hard-coded default /INCREMENTAL[:NO] flags with a first-class abstraction to select incremental linking with an enumeration of logical names.

Removing the old default flags requires a policy because existing projects may rely on string processing to edit them and choose incremental linking under the old behavior. Add policy CMP0171 to provide compatibility.

Fixes: #20766
Issue: #20812
Topic-rename: msvc-incremental-linking

Edited by Brad King

Merge request reports