diff options
author | saturneric <[email protected]> | 2023-12-22 13:24:12 +0000 |
---|---|---|
committer | saturneric <[email protected]> | 2023-12-22 13:24:12 +0000 |
commit | 6875894b663db4c649e9c8168f19620688df51fc (patch) | |
tree | 07edab0be2ceb213604a426ae427cebbc3a6151f /src | |
parent | fix: repair test cases (diff) | |
download | GpgFrontend-6875894b663db4c649e9c8168f19620688df51fc.tar.gz GpgFrontend-6875894b663db4c649e9c8168f19620688df51fc.zip |
fix: slove cmake configuration problem on macOS
Diffstat (limited to '')
-rw-r--r-- | src/CMakeLists.txt | 19 | ||||
-rw-r--r-- | src/test/CMakeLists.txt | 2 |
2 files changed, 19 insertions, 2 deletions
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index b0b704d1..db8ee2db 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -45,7 +45,24 @@ find_package(Config++ REQUIRED) # Introduce OpenSSL if (APPLE) - set(OPENSSL_ROOT_DIR /usr/local/opt/openssl@3) + # Define possible OpenSSL directories + set(OPENSSL_DIR_CANDIDATES + /usr/local/opt/openssl@3 + /opt/homebrew/opt/openssl@3 + ) + + # Find the valid OpenSSL directory + foreach(DIR IN LISTS OPENSSL_DIR_CANDIDATES) + if(IS_DIRECTORY "${DIR}" OR EXISTS "${DIR}") + set(OPENSSL_ROOT_DIR "${DIR}") + break() # Stop loop once a valid directory is found + endif() + endforeach() + + # If not found, throw an error or warning + if(NOT OPENSSL_ROOT_DIR) + message(FATAL_ERROR "OpenSSL not found in the standard directories. Please install it or set OPENSSL_ROOT_DIR manually.") + endif() endif() find_package(OpenSSL REQUIRED) diff --git a/src/test/CMakeLists.txt b/src/test/CMakeLists.txt index 1eb710be..2c99c5d3 100644 --- a/src/test/CMakeLists.txt +++ b/src/test/CMakeLists.txt @@ -40,7 +40,7 @@ target_link_libraries(gpgfrontend_test PRIVATE gpgfrontend_core) target_link_libraries(gpgfrontend_test PRIVATE spdlog) if (APPLE) - target_link_libraries(gpgfrontend_test intl) + target_link_libraries(gpgfrontend_test PRIVATE intl) endif () add_test(AllTestsInGpgFrontend gpgfrontend_test) |