Commit Graph

44 Commits

Author SHA1 Message Date
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
d138555959 Help: Use Title Case for all "Imported Targets" sections 2025-01-31 12:23:29 -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
Brad King
d039da1c24 FindCURL: Add CURL_VERSION variable to match upstream cmake package
`find_package(CURL CONFIG)` provides `CURL_VERSION` from the upstream
cmake package version file.

Upstream curl commit `699ac9430c` (cmake: publish/check supported
protocols/features via `CURLConfig.cmake`, 2024-12-29) extends the
upstream cmake package to provide our old `CURL_VERSION_STRING`.
Provide both names from CMake's own module to aid transition.

Fixes: #26634
2025-01-28 09:52:22 -05:00
Tobias Mayer
76c2d7781e FindCURL: Add more target properties from pkg-config
In case libcurl was found via pkg-config, the properties
`INTERFACE_LINK_LIBRARIES`, `INTERFACE_LINK_OPTINS`, and
`INTERFACE_COMPILE_OPTINS` can be populated from the `PC_CURL_*`
variables if available.

Fixes: #26365
2024-10-14 10:11:15 -04:00
Juan Ramos
3cd64287fe Modules: Fix CMP0159 warnings in modules when tracing
Closes: #25829
2024-03-29 13:51:59 -07:00
Alex Overchenko
a76aad6ca6 FindCURL: Add support for finding static libcurl_a.lib on Windows
Fixes: #25810
2024-03-25 15:31:30 -04:00
lingbin
ab6b44b1bb FindCURL: Fix parsing protocols/features from pkg-config output
Previously `find_package(CURL COMPONENTS HTTP)` failed because the
`CURL_SUPPORTED_PROTOCOLS` variable returned by pkg-config is
a command-line fragment, but we need a semicolon-separated list.
2023-12-19 09:36:09 -05:00
Even Rouault
97d0f76453 FindCURL: add a CURL_USE_STATIC_LIBS hint
The effect of that hint is to set a CURL_STATICLIB compile definition,
and to auxiliary system windows libraries for MSVC builds.

GDAL-Issue: https://github.com/OSGeo/gdal/issues/7955
2023-06-22 10:17:16 -04:00
Georg Lutz
0b7ae2af0d FindCURL: Fix version string in case of multiple curl installations
On systems where there are two versions of libcurl installed
CURL_VERSION_STRING is always set to the version found by the
`pkg_check_modules(PC_CURL QUIET libcurl)`.

