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

The "cmake/CMakeLists.txt -> CMakeLists.txt" redirection deactivates some policies silently. #12263

Closed
jtattermusch opened this issue Mar 17, 2023 · 1 comment

Comments

@jtattermusch
Copy link
Contributor

The "cmake/CMakeLists.txt" is now deprecated, but there are some hidden problems with how it's forwarding to /CMakeLists.txt (in the repo root).

I found that some cmake policies get silently deactivated if one uses cmake/CMakeLists.txt

E.g. here:

if(POLICY CMP0091)

Since CMP0091 needs to be set before languages are initialized, but

project(protobuf C CXX)
is reached first, the policy won't be active (which is quite counterintuitive)
and settings made here
if (protobuf_MSVC_STATIC_RUNTIME)
will be overridden by e.g. /MD still being present in CMAKE_CXX_FLAGS_*

(at least this is my interpretation of what happens, but I've observed /MD flag being present when it should not).

@jtattermusch jtattermusch added the untriaged auto added to all issues by default when created. label Mar 17, 2023
@fowles fowles added packaging & distribution and removed untriaged auto added to all issues by default when created. labels Mar 17, 2023
@acozzette
Copy link
Member

I think we should probably just delete that file at this point. @jtattermusch Would that be ok from your perspective or would that break gRPC?

jtattermusch added a commit to grpc/grpc that referenced this issue Mar 22, 2023
…#32678)

Try to react to protocolbuffers/protobuf#12263
and protocolbuffers/protobuf#12295

Protobuf's /cmake/CMakeLists.txt is now deprecated if favor of
/CMakeLists.txt


https://github.com/protocolbuffers/protobuf/blob/58ecf38aa521ba812a0c1a0ae9f108dd311c739c/cmake/CMakeLists.txt#L3

In this PR:
- Adjust `cmake/protobuf.cmake` to use the right CMakeLists.txt
- adjust the C++ distribtests accordingly
jtattermusch added a commit to jtattermusch/grpc that referenced this issue Mar 24, 2023
…grpc#32678)

Try to react to protocolbuffers/protobuf#12263
and protocolbuffers/protobuf#12295

Protobuf's /cmake/CMakeLists.txt is now deprecated if favor of
/CMakeLists.txt


https://github.com/protocolbuffers/protobuf/blob/58ecf38aa521ba812a0c1a0ae9f108dd311c739c/cmake/CMakeLists.txt#L3

In this PR:
- Adjust `cmake/protobuf.cmake` to use the right CMakeLists.txt
- adjust the C++ distribtests accordingly
XuanWang-Amos pushed a commit to XuanWang-Amos/grpc that referenced this issue May 1, 2023
…grpc#32678)

Try to react to protocolbuffers/protobuf#12263
and protocolbuffers/protobuf#12295

Protobuf's /cmake/CMakeLists.txt is now deprecated if favor of
/CMakeLists.txt


https://github.com/protocolbuffers/protobuf/blob/58ecf38aa521ba812a0c1a0ae9f108dd311c739c/cmake/CMakeLists.txt#L3

In this PR:
- Adjust `cmake/protobuf.cmake` to use the right CMakeLists.txt
- adjust the C++ distribtests accordingly
wanlin31 pushed a commit to grpc/grpc that referenced this issue May 18, 2023
…#32678)

Try to react to protocolbuffers/protobuf#12263
and protocolbuffers/protobuf#12295

Protobuf's /cmake/CMakeLists.txt is now deprecated if favor of
/CMakeLists.txt


https://github.com/protocolbuffers/protobuf/blob/58ecf38aa521ba812a0c1a0ae9f108dd311c739c/cmake/CMakeLists.txt#L3

In this PR:
- Adjust `cmake/protobuf.cmake` to use the right CMakeLists.txt
- adjust the C++ distribtests accordingly
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants