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

Interaction between CPM_USE_LOCAL_PACKAGES and VERSION in CPMAddPackage #497

Open
Edgeworth opened this issue Aug 22, 2023 · 0 comments
Open

Comments

@Edgeworth
Copy link

Edgeworth commented Aug 22, 2023

I am trying to get the following use case to work:

  1. Set CPM_USE_LOCAL_PACKAGES to ON
  2. Use CPMAddPackage to add a package, with a specific version
  3. Use the local package if it exists and is the right version, otherwise fallback to downloading it.

It seems to me that CPM_USE_LOCAL_PACKAGES will use a local package if it exists, regardless of the version.

For example, the following code:

set(CPM_USE_LOCAL_PACKAGES ON)

CPMAddPackage(
  NAME benchmark
  GITHUB_REPOSITORY google/benchmark
  VERSION 1.5.2
  OPTIONS "BENCHMARK_ENABLE_TESTING Off"
)

will use (and identify the version of) version 1.8.2 of benchmark on my machine if it's a local package, when CPM_USE_LOCAL_PACKAGES is ON. If CPM_USE_LOCAL_PACKAGES is OFF, it will download version 1.5.2, meaning that the versions differ between CPM_USE_LOCAL_PACKAGES ON vs OFF.

Is this intended behaviour? Is there any way to accomplish a version based fallback to downloading? Maybe I've missed something.

Thanks!

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

1 participant