CPM.cmake icon indicating copy to clipboard operation
CPM.cmake copied to clipboard

[BUG] find_package code paths fail to return status

Open osayamenja opened this issue 1 year ago • 1 comments

Bug

Set CPM_USE_LOCAL_PACKAGES and call CPMAddPackage(...) for a local package, this path gets called, but after return() all the exported env variables are lost and are not available in the parent scope.

PROPAGATE is one way to address this.

Asks

  1. If you call CPMFindPackage(...), no status-like variables such as FOUND or ADDED are returned. It would be nice to maintain the same functionality as CPMAddPackage by returning those status variables.
  2. I get warnings about CMP0144 when using CPM, can we set this policy?

osayamenja avatar Oct 10 '24 22:10 osayamenja

I can confirm I also have this issue. There is seemingly no clean way to check whether a local package was found when using CPMAddPackage in combination with CPM_USE_LOCAL_PACKAGES. A work-around I currently use is to check if a known target in the package exists using if(TARGET some_target_in_the_package).

wkjarosz avatar Jan 21 '25 19:01 wkjarosz