But CURL_VERSION_STRING should match the libs and include paths found by
`find_path` and `find_library` (more specifically the path where the
header is found, because that where the version is parsed from.

So make sure that the version is always parsed from the header file, use
the output of pkg_check_modules only as HINT for find_path /
find_library.
2022-07-27 15:05:20 -04:00
makise-homura
886ba0b1d6 FindCURL: Set CURL_VERSION_STRING when curl is found as a package
FindCURL, when found as `curl-config.cmake`, will fill `CURL_VERSION`
instead of `CURL_VERSION_STRING` variable.  It may break some cases
when user is relying on correct value of the latter variable, and
as an example, already breaks `CMakeOnly.AllFindModules` test.
2022-06-28 11:15:24 -04:00
Nikita Nemkin
8fea95319b Help: Add .. versionadded directives to module docs
Issue: #19715
2020-12-02 21:00:30 +05:00
Brad King
292a86bb8e Merge topic 'FindCURL-list-index-if'
0faedae335 FindCURL: Fix list index check after search

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !5070
2020-07-29 08:05:47 -04:00
Mike Gelfand
0faedae335 FindCURL: Fix list index check after search
Fix logic added by commit fc5afbe970 (FindCURL: support COMPONENTS to
check features, 2018-11-28, v3.14.0-rc1~287^2~2).

When searching for particular components and `curl-config` reports one of
the components being searched for first in the list, `find_package` fails.
This is due to the check that treats non-zero index in the list as success
and zero index as failure, while documentation on `list(FIND)` states that
failure to find an element results in return value of -1 (not 0). I'm
hitting this when building cURL with support for HTTP and HTTPS protocols
only, and then trying to `find_package(CURL COMPONENTS HTTP HTTPS)`.

I'm using `if(NOT x EQUAL -1)` check form as it appears to be the most used
throughout the modules.

While fixing this issue I've looked through all the uses of `list(FIND)` in
other modules but wasn't able to find improper use except here.
2020-07-28 09:09:43 -04:00
Sibi Siddharthan
6c77c61532 FindCURL use NAMES_PER_DIR
Signed-off-by: Sibi Siddharthan <sibisiddharthan.github@gmail.com>
2020-07-02 00:38:11 +05:30
Charles Barto
c11e7c5c3d FindCURL: Try to find CURLConfig.cmake 2019-10-15 13:56:28 -04:00
Bartosz Kosiorek
cb811d11ce Help: Improve description of modules 2019-04-23 10:39:34 +02:00
Hiroshi Miura
0526ae4415 FindCURL: fix component failure when no pkg-config
find_package(CURL COMPONENTS foo) fails when there is
no pkg-config module because of variable name typo.

Signed-off-by: Hiroshi Miura <miurahr@linux.com>
Fixes: #18802
2019-01-21 07:49:00 -05:00
Hiroshi Miura
fc5afbe970 FindCURL: support COMPONENTS to check features
- Use pkg-config or curl-config to retrieve version,
  supported features and protocols.
- Support optional COMPONENTS to check supported features

Signed-off-by: Hiroshi Miura <miurahr@linux.com>
2018-12-06 11:49:04 -05:00
Kitware Robot
df4ed1e9ff Help: Convert remaining modules to block-style comments 2018-10-22 11:09:34 -04:00
Hiroshi Miura
59b3e78451 FindCURL: Find debug and release variants separately
Fixes: #17887
2018-07-03 13:40:49 -04:00
Hiroshi Miura
6a9fe250a7 FindCURL: Improve CURL::libcurl property code layout 2018-07-03 13:31:48 -04:00
Brad King
1e356734a7 FindCURL: Rename imported target to match upstream CURL
Upstream CURL provides imported target `CURL::libcurl`.  Rename the
target added by `FindCURL` to match.  We don't need compatibility with
the old name because it has never been in a CMake release (except a 3.12
release candidate).

Suggested-by: Jakub Zakrzewski <slither.jz@gmail.com>
Acked-by: Rolf Eike Beer <eike@sf-mail.de>
Fixes: #18091
2018-06-18 13:58:21 -04:00
Brad King
ee06f3c339 FindCURL: Revise documentation markup 2018-03-07 09:06:01 -05:00
Rolf Eike Beer
83c0cb3f03 FindCURL: provide imported target CURL::CURL 2018-03-06 22:53:35 +01:00
Rolf Eike Beer
745b56f58c Find*.cmake: drop the comments before including FPHSA
No need to explain this over and over again.  While at it, do some other
minor cleanups to whitespace and comments (i.e. delete them).
2016-11-28 16:40:13 -05:00
Brad King
86578eccf2 Simplify CMake per-source license notices
Per-source copyright/license notice headers that spell out copyright holder
names and years are hard to maintain and often out-of-date or plain wrong.
Precise contributor information is already maintained automatically by the
version control tool.  Ultimately it is the receiver of a file who is
responsible for determining its licensing status, and per-source notices are
merely a convenience.  Therefore it is simpler and more accurate for
each source to have a generic notice of the license name and references to
more detailed information on copyright holders and full license terms.

Our `Copyright.txt` file now contains a list of Contributors whose names
appeared source-level copyright notices.  It also references version control
history for more precise information.  Therefore we no longer need to spell
out the list of Contributors in each source file notice.

Replace CMake per-source copyright/license notice headers with a short
description of the license and links to `Copyright.txt` and online information
available from "https://cmake.org/licensing".  The online URL also handles
cases of modules being copied out of our source into other projects, so we
can drop our notices about replacing links with full license text.

Run the `Utilities/Scripts/filter-notices.bash` script to perform the majority
of the replacements mechanically.  Manually fix up shebang lines and trailing
newlines in a few files.  Manually update the notices in a few files that the
script does not handle.
2016-09-27 15:14:44 -04:00
Kitware Robot
f051814ed0 Convert builtin help to reStructuredText source files
Run the convert-help.bash script to convert documentation:

 ./convert-help.bash "/path/to/CMake-build/bin"

Then remove it.
2013-10-15 14:12:03 -04:00
Andreas Mohr
708b53e709 FindCURL: Find older MSVC prebuilts
Older Windows MSVC CURL prebuilts have the .lib named as "libcurl.lib".
2012-10-01 13:21:46 -04:00
Kitware Robot
9db3116226 Remove CMake-language block-end command arguments
Ancient versions of CMake required else(), endif(), and similar block
termination commands to have arguments matching the command starting the
block.  This is no longer the preferred style.

Run the following shell code:

for c in else endif endforeach endfunction endmacro endwhile; do
    echo 's/\b'"$c"'\(\s*\)(.\+)/'"$c"'\1()/'
done >convert.sed &&
git ls-files -z -- bootstrap '*.cmake' '*.cmake.in' '*CMakeLists.txt' |
egrep -z -v '^(Utilities/cm|Source/kwsys/)' |
egrep -z -v 'Tests/CMakeTests/While-Endwhile-' |
xargs -0 sed -i -f convert.sed &&
rm convert.sed
2012-08-13 14:19:16 -04:00
Kitware Robot
77543bde41 Convert CMake-language commands to lower case
Ancient CMake versions required upper-case commands.  Later command
names became case-insensitive.  Now the preferred style is lower-case.

Run the following shell code:

cmake --help-command-list |
grep -v "cmake version" |
while read c; do
    echo 's/\b'"$(echo $c | tr '[:lower:]' '[:upper:]')"'\(\s*\)(/'"$c"'\1(/g'
done >convert.sed &&
git ls-files -z -- bootstrap '*.cmake' '*.cmake.in' '*CMakeLists.txt' |
egrep -z -v '^(Utilities/cm|Source/kwsys/)' |
xargs -0 sed -i -f convert.sed &&
rm convert.sed
2012-08-13 14:19:16 -04:00
Kitware Robot
7bbaa4283d Remove trailing whitespace from most CMake and C/C++ code
Our Git commit hooks disallow modification or addition of lines with
trailing whitespace.  Wipe out all remnants of trailing whitespace
everywhere except third-party code.

Run the following shell code:

git ls-files -z -- \
 bootstrap doxygen.config '*.readme' \
 '*.c' '*.cmake' '*.cpp' '*.cxx' \
 '*.el' '*.f' '*.f90' '*.h' '*.in' '*.in.l' '*.java' \
 '*.mm' '*.pike' '*.py' '*.txt' '*.vim' |
egrep -z -v '^(Utilities/cm|Source/(kwsys|CursesDialog/form)/)' |
egrep -z -v '^(Modules/CPack\..*\.in)' |
xargs -0 sed -i 's/ \+$//'
2012-08-13 14:18:39 -04:00
Rolf Eike Beer
0640ec9476 FindCURL: detect version number also for older versions
Older versions of cURL do not have a curlver.h, but have the version define
directly in curl.h.
2012-01-26 18:25:25 +01:00
Rolf Eike Beer
c1b884965f FindCURL: support version selection 2012-01-23 21:46:56 +01:00
Brad King
c4275592a8 Modules: Include builtin FindPackageHandleStandardArgs directly
The FindPackageHandleStandardArgs module was originally created outside
of CMake.  It was added for CMake 2.6.0 by commit e118a627 (add a macro
FIND_PACKAGE_HANDLE_STANDARD_ARGS..., 2007-07-18).  However, it also
proliferated into a number of other projects that at the time required
only CMake 2.4 and thus could not depend on CMake to provide the module.
CMake's own find modules started using the module in commit b5f656e0
(use the new FIND_PACKAGE_HANDLE_STANDARD_ARGS in some of the FindXXX
modules..., 2007-07-18).

Then commit d358cf5c (add 2nd, more powerful mode to
find_package_handle_standard_args, 2010-07-29) added a new feature to
the interface of the module that was fully optional and backward
compatible with all existing users of the module.  Later commit 5f183caa
(FindZLIB: use the FPHSA version mode, 2010-08-04) and others shortly
thereafter started using the new interface in CMake's own find modules.
This change was also backward compatible because it was only an
implementation detail within each module.

Unforutnately these changes introduced a problem for projects that still
have an old copy of FindPackageHandleStandardArgs in CMAKE_MODULE_PATH.
When any such project uses one of CMake's builtin find modules the line

  include(FindPackageHandleStandardArgs)

loads the copy from the project which does not have the new interface!
Then the including find module tries to use the new interface with the
old module and fails.

Whether this breakage can be considered a backward incompatible change
in CMake is debatable.  The situation is analagous to copying a standard
library header from one version of a compiler into a project and then
observing problems when the next version of the compiler reports errors
in its other headers that depend on its new version of the original
header.  Nevertheless it is a change to CMake that causes problems for
projects that worked with previous versions.

This problem was discovered during the 2.8.3 release candidate cycle.
It is an instance of a more general problem with projects that provide
their own versions of CMake modules when other CMake modules depend on
them.  At the time we resolved this instance of the problem with commit
b0118402 (Use absolute path to FindPackageHandleStandardArgs.cmake
everywhere, 2010-09-28) for the 2.8.3 release.

In order to address the more general problem we introduced policy
CMP0017 in commit db44848f (Prefer files from CMAKE_ROOT when including
from CMAKE_ROOT, 2010-11-17).  That change was followed by commit
ce28737c (Remove usage of CMAKE_CURRENT_LIST_DIR now that we have
CMP0017, 2010-12-20) which reverted the original workaround in favor of
using the policy.  However, existing project releases do not set the
policy behavior to NEW and therefore still exhibit the problem.

We introduced in commit a364daf1 (Allow users to specify defaults for
unset policies, 2011-01-03) an option for users to build existing
projects by adding -DCMAKE_POLICY_DEFAULT_CMP0017=NEW to the command
line.  Unfortunately this solution still does not allow such projects to
build out of the box, and there is no good way to suggest the use of the
new option.

The only remaining solution to keep existing projects that exhibit this
problem building is to restore the change originally made in commit
b0118402 (Use absolute path to FindPackageHandleStandardArgs.cmake
everywhere, 2010-09-28).  This also avoids policy CMP0017 warnings for
this particular instance of the problem the policy addresses.
2011-01-20 10:56:49 -05:00
Alex Neundorf
ce28737c93 Remove usage of CMAKE_CURRENT_LIST_DIR now that we have CMP0017
This puts the new search behaviour for included files in action, i.e.
now when a file from Modules/ include()s another file, it also gets the
one from Modules/ included, i.e. the one it expects.

Alex
2011-01-04 08:20:08 -05:00
Alex Neundorf
b01184022b Use absolute path to FindPackageHandleStandardArgs.cmake everywhere
This is to avoid getting an (older) copy of FPHSA.cmake which is
e.g. installed with KDE 4.5.0 and 4.5.1.

Alex
2010-09-28 22:30:31 +02:00
Todd Gamblin
2cde67a781 Modules: Fix spelling 'To distributed' -> 'To distribute' 2010-08-09 08:48:31 -04:00
Philip Lowman
aefd10ad70 Fixes issue #9862 by adding official msvc import library names to FindCURL 2010-01-04 23:25:57 -05:00
Brad King
c4bb9c9d42 Convert CMake find-modules to BSD License
This adds copyright/license notification blocks CMake's find-modules.
Many of the modules had no notices at all.  Some had notices referring
to the BSD license already.  This commit normalizes existing notices and
adds missing notices.
2009-09-28 11:45:50 -04:00
Alexander Neundorf
13db5b578b ENH: add second failure message parameter to
FIND_PACKAGE_HANDLE_STANDARD_ARGS(), so cmake modules can specify their own
better failure messages. If the default is ok use "DEFAULT_MSG".
Do this also for FindBoost.cmake (#5349)

Alex
2007-07-23 09:49:52 -04:00
Alexander Neundorf
c7770b8edb ENH: use the new FIND_PACKAGE_HANDLE_STANDARD_ARGS() macro in most of the
not-too-complicated modules
-remove unnecessary default search paths used in the FIND_XXX() calls

Alex
2007-07-19 09:00:51 -04:00
Alexander Neundorf
a5be2b7782 BUG: honor REQUIRED and QUIETLY (#5312)
Alex
2007-07-12 11:05:57 -04:00
Brad King
d25595a83c ENH: Find module for CURL library. 2006-10-19 12:55:44 -04:00