# How does find-openssl work?

**URL:** https://discourse.cmake.org/t/how-does-find-openssl-work/13142
**Category:** Development
**Created:** [December 6, 2024, 9:18pm UTC](https://discourse.cmake.org/t/how-does-find-openssl-work/13142 "2024-12-06T21:18:04Z")
**Posts on this page:** 5
**Page:** 1

<div class="post-metadata">

### Author: ![rsalz](https://discourse.cmake.org/user_avatar/discourse.cmake.org/rsalz/32/5179_2.png) [@rsalz](https://discourse.cmake.org/u/rsalz)
#### Post date: [December 6, 2024, 9:18pm UTC](https://discourse.cmake.org/t/how-does-find-openssl-work/13142/1 "2024-12-06T21:18:04Z")

</div>

I am working on a fork of OpenSSL, called QuicTLS. One of the things we are doing is switch from the customer Perl to a cmake build. A test is failing and I’m trying to figure out what I broke. The test is bringing in OQS library and I get the following error:

```auto
 CMake Error at /usr/local/share/cmake-3.31/Modules/FindPackageHandleStandardArgs.cmake:233 (message):
  Could NOT find OpenSSL, try to set the path to OpenSSL root folder in the
  system variable OPENSSL_ROOT_DIR: (Required is at least version "1.1.1")
  (found /home/runner/work/quictls/quictls/libcrypto.so, )
Call Stack (most recent call first):
  /usr/local/share/cmake-3.31/Modules/FindPackageHandleStandardArgs.cmake:601 (_FPHSA_FAILURE_MESSAGE)
  /usr/local/share/cmake-3.31/Modules/FindOpenSSL.cmake:691 (find_package_handle_standard_args)
  CMakeLists.txt:133 (find_package)
-- Configuring incomplete, errors occurred!

```

How can I figure out what I broke?

---

<div class="post-metadata">

### Author: ![rsalz](https://discourse.cmake.org/user_avatar/discourse.cmake.org/rsalz/32/5179_2.png) [@rsalz](https://discourse.cmake.org/u/rsalz)
#### Post date: [December 6, 2024, 9:33pm UTC](https://discourse.cmake.org/t/how-does-find-openssl-work/13142/2 "2024-12-06T21:33:12Z")

</div>

So it turns out that our QuicTLS fork merges opensslv.h into configuration.h. (I thought that CMake really wants just one config file, am I wrong?). For now I jammed something into opensslv.h. Could we maybe search BOTH files? Or is my assumption wrong? Tnx.

---

<div class="post-metadata">

### Author: ![brad.king](https://discourse.cmake.org/user_avatar/discourse.cmake.org/brad.king/32/11_2.png) [@brad.king](https://discourse.cmake.org/u/brad.king)
#### Post date: [December 6, 2024, 9:43pm UTC](https://discourse.cmake.org/t/how-does-find-openssl-work/13142/3 "2024-12-06T21:43:53Z")

</div>

> [@rsalz](#):
>
> I thought that CMake really wants just one config file

That is the case for `find_package`’s “CONFIG” mode, which is used when explicitly requested or when no Find module is available. You can provide a `QuicTLSConfig.cmake` package configuration file by following the [cmake-packages(7)](https://cmake.org/cmake/help/v3.31/manual/cmake-packages.7.html) manual, and then your package can be found by `find_package(QuicTLS)` with no help from a find module. You should also provide an adjacent `QuicTLSConfigVersion.cmake` package version file to make versioning work.

A `find_package(OpenSSL)` call will use CMake’s `FindOpenSSL` module, which searches for individual artifacts. That module extracts the OpenSSL version number from `openssl/opensslv.h`, which is expected to exist as it is a [documented](https://docs.openssl.org/3.0/man3/OpenSSL_version/) part of OpenSSL’s public interface.

---

<div class="post-metadata">

### Author: ![rsalz](https://discourse.cmake.org/user_avatar/discourse.cmake.org/rsalz/32/5179_2.png) [@rsalz](https://discourse.cmake.org/u/rsalz)
#### Post date: [December 6, 2024, 10:00pm UTC](https://discourse.cmake.org/t/how-does-find-openssl-work/13142/4 "2024-12-06T22:00:10Z")

</div>

Thanks. We want to maintain compatibility; I’ll have to think what to do.

---

<div class="post-metadata">

### Author: ![rsalz](https://discourse.cmake.org/user_avatar/discourse.cmake.org/rsalz/32/5179_2.png) [@rsalz](https://discourse.cmake.org/u/rsalz)
#### Post date: [January 9, 2025, 6:02pm UTC](https://discourse.cmake.org/t/how-does-find-openssl-work/13142/5 "2025-01-09T18:02:56Z")

</div>

Just to close the thread, I inverted the order of inclusion and call `configure_file` multiple times. Thanks!
