Commit Graph

114 Commits

Author SHA1 Message Date
Peter Kokot
8481204a0c FindOpenSSL: Fix version range documentation note
Handling version ranges in FindOpenSSL was added in CMake 3.20.
2025-04-13 04:26:36 +02:00
Peter Kokot
44b53f8481 FindOpenSSL: Update documentation
- Added examples section.
- Synced module descriptions a bit with other find modules.
- OpenSSL_FOUND variable used. The OPENSSL_FOUND is also set by the
  find_package_handle_standard_args() to the same value.
- Described the applink interface a bit further.
2025-04-08 00:30:41 +02:00
Kitware Robot
1772622772 LICENSE: Replace references to Copyright.txt with LICENSE.rst
```
git grep -lz 'Copyright.txt or https://cmake.org/licensing ' |
  while IFS= read -r -d $'\0' f ; do
    sed -i '/Copyright.txt or https:\/\/cmake.org\/licensing / {
              s/Copyright.txt/LICENSE.rst/
            }' "$f" ; done
```
2025-03-03 10:43:35 -05:00
Nikita Nemkin
2c3df0237d Modules: Use math() for hex to decimal conversion
math() can parse hex numbers prefixed with "0x" since 3.13.
2025-02-03 15:04:57 +05:00
Brad King
7afa58b15d Modules/Find*: Include FindPackageHandleStandardArgs normally
Since commit d74210a8bd (CMP0017: Remove support for OLD behavior,
2024-11-17) we can rely on CMP0017's NEW behavior unconditionally.
Calling `include(FindPackageHandleStandardArgs)` in a builtin module
will always get the builtin `FindPackageHandleStandardArgs`.
2025-01-30 08:53:12 -05:00
Kai Pastor
25b947589a Modules: Guard calls to pkg_check_modules
Before calling pkg_check_modules, modules must check PKG_CONFIG_FOUND.
When FindPkgConfig.cmake is loaded, pkg_check_modules is always defined
regardless of pkg-config being present. However, the whole module might
be disabled on user request with CMAKE_DISABLE_FIND_PACKAGE_PkgConfig.
This must not break Find modules which just look for a hint or similar.
2024-08-07 20:11:43 +02:00
Brad King
352f8923fc Merge topic 'FindOpenSSL-SLP-layout'
9ff5dae3f6 FindOpenSSL: Update layout for Shining Light Productions debug libraries
aa86f487c2 FindOpenSSL: Update layout for Shining Light Productions 32-bit package

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !9402
2024-04-04 09:29:26 -04:00
Matthias Isele
9ff5dae3f6 FindOpenSSL: Update layout for Shining Light Productions debug libraries
The installer no longer names debug libraries with a `d` suffix.  They
are distinguished by the per-runtime-library directory containing them.

Fixes: #25856
2024-04-03 16:59:30 -04:00
Matthias Isele
aa86f487c2 FindOpenSSL: Update layout for Shining Light Productions 32-bit package
Issue: #25856
2024-04-03 16:59:13 -04:00
Juan Ramos
3cd64287fe Modules: Fix CMP0159 warnings in modules when tracing
Closes: #25829
2024-03-29 13:51:59 -07:00
Matthias Isele
1327e0ff75 FindOpenSSL: Update layout for Shining Light Productions package on Windows
Fixes: #25702
2024-02-23 08:46:11 -05:00
Brad King
791d4fd350 FindOpenSSL: Prefer OPENSSL_ROOT_DIR only if non-empty
Since commit 5cc8a69867 (FindOpenSSL: Trust the user's OPENSSL_ROOT_DIR,
2023-05-17, v3.27.0-rc1~71^2) we use `OPENSSL_ROOT_DIR` whenever it is
defined, even if it is an empty string.  This breaks a pattern in
existing projects that define an empty `OPENSSL_ROOT_DIR` cache entry so
that `cmake-gui` users can fill it in.  Use the value only if non-empty.

Issue: #18352
2023-07-20 12:18:13 -04:00
Brad King
ee98a8d24a Merge topic 'FindOpenSSL-deps'
f7e1e0545f FindOpenSSL: Enable static library dependencies on more platforms

