Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Automatically add protobuf_MSVC_STATIC_RUNTIME=OFF when protobuf_BUILD_SHARED_LIBS=OFF #16802

Open
ahoarau opened this issue May 9, 2024 · 0 comments
Labels
untriaged auto added to all issues by default when created.

Comments

@ahoarau
Copy link

ahoarau commented May 9, 2024

What version of protobuf and what language are you using?
Version: 26.x
Language: C++

What operating system (Linux, Windows, ...) and version?
Windows
What runtime / compiler are you using (e.g., python version or gcc version)
msvc 2022
What did you do?

Buid protobuf as a static library.

cmake -S protobuf -B protobuf-build-release -G Ninja  -Dprotobuf_BUILD_SHARED_LIBS=OFF

Then link against some static library, you will get errors like this:

libcpmtd.lib(xstol.obj) : error LNK2038: mismatch detected for 'RuntimeLibrary': value 'MTd_StaticDebug' doesn't match value 'MDd_DynamicDebug' in cmake_pch.cxx.obj

It is fixed by passing -Dprotobuf_MSVC_STATIC_RUNTIME=OFF to the cmake configure args.

Is there any reason why protobuf_MSVC_STATIC_RUNTIME is not OFF by default when protobuf_BUILD_SHARED_LIBS=OFF ?

For package management, it would be great.

@ahoarau ahoarau added the untriaged auto added to all issues by default when created. label May 9, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
untriaged auto added to all issues by default when created.
Projects
None yet
Development

No branches or pull requests

1 participant