vcpkg/ports/neargye-semver/portfile.cmake
Justen Di Ruscio 441831b902
[neargye-semver] use find-package support in vcpkg port (#36862)
Originally, this port copied the single header provided by the upstream
into the install destination. This required consumers to use the package
via `find_path(semver.hpp)`, which is less robust, is inconsistent, and
doesn't use targets.

These changes update the vcpkg port to leverage the config-file package
offered by [neargye/semver](https://github.com/Neargye/semver). With
this, consumers use the package through `find_package(neargye-semver
CONFIG), and the target `semver::semver`.

- [x] Changes comply with the [maintainer
guide](https://github.com/microsoft/vcpkg-docs/blob/main/vcpkg/contributing/maintainer-guide.md).
- ~[ ] SHA512s are updated for each updated download.~
- ~[ ] The "supports" clause reflects platforms that may be fixed by
this new version.~
- ~[ ] Any fixed [CI
baseline](https://github.com/microsoft/vcpkg/blob/master/scripts/ci.baseline.txt)
entries are removed from that file.~
- ~[ ] Any patches that are no longer applied are deleted from the
port's directory.~
- [x] The version database is fixed by rerunning `./vcpkg x-add-version
--all` and committing the result.
- [x] Only one version is added to each modified port's versions file.
2024-02-21 09:28:24 -08:00

24 lines
754 B
CMake

set(VCPKG_BUILD_TYPE release) # header-only port
vcpkg_from_github(
OUT_SOURCE_PATH SOURCE_PATH
REPO Neargye/semver
REF v${VERSION}
SHA512 b620a27d31ca2361e243e4def890ddfc4dfb65a507187c918fabc332d48c420fb10b0e6fb38c83c4c3998a047201e81b70a164c66675351cf4ff9475defc6287
HEAD_REF master
)
vcpkg_cmake_configure(
SOURCE_PATH "${SOURCE_PATH}"
OPTIONS
-DSEMVER_OPT_INSTALL=ON
-DSEMVER_OPT_BUILD_EXAMPLES=OFF
-DSEMVER_OPT_BUILD_TESTS=OFF
)
vcpkg_cmake_install()
vcpkg_cmake_config_fixup(PACKAGE_NAME semver CONFIG_PATH "lib/cmake/semver")
vcpkg_install_copyright(FILE_LIST "${SOURCE_PATH}/LICENSE")
file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/lib") # empty; rm for vcpkg validity checks