Skip to content

Conversation

@charles-lunarg
Copy link

@charles-lunarg charles-lunarg commented Nov 26, 2025

CMake 3.15 added MSVC_RUNTIME_LIBRARY, an official mechanism to configure the runtime library used by targets. Setting the property will properly set the MSVC runtime library regardless of the values in the compiler flags variables.

Fixes #4731

@charles-lunarg charles-lunarg force-pushed the fix_CMake_option_gtest_force_shared_crt branch 2 times, most recently from 96a33a9 to 572b384 Compare December 3, 2025 21:49
With CMake 3.15, a new mechanism was added to control which CRT
libraries link to. Because the minimum CMake version is above 3.15,
googletest can leverage it in the implementation of
gtest_force_shared_crt.

If CMAKE_MSVC_RUNTIME_LIBRARY is already defined, googletest will
respect its value rather than replace it, allowing for users to
customize the exact CRT used by googletest.
@charles-lunarg charles-lunarg force-pushed the fix_CMake_option_gtest_force_shared_crt branch from 572b384 to 0b65649 Compare December 3, 2025 21:53
Copy link

@mathstuf mathstuf left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I approve (but lack permissions to express it through Github's review mechanisms).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: gtest_force_shared_crt on Windows no longer selects /MT with static library build option

2 participants