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

GEOS snippet in Wiki is unclear #639

Open
lindsaySFS opened this issue Feb 5, 2025 · 1 comment
Open

GEOS snippet in Wiki is unclear #639

lindsaySFS opened this issue Feb 5, 2025 · 1 comment

Comments

@lindsaySFS
Copy link

The snippit is currently:

set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${GEOS_SOURCE_DIR}/cmake")

CPMAddPackage(
  NAME geos
  GITHUB_REPOSITORY libgeos/geos
  GIT_TAG 3.8.1
)

But it's unclear how GEOS_SOURCE_DIR would be set. My understanding is that a variable called geos_SOURCE_DIR would be defined after CPMAddPackage is called. Is there a way to get the source directory beforehand?

I don't actually need GEOS, but another library with the same problem, where I need to add to the CMAKE_MODULE_PATH before calling CPMAddPackage.

@lindsaySFS
Copy link
Author

I made it work for my case by:

  1. use CPMAddPackage with DOWNLOAD_ONLY True
  2. Append to CMAKE_MODULE_PATH with now populated _SOURCE_DIR
  3. Add the project with add_subdirectory

But this feels pretty hacky. I guess ideally the project would set the CMAKE_MODULE_PATH correctly, but it would also be nice if there is a better way to manually set it, that plays nicely with CPM.

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