cryptopp-cmake
cryptopp-cmake copied to clipboard
Fix OpenMP on MacOS
Tested on Github Action macos-12, macos-13 (x64) and macos-14 (arm64) runners, they aren't able to find OpenMP. I don't know why the setting of CMAKE_PREFIX_PATH is not enough, but it does not work as intended. This change reinstates the code from the old cryptopp-cmake project, and this works correctly in all of the Github Action macos runners.
This change is needed for cryfs to upgrade from the previous cryptopp-cmake scripts to the this modern-cmake one.
ok this is weird, the macos CI jobs here fail and say they can't find OpenMP. However, my change is written in a way that it shouldn't be able to make things worse. Previously, there was just a find_package and that find_package is still there, and this PR only changes behavior if that find_package doesn't find the package...So if the CI job found OpenMP before using this find_package call, it should still find it.
Was there a point when this worked in the past, or did it never work and we just didn't notice? I'm sure if this never worked, there is something to fix in the find_openmp module.
It worked in the legacy cmake repository, and that's actually where I got the working cmake code from, but it probably never worked here.
It probably does work on other platforms, only macos seems to have this issue.
For putting this into a separate cmake module, how would that work? I can for sure put it into a separate cmake file and include that. But if you want it to be included with find_package, how do I make sure it uses the in-repository FindOpenMP and not the system one?