Acked-by: Kitware Robot <kwrobot@kitware.com>
Acked-by: Jürg Billeter <j@bitron.ch>
Merge-request: !8497
2023-05-23 10:57:51 -04:00
Brad King
04b0d5c862 codespell: Fix typos 2023-05-22 16:51:15 -04:00
Brad King
f7e1e0545f FindOpenSSL: Enable static library dependencies on more platforms
Activate the logic from commit 8098bd5768 (FindOpenSSL: add pthread and
dl dependencies to static lib on Linux, 2019-09-13, v3.16.0-rc1~72^2)
on more UNIX platforms.

Fixes: #24870
2023-05-19 15:08:39 -04:00
Richard Levitte
5cc8a69867 FindOpenSSL: Trust the user's OPENSSL_ROOT_DIR
When the user has specified the OpenSSL installation root directory,
through the variable OPENSSL_ROOT_DIR or the environment variable with
the same name, trust it, don't try to find OpenSSL anywhere else.

Fixes: #18352
2023-05-19 05:59:57 +02:00
مهدي شينون (Mehdi Chinoune)
248689f9bf FindOpenSSL: Fix finding header files and static libraries on MinGW
* Avoid searching in the `Program Files` folder because the official
  OpenSSL is built for the MSVC ABI, and so is not compatible with MinGW.

* Static libraries on MinGW has `.a` extension.
2023-04-05 09:49:31 -04:00
Kyle Edwards
24c7279a6f FindOpenSSL: Search for -pthread flag
Because -pthread doesn't begin with -l, it doesn't show up in the
pkgconfig LIBRARIES variable, causing FindOpenSSL to not add the
Threads::Threads dependency. Explicitly search LDFLAGS_EXTRA
for -pthread and add the dependency if it's found.

Fixes: #24532
2023-02-23 13:31:23 -05:00
Brad King
a8cedb1572 FindOpenSSL: Fix regression in dependency on threads
Since commit 1b7804edd0 (FindOpenSSL: use extra dependencies from
pkg-config as well, 2022-12-05, v3.26.0-rc1~227^2) we conditionally find
Threads but unconditionally depend on it.  Make the conditions
consistent.

Fixes: #24505
2023-02-20 10:53:42 -05:00
Kyle Edwards
652f34eab9 FindOpenSSL: Use static pkgconfig if OPENSSL_USE_STATIC_LIBS=ON
Fixes: #24395
2023-02-07 10:38:20 -05:00
Rolf Eike Beer
1b7804edd0 FindOpenSSL: use extra dependencies from pkg-config as well
This is important if OpenSSL is linked against an external zlib.
2022-12-05 13:00:41 +01:00
klytje
ed24414eee FindOpenSSL: Search "lib64" for mingw 64-bit installs 2022-11-07 09:04:00 -05:00
tofraa
42199256af FindOpenSSL: Document use of pkg-config
Issue: #17548
2022-07-05 11:54:40 -04:00
Brad King
475880f39b FindOpenSSL: Reformat hints documentation as definition list 2022-07-05 11:50:21 -04:00
James Calo
4a6caef9d5 FindOpenSSL: Set version variables for version >= 3.0.0
The variables `OPENSSL_VERSION_MAJOR`, `OPENSSL_VERSION_MINOR` and
`OPENSSL_VERSION_FIX` are now set to the correct values when using
OpenSSL version >= 3.0.0, which uses a new format.
2022-06-02 11:14:45 -04:00
Georg Lutz
e6656381aa FindOpenSSL: Support version 1.1.1 under QNX 7.0
QNX 7.0 allows parallel installation of OpenSSL 1.0.2 and OpenSSL 1.1.1. The
1.1.1 version has "1_1" appended to the include dir and library names.
2022-05-06 22:07:07 +02:00
leha-bot
b5a21b0d84 FindOpenSSL: Fix ws2 reference on WinCE
Fixes: #23070
2022-01-28 11:21:52 -05:00
Brad King
0a46df3c91 Merge topic 'FindOpenSSL-applink'
586d483983 FindOpenSSL: Fix typo in applink condition

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !6787
2021-12-07 09:33:26 -05:00
Brad King
ae48449cf0 FindOpenSSL: Search in lib64 directories on non-Windows platforms
The upstream `openssl` build system may install libraries to `lib64`
even on platforms whose conventions do not use `lib64` for
distro-packaged libraries.

