CPM.cmake
CPM.cmake copied to clipboard
[BUG] find_package code paths fail to return status
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
- If you call CPMFindPackage(...), no status-like variables such as
FOUNDorADDEDare returned. It would be nice to maintain the same functionality as CPMAddPackage by returning those status variables. - I get warnings about CMP0144 when using CPM, can we set this policy?
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).