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

cmake support #291

Closed
paleozogt opened this issue Apr 20, 2015 · 8 comments
Closed

cmake support #291

paleozogt opened this issue Apr 20, 2015 · 8 comments

Comments

@paleozogt
Copy link

(fyi, I filed a ticket for CMake support when protobuf was on code.google.com, but it seems to have gotten lost in the transition to github.)

Can we get CMake support added to protobuf?

Some reasons why CMake is useful:

  • Autoconf isn't useful for MSVC compilation, which is why protobuf has independently maintained .sln files-- which are years behind, have to be manually upgraded, and don't include things like x64 arch support.
  • Autoconf makes it complicated to use the protobuf project directly (as a git submodule, not as an untarred dist), since the configure script has to be generated before it can be invoked. If it were using CMake, using it as a submodule would be easy.
  • Cross-compilation with autoconf is hard. With CMake you can write a toolchain file once and reuse it in other CMake projects, but the autoconf configure script requires passing in all the pieces on the command-line.
  • Other Google open-source projects use it, such as gtest.
@xfxyjwf
Copy link
Contributor

xfxyjwf commented Apr 20, 2015

Thanks for the suggestion. Adding cmake support is in our plan. I have done some experiments using cmake a while ago (see: https://github.com/xfxyjwf/protobuf/tree/cmake/vsprojects). I'll try to get it reviewed and merged in when I get time to work on it.

@snikulov
Copy link

@xfxyjwf @paleozogt you can adopt following solution from here https://github.com/jesperes/protobuf-cmake

@snikulov
Copy link

snikulov commented Jun 3, 2015

will be fixed with pull #457

@Klaim
Copy link

Klaim commented Jun 30, 2015

Looks like #457 was merged but this ticket was not updated.
Also, the readme needs to be rewritten I think.

@xfxyjwf
Copy link
Contributor

xfxyjwf commented Jun 30, 2015

Closing this issue as cmake support was added in PR #457

Regarding the readme file, @Klaim could you be more specific about how you think the readme file should look like? Feel free to open a new issue or send us a PR with your suggested edits. Thanks.

@xfxyjwf xfxyjwf closed this as completed Jun 30, 2015
@Klaim
Copy link

Klaim commented Jun 30, 2015

@xfxyjwf Not sure exactly what should go first and what should be removed, basically the readme indicate what to read to build/link, so it should now mention (or show how to) at the beginning that you can use CMake to generate project files instead of the now "legacy" project files.
In particular, it makes less sense to have a separate windows infos build readme, except if you don't use cmake or want to know some windows-specific details.

@xfxyjwf
Copy link
Contributor

xfxyjwf commented Jun 30, 2015

@Klaim Seems you are talking about the README.md file in the root directory? There I had changed the section about "C++ Installation - Windows" to point to cmake/README.md:
https://github.com/google/protobuf/blob/master/README.md#c-installation---windows

In cmake/README.md, it mainly talks about how to build with Visual Studio as cmake is introducted to replace vsproject files and the text is copied from vsprojects/readme.txt. As cmake can be used more than just Visual Studio, I guess we should also describe how to use cmake for other platform/compilers. The root README.md could also mention cmake as an alternative to autoconf rather than specific to windows builds. Is this what you are suggesting here?

@Klaim
Copy link

Klaim commented Jun 30, 2015

@xfxyjwf Yes that is exactly what I am suggesting. I am guessing that for example on unix somehting close to saying that

cmake <args>
make .

Will work (I'm not a specialist but there should be a way to do this). Then for other plateforms only the second line change.

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

No branches or pull requests

4 participants