Fixes: #22945
2021-12-06 12:03:08 -05:00
Brad King
586d483983 FindOpenSSL: Fix typo in applink condition
In commit 7b83ca816a (FindOpenSSL: add target OpenSSL::applink to
support OpenSSL's applink feature, 2020-05-12, v3.18.0-rc1~150^2) the
version check was written as "major.major.fix" instead of
"major.minor.fix".
2021-12-06 10:50:25 -05:00
Orgad Shaneh
98fa09d5be FindOpenSSL: Link with ws2_32 and crypt32 on Windows/static 2021-06-07 19:23:13 +03:00
Deniz Bahadir
bc00cf9300 FindOpenSSL: Add support for version-range 2021-02-01 12:27:05 +01:00
Ma Br
a6e03b2e6f FindOpenSSL: Distinguish 32-bit and 64-bit search paths on Windows
Fixes: #21611
2020-12-21 13:34:42 -05:00
Nikita Nemkin
8fea95319b Help: Add .. versionadded directives to module docs
Issue: #19715
2020-12-02 21:00:30 +05:00
Sylvain Corlay
1925f9d8eb FindOpenSSL: Add support for finding static libraries
Fixes: #20903
2020-08-13 17:59:13 +02:00
Jean-Christophe Fillion-Robin
207373802e Fix typos identified using codespell
See https://github.com/codespell-project/codespell#readme

The following command was used:

```
codespell -q6 --skip="\
.git,\
*.json,\
./Copyright.txt,\
./Help/command/foreach.rst,\
./Help/prop_test/REQUIRED_FILES.rst,\
./Help/variable/CTEST_COVERAGE_COMMAND.rst,\
./Modules/CMakeCheckCompilerFlagCommonPatterns.cmake,\
./Modules/CMakeRCInformation.cmake,\
./Modules/Internal/CPack/NSIS.template.in,\
./Modules/FindMatlab.cmake,\
./Modules/MatlabTestsRedirect.cmake,\
./Modules/Platform/Windows-Clang.cmake,\
./Modules/Platform/Windows-Intel-Fortran.cmake,\
./Modules/Platform/Windows-MSVC.cmake,\
./Source/CMakeVersion.cmake,\
./Source/cmConvertMSBuildXMLToJSON.py,\
./Source/cmCreateTestSourceList.cxx,\
./Source/cmGlobalVisualStudio10Generator.cxx,\
./Source/cmExportBuildFileGenerator.cxx,\
./Source/cmExportInstallAndroidMKGenerator.cxx,\
./Source/cmExportInstallFileGenerator.cxx,\
./Source/cmExportSet.cxx,\
./Source/cmExportTryCompileFileGenerator.cxx,\
./Source/cmFindPackageCommand.cxx,\
./Source/cmInstallCommand.cxx,\
./Source/cmGeneratorExpressionLexer.cxx,\
./Source/cmLocalVisualStudio7Generator.cxx,\
./Source/cmOrderDirectories.cxx,\
./Source/cmTarget.cxx,\
./Source/kwsys/*,\
./Source/QtDialog/CMakeSetupDialog.ui,\
./Source/CPack/WiX/cmWIXRichTextFormatWriter.cxx,\
./Source/CTest/cmParseCoberturaCoverage.h,\
./Tests/CMakeTests/ImplicitLinkInfoTest.cmake.in,\
./Tests/RunCMake/CPack/tests/DMG_SLA/English.license.rtf,\
./Tests/RunCMake/CPack/tests/DMG_SLA/German.license.txt,\
./Tests/RunCMake/CPack/tests/DMG_SLA/German.menu.txt,\
./Tests/RunCMake/GoogleTest/xml_output.cpp,\
./Tests/RunCMake/Make/TargetMessages*,\
./Utilities/*,\
" \
-L "\
dependees,\
endwhile,\
fo,\
filetest,\
helpfull,\
nd,\
objext,\
stoll,\
supercedes,\
superceded,\
vas,\
varn,\
"
```
2020-07-22 12:44:47 -04:00
Brad King
cc1592d708 Merge topic 'FindOpenSSL-3.0'
796b447373 FindOpenSSL: Fix OpenSSL 3.0.0 version extraction

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !4860
2020-06-09 08:53:06 -04:00
Billy Brumley
796b447373 FindOpenSSL: Fix OpenSSL 3.0.0 version extraction
Fix the regex syntax added by commit 61d746e592 (FindOpenSSL: Detect
OpenSSL 3.0.0, 2020-05-27, v3.17.3~1^2).  Add missing escapes.
Test with `openssl-3.0.0-alpha3`.

While at it, also unset a temporary variable after use.
2020-06-08 08:24:57 -04:00
Brad King
40748ec1d9 Merge topic 'openssl-3.0.0'
61d746e592 FindOpenSSL: Detect OpenSSL 3.0.0

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !4805
2020-05-28 06:51:52 -04:00
Vitezslav Cizek
61d746e592 FindOpenSSL: Detect OpenSSL 3.0.0
The OpenSSL versioning is changing with the upcoming 3.0.0 release.
https://www.openssl.org/blog/blog/2018/11/28/version/
Since 3.0.0, the patch letters are being dropped. The new format is:
MAJOR.MINOR.PATCH

The OPENSSL_VERSION variable can now be directly derived from the new
OPENSSL_VERSION_STR macro.
https://www.openssl.org/docs/manmaster/man3/OPENSSL_VERSION_NUMBER.html
2020-05-27 09:08:10 -04:00
gnaggnoyil
7b83ca816a FindOpenSSL: add target OpenSSL::applink to support OpenSSL's applink feature
Fixes: #20701
2020-05-15 15:50:10 +08:00
Ben Boeckel
af158149e7 FindOpenSSL: do not mark a local variable as advanced 2020-01-20 15:49:29 -05:00
Ashley Whetter
90973c4abd FindOpenSSL: Fix ordering of dependency link flags
Fixes: #20082
2019-12-31 15:01:35 -08:00
Denis Thulin
24d52daf49 FindOpenSSL: Lookup all pkg-config directories
When using a custom sysroot to build things using pkg-config, some of
the output variables feature the sysroot while others do not:

```console
$ export PKG_CONFIG_SYSROOT_DIR=/path/to/sysroot
$ export PKG_CONFIG_LIBDIR=/path/to/sysroot/usr/lib/pkgconfig
$ pkg-config --cflags-only-I openssl
-I/path/to/sysroot/usr/include/
$ pkg-config --variable=includedir openssl
/usr/include
$ pkg-config --libs-only-L openssl
-L/path/to/sysroot/usr/lib
$ pkg-config --variable=libdir openssl
/usr/lib
```

When using `pkg_check_modules`, it's pretty much the same:
```cmake
pkg_check_modules(_OPENSSL QUIET openssl)
_OPENSSL_INCLUDE_DIRS == /path/to/sysroot/usr/include/
_OPENSSL_INCLUDEDIR == /usr/include
_OPENSSL_LIBRARY_DIRS == -L/path/to/sysroot/usr/lib
_OPENSSL_LIBDIR == /usr/lib
```

However, FindOpenSSL only searches for headers in `INCLUDEDIR` and
libraries in `LIBDIR` instead of searching `INCLUDE_DIRS` and
`LIBRARY_DIRS` as well.

This fixes that behaviour.

Fixes: #16885

Signed-off-by: Denis Thulin <denis.thulin@enyx.fr>
2019-11-07 16:44:12 +01:00
David Callu
8098bd5768 FindOpenSSL: add pthread and dl dependencies to static lib on Linux 2019-09-20 22:39:20 +02:00
Kitware Robot
df4ed1e9ff Help: Convert remaining modules to block-style comments 2018-10-22 11:09:34 -04:00
Harry Mallon
912a6c1cb5 FindOpenSSL: Add component support 2018-04-16 12:38:39 +01:00
luzpaz
777e87ae00 Fix trivial typos in text
Some are user facing.

Found using

    codespell -q 3 --skip="./Utilities" -I .cmake-whitelist.txt`

whereby the whitelist contained:

    ans
    dum
    helpfull
    emmited
    emmitted
    buil
    iff
    isnt
    nto
    ot
    pathes
    substract
    te
    todays
    upto
    whitespaces
2017-11-03 10:25:05 -04:00
Robert Dailey
d371b52fdf FindOpenSSL: Search 'ssld' and 'crypod' for debug variants
Release variant search already considered `ssl` and `crypto`, but
similarly named libs with `d` postfix were not searched for debug
variant.
2017-09-08 13:57:55 -05:00
Brad King
300979e788 Merge topic 'FindOpenSSL-crypto-only'
8b410453 FindOpenSSL: Restore support for crypto-only result

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !846
2017-05-16 09:49:05 -04:00