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

How to use external packages on cpm.rocks? #20

Open
shuaimu opened this issue Mar 8, 2017 · 1 comment
Open

How to use external packages on cpm.rocks? #20

shuaimu opened this issue Mar 8, 2017 · 1 comment

Comments

@shuaimu
Copy link

shuaimu commented Mar 8, 2017

I tried for a couple of hours and did not find a solution.

For example, this package: yaml-cpp is on the website: http://www.cpm.rocks/mod/gh/jbeder/yaml-cpp

In my CMakelist.txt:

CPM_AddModule("yaml-cpp"
        GIT_REPOSITORY "https://github.com/jbeder/yaml-cpp"
        GIT_TAG "origin/master"
        USE_EXISTING_VER TRUE
        )

Running cmake will alert me:

A module (yaml-cpp) failed to define its name!

Same goes with many other packages on the website. I found that it seems only that is a wrapper instead of the actual code repo would work. For example, the "cpm-boost" works.

@iauns
Copy link
Owner

iauns commented Mar 12, 2017

I think the core issue is that CPM doesn't recognize the external CMake project as a valid CPM module. As in CPM_InitModule("yaml-cpp") was never issued from the project at https://github.com/jbeder/yaml-cpp. If memory serves, externals were created in order to wrap non-CMake projects. The expectation being that CMake projects themselves could just add the CPM machinery. However, I don't believe that external CMake projects should add the CPM machinery, they should be wrapped at a higher level in CPM.

I agree that this behavior should be modified so that one could specify a true 'external-to-CPM' in addition to a 'CPM-External' that simply knows how to build the project. Unfortunately my head has been out of CMake script for over 2 years now and don't have the context to drive these changes forward. What may suit your use case is a CMake ExternalProject but those aren't supported on the website (not without a CPM_AddModuleExternal or some other modification to the CPM source).

I'll leave the issue open and post a maintenance warning on the github page.

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

2 participants