Add cmake cache var to allow for use of system openssl #209
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.