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

Add cmake cache var to allow for use of system openssl #209

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

nicholas-rh
Copy link

See o3de/o3de#16375 and #205

This one was a bit trickier than SQLite, since the custom FindOpenSSL.cmake module takes precedent over the prewritten find module that is provided by cmake since they have the same name. SQLite doesn't have this problem because the system SQLite find module is "FindSQLite3.cmake" as opposed to the O3DE find module "FindSQLite.cmake," so there is no name collision. I ran into the same problem with the Freetype library, so it's not limited to just OpenSSL.

To get around this I manually set and then unset CMAKE_MODULE_PATH to an empty string. This workaround works because normal cmake variables have priority over cmake cache variables, and since CMAKE_MODULE_PATH is empty, the system find module is picked up as a fallback.

The better solution would probably be to rename each find module to follow the pattern "FindO3DE_OpenSSL.cmake" or something similar and then do "find_package(O3DE_OpenSSL)" so there is no name collision, but that would be a bit more invasive and we would need to make sure to coordinate the changes in both this repo and the main o3de repo. If there's an easier solution I'm missing let me know.

@nicholas-rh nicholas-rh force-pushed the conditional_system_openssl branch from 43f428d to efd38e4 Compare July 28, 2023 20:37
@nicholas-rh
Copy link
Author

I've modified this to store the value of CMAKE_MODULE_PATH in a temporarily variable to be restored after invoking find_package().

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

Successfully merging this pull request may close these issues.

1 participant