Skip to content

[CMake] Use CMAKE_MSVC_RUNTIME_LIBRARY to apply /MT#6484

Merged
jameslamb merged 9 commits intomicrosoft:masterfrom
hcho3:msvc_runtime
Jul 4, 2024
Merged

[CMake] Use CMAKE_MSVC_RUNTIME_LIBRARY to apply /MT#6484
jameslamb merged 9 commits intomicrosoft:masterfrom
hcho3:msvc_runtime

Conversation

@hcho3
Copy link
Contributor

@hcho3 hcho3 commented Jun 14, 2024

Use the built-in flag CMAKE_MSVC_RUNTIME_LIBRARY in CMake to robustly handle the linking mode for the Windows C runtime (/MD vs /MT). See https://cmake.org/cmake/help/latest/variable/CMAKE_MSVC_RUNTIME_LIBRARY.html

Copy link
Collaborator

@jameslamb jameslamb left a comment

Choose a reason for hiding this comment

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

Looks good to me! Just left one small request to move this code back down inside the if(BUILD_CPP_TEST) block.

Don't worry about the failing CI jobs... they're flaky and the failures are unrelated to your changes.

Copy link
Collaborator

@jameslamb jameslamb left a comment

Choose a reason for hiding this comment

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

thanks very much @hcho3 ! This is a nice improvement. I'm glad to be able to get rid of some string manipulation in CMakeLists 😁

@jameslamb jameslamb merged commit 00d6edd into microsoft:master Jul 4, 2024
@github-actions
Copy link
Contributor

This pull request has been automatically locked since there has not been any recent activity since it was closed.
To start a new related discussion, open a new issue at https://github.com/microsoft/LightGBM/issues including a reference to this.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Jul 10, 2025
@hcho3 hcho3 deleted the msvc_runtime branch July 10, 2025 00:14
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants