Uploaded image for project: 'C Driver'
  1. C Driver
  2. CDRIVER-2493

Better handle OpenSSL on macOS in CMake

    • Type: Icon: Improvement Improvement
    • Resolution: Fixed
    • Priority: Icon: Minor - P4 Minor - P4
    • 1.10.0
    • Affects Version/s: 1.9.2
    • Component/s: Docs
    • None
    • None
    • None
    • None
    • None
    • None
    • None

      When building with OpenSSL on macOS you may run into some non-obvious issues.

      Copied from our C Driver Development guide:

      Use OpenSSL on macOS:

      brew install openssl
      cmake -DENABLE_SSL=OPENSSL -DOPENSSL_ROOT_DIR=/usr/local/opt/openssl/lib -DOPENSSL_INCLUDE_DIR=/usr/local/opt/openssl/include .
      make

      You may need to rm -rf CMakeCache.txt CMakeFiles/ in order to clear the default Darwin SSL CMake configuration from a previous build

      Looking at our CMakeLists.txt file it looks like ENABLE_SSL=OPENSSL is the only necessary define. It might be worth printing out a message if the OS is macOS and ENABLE_SSL=OPENSSL is defined without OPENSSL_ROOT_DIR or OPENSSL_INCLUDE_DIR.

      In my case, CMake was including OpenSSL from one directory I was trying to build against in
      but it was trying to link it from another. The solution was to define OPENSSL_ROOT_DIR to the OpenSSL directory I wanted to link to.

            Assignee:
            kevin.albertson@mongodb.com Kevin Albertson
            Reporter:
            kevin.albertson@mongodb.com Kevin Albertson
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved: