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

Simplify the boilerplate code of CPM. #12

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

cogumbreiro
Copy link

The goal of this patch is to reduce the boiler-plate code necessary to include CPM in a project.

@iauns
Copy link
Owner

iauns commented Jun 29, 2015

I'm all for reducing this boilerplate overhead. Earlier, we had a contributor propose something similar to this that now exists as cpm/util/init-cpm-module.cmake and cpm/util/init-cpm.cmake.

My primary concern is adding an extra indirection that requires two steps (if the form of download and reference) instead of copying code from a webpage directly into your CMake project file. The ideal method would be to package CPM alongside the CMake distribution, but I haven't been investigating that possibility actively.

Here's what I propose: we explain both methods in the readme file and we include this CMake file in the root CPM directory. In the readme, we prioritize the copy-and-paste method above the 2 step download and reference method.

Since this request is occurring often, there's clearly some need to be filled here. I'm open to suggestions.

@cogumbreiro
Copy link
Author

My main concern is that CPM can be made easier to understand. I think CPM's landing page should explain its workflow and not a detailed example.

My inspiration comes from Homebrew, and I would divide the CPM workflow into 3 steps: download, setup and search; see below for the mockup. Each of these steps is small, understandable, and simpler. In contrast, the current situation resorts to copy/paste bits of boiler-plate code situated in the middle of the landing page (after the TOC).

Additionally, I think the README.md should be reduced. I would even ask you to move everything after the table-of-contents into a wiki. There is a lot of very useful information, but is hard to navigate.


1. Download CPM

Download init-cpm.cmake into your main directory

$ wget https://github.com/iauns/cpm/blob/master/util/init-cpm.cmake

2. Setup CPM

  include(init-cpm.cmake) # download and initialize CPM
  # TODO: Include any modules here...
  CPM_Finish()

3. Search for packages

http://www.cpm.rocks/

4. Learn

In our wiki you can learn:

  • a brief example on using CPM
  • developing your own modules
  • ...

@iauns
Copy link
Owner

iauns commented Jul 1, 2015

Thanks for the excellent feedback. The readme page does contain too much information and should be condensed. I'm planning on simplifying and revamping the readme page at the very least. I'm also swayed by your argument for download and setup; your solution is more similar to the ideal solution where CPM is packaged alongside CMake. After trying it out, it also makes CPM projects less noisy.

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.

2 participants