|
60 | 60 | ]] |
61 | 61 | cmake_minimum_required(VERSION 3.14.0 FATAL_ERROR) |
62 | 62 |
|
63 | | -# On systems without Git installed, there were errors since execute_process seemed to not throw an error without it? |
64 | | -find_package(Git QUIET) |
65 | | -if(Git_FOUND) |
66 | | - # Gets the latest tag as a string like "v0.6.6" |
67 | | - # Can silently fail if git isn't on the system |
68 | | - execute_process(COMMAND ${GIT_EXECUTABLE} describe --tags --abbrev=0 |
69 | | - WORKING_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}" |
70 | | - OUTPUT_VARIABLE _raw_version_string |
71 | | - ERROR_VARIABLE _git_tag_error |
72 | | - ) |
73 | | -endif() |
| 63 | +# Get the user agent and use it as a version |
| 64 | +# This gets the string with the user agent from the header. |
| 65 | +# This is so the maintainer doesn't actually need to update this manually. |
| 66 | +file(STRINGS httplib.h _raw_version_string REGEX "User\-Agent.*cpp\-httplib/([0-9]+\.?)+") |
74 | 67 |
|
75 | | -# execute_process can fail silenty, so check for an error |
76 | | -# if there was an error, just use the user agent as a version |
77 | | -if(_git_tag_error OR NOT Git_FOUND) |
78 | | - message(WARNING "cpp-httplib failed to find the latest Git tag, falling back to using user agent as the version.") |
79 | | - # Get the user agent and use it as a version |
80 | | - # This gets the string with the user agent from the header. |
81 | | - # This is so the maintainer doesn't actually need to update this manually. |
82 | | - file(STRINGS httplib.h _raw_version_string REGEX "User\-Agent.*cpp\-httplib/([0-9]+\.?)+") |
83 | | -endif() |
84 | 68 | # Needed since git tags have "v" prefixing them. |
85 | 69 | # Also used if the fallback to user agent string is being used. |
86 | 70 | string(REGEX MATCH "([0-9]+\\.?)+" _httplib_version "${_raw_version_string}") |
|
0 commit comments