You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

75 lines
2.2 KiB

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.
9 years ago
  1. # Distributed under the OSI-approved BSD 3-Clause License. See accompanying
  2. # file Copyright.txt or https://cmake.org/licensing for details.
  3. #.rst:
  4. # FindCURL
  5. # --------
  6. #
  7. # Find the native CURL headers and libraries.
  8. #
  9. # IMPORTED Targets
  10. # ^^^^^^^^^^^^^^^^
  11. #
  12. # This module defines :prop_tgt:`IMPORTED` target ``CURL::CURL``, if
  13. # curl has been found.
  14. #
  15. # Result Variables
  16. # ^^^^^^^^^^^^^^^^
  17. #
  18. # This module defines the following variables:
  19. #
  20. # ``CURL_FOUND``
  21. # True if curl found.
  22. #
  23. # ``CURL_INCLUDE_DIRS``
  24. # where to find curl/curl.h, etc.
  25. #
  26. # ``CURL_LIBRARIES``
  27. # List of libraries when using curl.
  28. #
  29. # ``CURL_VERSION_STRING``
  30. # The version of curl found.
  31. # Look for the header file.
  32. find_path(CURL_INCLUDE_DIR NAMES curl/curl.h)
  33. mark_as_advanced(CURL_INCLUDE_DIR)
  34. # Look for the library (sorted from most current/relevant entry to least).
  35. find_library(CURL_LIBRARY NAMES
  36. curl
  37. # Windows MSVC prebuilts:
  38. curllib
  39. libcurl_imp
  40. curllib_static
  41. # Windows older "Win32 - MSVC" prebuilts (libcurl.lib, e.g. libcurl-7.15.5-win32-msvc.zip):
  42. libcurl
  43. )
  44. mark_as_advanced(CURL_LIBRARY)
  45. if(CURL_INCLUDE_DIR)
  46. foreach(_curl_version_header curlver.h curl.h)
  47. if(EXISTS "${CURL_INCLUDE_DIR}/curl/${_curl_version_header}")
  48. file(STRINGS "${CURL_INCLUDE_DIR}/curl/${_curl_version_header}" curl_version_str REGEX "^#define[\t ]+LIBCURL_VERSION[\t ]+\".*\"")
  49. string(REGEX REPLACE "^#define[\t ]+LIBCURL_VERSION[\t ]+\"([^\"]*)\".*" "\\1" CURL_VERSION_STRING "${curl_version_str}")
  50. unset(curl_version_str)
  51. break()
  52. endif()
  53. endforeach()
  54. endif()
  55. include(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake)
  56. FIND_PACKAGE_HANDLE_STANDARD_ARGS(CURL
  57. REQUIRED_VARS CURL_LIBRARY CURL_INCLUDE_DIR
  58. VERSION_VAR CURL_VERSION_STRING)
  59. if(CURL_FOUND)
  60. set(CURL_LIBRARIES ${CURL_LIBRARY})
  61. set(CURL_INCLUDE_DIRS ${CURL_INCLUDE_DIR})
  62. if(NOT TARGET CURL::CURL)
  63. add_library(CURL::CURL UNKNOWN IMPORTED)
  64. set_target_properties(CURL::CURL PROPERTIES INTERFACE_INCLUDE_DIRECTORIES "${CURL_INCLUDE_DIRS}")
  65. set_property(TARGET CURL::CURL APPEND PROPERTY IMPORTED_LOCATION "${CURL_LIBRARY}")
  66. endif()
  67. endif()